{"_id":"@aofl/store","_rev":"167-149a96f60a85f9004a09577e69857b72","name":"@aofl/store","dist-tags":{"next":"2.1.0-alpha.10","next-alpha":"3.0.0-alpha.12","beta":"3.5.0-beta.22","alpha":"4.0.0-alpha.45","latest":"3.14.1"},"versions":{"1.0.0":{"name":"@aofl/store","version":"1.0.0","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/store@1.0.0","maintainers":[{"name":"ariankhosravi","email":"arian@arin.io"}],"dist":{"shasum":"0423d7aa9e8a122b4490c2aec25f17baf19d06fc","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0.tgz","integrity":"sha512-B3S/oMTj860xj9XUY1+gegVC9ilYg6nIWAq04/bJijmPZvBWFGw+5d7Jmj7s6OCBLoTHWTvGWuQAZV5ULH2RlA==","signatures":[{"sig":"MEUCIB8o4uLLvqzPnj61fTA2OOY3z1CknNX4I29RLH7a1PZgAiEAnGUzXHUXGqKitPmnwZ6nSTdLlkdYeNJX6ZnHb6p4EMI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0","@aofl/register-callback":"^1.0.0"},"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store-1.0.0.tgz_1516928053596_0.7914900910109282","host":"s3://npm-registry-packages"}},"1.0.0-beta.1":{"name":"@aofl/store","version":"1.0.0-beta.1","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/store@1.0.0-beta.1","maintainers":[{"name":"sergolius","email":"sergolius@gmail.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"372846db64c09839f147dcab7168a7c00edc9936","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.1.tgz","integrity":"sha512-3iaA7iK1aQkG6TQQNQi4oyTgBurGzd7n7TTRufsx8Wf7CmQ4rMtIh+0n0VaF2fQrgLrWU/OthDnz29eJzoGayw==","signatures":[{"sig":"MEYCIQDyTwIcFYaxGnws4sP/pr6CxbS0Hhofiu9HZJqqDHSd3QIhAN0s8pqLZaqmsSXNYa7UzbVMBJGTs5IAeKP7YL51/6wr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0","@aofl/register-callback":"^1.0.0"},"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store-1.0.0-beta.1.tgz_1517447467051_0.2990303630940616","host":"s3://npm-registry-packages"}},"1.0.0-beta.2":{"name":"@aofl/store","version":"1.0.0-beta.2","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/store@1.0.0-beta.2","maintainers":[{"name":"sergolius","email":"sergolius@gmail.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"1d5fd9c8cb9ca611552acffd412233fc397cf893","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.2.tgz","integrity":"sha512-7Bc+e1GdF5sz2IPhqPLKZHsqKUJWPdkIpEOOcy7ehutJ32pQfB3Rn+ToqRtigSvuBeIwYp8w0TiU8lxIiJ9jOA==","signatures":[{"sig":"MEUCIQD8dq7NWecaWRixGBqCMEk2yM0/wMS+vMru7mI4saYcXQIgJIyjyyIvyMpV0jQrHDhh0ieirU+SUtcGeVHjep9uhKE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0","@aofl/register-callback":"^1.0.0"},"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store-1.0.0-beta.2.tgz_1517508806292_0.6095958678051829","host":"s3://npm-registry-packages"}},"1.0.0-beta.3":{"name":"@aofl/store","version":"1.0.0-beta.3","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/store@1.0.0-beta.3","maintainers":[{"name":"sergolius","email":"sergolius@gmail.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"552566372af70460b7cfc319b1a87ab916598972","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.3.tgz","integrity":"sha512-kLVGpNEfFzI+z0NRs7BmGeUj9iOcm4hoiOivE4FpfZ7wPs2AiY8/33GmAwDnz9BsPV1Nnn8Zb8yj4ktdnxTM6w==","signatures":[{"sig":"MEQCIF3ICg7NkizamUeFU7O8Za9fHRyfZRui60n3RxiZbnY3AiAJd6JOjlw6sc4o5k5lzIWaySR2rayb/iRMKt750Qhz3A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0","@aofl/register-callback":"^1.0.0"},"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store-1.0.0-beta.3.tgz_1517509225807_0.49043190758675337","host":"s3://npm-registry-packages"}},"1.0.0-beta.4":{"name":"@aofl/store","version":"1.0.0-beta.4","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/store@1.0.0-beta.4","maintainers":[{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"},{"name":"sergolius","email":"sergolius@gmail.com"}],"dist":{"shasum":"7535569a517f469d8a3e3b44fdf4244258810ef3","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.4.tgz","fileCount":3,"integrity":"sha512-SOrQ1WHdyGxYedBhRRmg3ty077vaQ7V3X4uWEPlWojHj5HCoGeND2FOEQy5NEPAPpJI0CJFUKVPJYd9trLGQUg==","signatures":[{"sig":"MEYCIQCPx1q9X73a/2fvfcCAAFVzYOn5sMAOY2Lo+MD5MFhDGgIhAMKbowqg5eZcxjxQEDI4pj+lBHAAWf3NqoKlUKIoYY3f","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5161},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0","@aofl/register-callback":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.4_1518465369474_0.17865340741793334","host":"s3://npm-registry-packages"}},"1.0.0-beta.5":{"name":"@aofl/store","version":"1.0.0-beta.5","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/store@1.0.0-beta.5","maintainers":[{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"},{"name":"sergolius","email":"sergolius@gmail.com"}],"dist":{"shasum":"4b30327f98aa3aae555e2f41508029f4c8bd945c","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.5.tgz","fileCount":3,"integrity":"sha512-nm2pkfqfKswHUsoM+Zcqa7rkU6iVmXks60v/U5QIgFM9dIn90RPGSmu/QFPgUUPF9lrqPu07UFLb10zCwcqQ+w==","signatures":[{"sig":"MEUCIQCuDPxUEC2BDggF71KWRv/9INQiK1a7mnPGmLqnFdaECQIgHMaeXPzsFnaFxibexVC16Evu3KVobca8BUblioLWF3k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5179},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0","@aofl/register-callback":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.5_1518739918121_0.9460127340480733","host":"s3://npm-registry-packages"}},"1.0.0-beta.6":{"name":"@aofl/store","version":"1.0.0-beta.6","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/store@1.0.0-beta.6","maintainers":[{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"},{"name":"sergolius","email":"sergolius@gmail.com"}],"dist":{"shasum":"3b54a7ef1bc206c8ae3664ab3edaf80ea561ed10","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.6.tgz","fileCount":3,"integrity":"sha512-WH2HfO+jIXnevdP+9Y5k+dAxKY0sEihIqtRxyXih0xiIAJU3Jx/hNnnNa3jo3vpLXqGNyYEx9fey07Y9OMonnA==","signatures":[{"sig":"MEQCIHlX6kEw3qJYe82n232E4Cy+mFnCL33VJ+Nkpa9W86VaAiBKVr7M3kzrPHLAXzMyE5XTUOtKAa95ASjUbv905CLFOg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5091},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0","@aofl/register-callback":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.6_1520644473414_0.7233720377311192","host":"s3://npm-registry-packages"}},"1.0.0-beta.7":{"name":"@aofl/store","version":"1.0.0-beta.7","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/store@1.0.0-beta.7","maintainers":[{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"},{"name":"sergolius","email":"sergolius@gmail.com"}],"dist":{"shasum":"861c87267fc06629273c457dc149ac0f62a3b2c4","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.7.tgz","fileCount":3,"integrity":"sha512-n/HECcqqtTfZMuBrlbiQM+LxKc7qiOSmHZJOMZ+2CrojPsIpNYc9iDj3+CsrRnWmnjWPhKIjZVGzokye/4lYJg==","signatures":[{"sig":"MEUCIQC0pgt0xjifB3XOv65OP0CzC+L3d7vJJvKNqfzqhY0yyQIgBtZg4ZviPTPc9QbScorY4ouqMlJEUKHp7q+czxdS3lE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5105},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0-beta.2","@aofl/register-callback":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.7_1520644885036_0.07399112910090011","host":"s3://npm-registry-packages"}},"1.0.0-beta.8":{"name":"@aofl/store","version":"1.0.0-beta.8","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/store@1.0.0-beta.8","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"d79ca8cce8af2f48a20a20855b74e65dcc8af3b0","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.8.tgz","fileCount":3,"integrity":"sha512-YIYI6jx3/euCJf27fu3PG9OSHLXANmNnloT1DkPfTnwQYPwvgjXFKX8HEafH2hzxciJyj8sGJFkL7cY3NpSfaw==","signatures":[{"sig":"MEQCIBcbXlAWV0ygcniMIGicEkECIcTurdCtV77I7QeBDxTeAiA6ujn1dYwsbee8TF7zEA2s8OchjW1zQRT5QwDH4WQIfw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5322,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbRO5CCRA9TVsSAnZWagAAx4QP/1xomyBnApgmt5AACvoh\nW6RHDr7CG1l0Prd67HzKBVxW9z4Ert8eL+/ib7JmHvfLYeuFv189wc9MCO72\nvX9jZ1N0qnX5H444WcJt2Kc3sIgjxJ4uS90TJVkKGZHdUm2BqKh73FScZLZf\nkfvrDDvBgOt2xXlNkewVetkM0Ih7cIq8An2Eu7xPi1n7i81AruZHrbatP2gE\nmCSeYlkeYBc8ZlnFZI8vihRLAn4lX7A1/kYTD7wnLInZTwXDibUDzKGulivV\njuhf4DAkW37maLcwBOIu3CQb5t4z1vc9hjsGn5mQRne8cFYpdLgT1aRMr+Zu\nfiSH3YTM5UVO1BEnl8s78IRtCT667frpgRW7i121UYj1BTpTVy97IR+yCd+N\n5GsYtMZkBaUAL9CF/Dv9V6jMJbkx9D2WkvEovC9Xl5hr6A7Vq2BC42HFKUWP\nHQPim2pqh5E5BSefxnSzrguzXO+snqnYp6mYBnytEMwfAUUFvB+fk+FAGZsM\nqb0p0GRyT7tR8j7YxK0v0bYJnTxqtz1aBZkZavuFoFd0gAcn10PDJh7Vf53x\n+Qlm1swxVfnwLsZsOd87fxm5Vh1qMWRUzDhsuyyyHZafP3P9Gg9efow5Cauf\nzKOb8t//VHcK9GBnn/nsDkQrhEY5azkHSNSjHyqz8aDBhUzB2CM3qKLEVFW0\nRPSD\r\n=74Fm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.1.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0-beta.2","@aofl/register-callback":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.8_1531244098639_0.8922285160977634","host":"s3://npm-registry-packages"}},"1.0.0-beta.20":{"name":"@aofl/store","version":"1.0.0-beta.20","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/store@1.0.0-beta.20","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"b5ef96041d4c7a9851914b054d2dfae2f482cc0b","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.20.tgz","fileCount":3,"integrity":"sha512-lH55/1vD4f0KbqWwrxxYu3R1jSqsVbBlMp9ysW86GGYJZ6mYQetzSsoUuSHx9lWVyODdOhxTAoUZ7VEBbd2T9A==","signatures":[{"sig":"MEQCICatTvZmhIGFB9soLb6L4hOt/9mXuNP8qPC9SkXUTlWxAiA9bcsHY5I6TMZ1yvoejtKfX3v9rAKgdjY0IiW7F4LQ1A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbV8I/CRA9TVsSAnZWagAAsBYQAJUoRWC/4V6SIeoTzk5P\nPueZWGt+mK0MN8PUUAFSsNnSp3+YsSIykGDZ7LwdlHdy2QCV6v1nw4DZmBuy\n58cLlVsWV4XcS0Sl02M/MGoiYyDzB0yQMXACBjf9aUYHnA416Lt8FByzIjeH\nQrWO3cPC4DFnuzzdbp/HeCKY5ucuFBA/qTDPVp7ZVQ7VwDNXeaESzIqMlqGJ\nC9x0XURoSbJIEB8P1DBgjaow2VAnKQdeLzKewS7jqnzb4YRiw8CqDpV7viBq\nYDWNluvks6xmz9QXpSrUHVP8pGKIH/kocwKe0bAN54WZ8hb0xJ/3DGnunZ6i\nh/3MZJ39YLLnJpLnTceLeY3+8hudbuHyfvfi4dqdXuNL+Jdnau6QFw3LU95v\nbFE/WkI6x6V0rJQE6KQyVM/Q4rZx0KP4M2jO+C0f275ebnBze90tLTkR2kE1\nAF9ijP7BrPi0usGkEtXCTxjg6ZEsEdYkqYk/qz/IFS5Ye2M9Z5lxo5MS7Km2\nRaIvFA97wzi0QEPxxhV10d8Cm/JdI6BRLpdIiH/c6eFHvEGSDzq1+whjEuX4\nbM3ItRqxdgxSmmpJ42rMv1sXJXj++FhER7lPkjzNKS8be3dVlrIMkAVXIFBz\nwnjrzzAB1XNUDdqtwMnrQHyVeMvdSvX2ScAFm4E+jq7Wz707n+U6OH6V0ZcN\n2oi4\r\n=KixO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.2.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/object-utils":"^1.0.0-beta.20","@aofl/register-callback":"^1.0.0-beta.20"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.20_1532478015437_0.7313255545924777","host":"s3://npm-registry-packages"}},"1.0.0-beta.21":{"name":"@aofl/store","version":"1.0.0-beta.21","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.0.0-beta.21","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"07e8ec732a4d7199700e5442c0cd112a4dce7543","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.21.tgz","fileCount":3,"integrity":"sha512-HqktCs43ZX19SlLVBNwOY9ZR/00F5lfeNpe8YJnggwTz4lZaGMBrUDUnzz6f0rfW+ASD5Rzr1CiLrV6UgkP5Fw==","signatures":[{"sig":"MEUCIB/ko1xQmp8XV66IM6qYqx771Mqj0j6LkEt4rkpsH3CxAiEAjrr7jP0vL1kGKn9Av8qe3mCeOfNWP+FdViDNTksqK2E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbZqsLCRA9TVsSAnZWagAAqEYQAIVLgsR947HeS27hCi/z\n0Gr4rijtbMUhCziPoqK4WiieXhNbl+BqyUOm4SSLDbmNZzQ7en0faEY4Nw+o\nzGe4LnA2JC3jEjyC4x9/ED3Gkf9/HOcWv3StBT+rG3TxxNGgQMY/F5RUgKT4\n0W1Rte5bfsHvE9MlPWoj/EoCuBKAoqTRRLjSUDUmazbUcop64bd9alJHb93V\nGNbEtaqO+OoeymicKIB9NZCbHLloob613+Fbi574ifz8MmAknbJuhhdcXMkx\n0s2MNnTPmQXGUhUfWVVFZi2pUcRBiv9hZtlAbrz8+0PYYDQDDY55ZIwOzfL5\n+wnCm3H41weyVXcqJrjJDUol43puXz0Zbw6K/pNXu1d6yrGT/jRU2W5XO+uL\ntj6c8ipkJu28EHpSt8lw7Sc2o7JL0xHVEB6IMzLFmksZWvAEF/A754fWdzkn\nmmYPI3OgWarGq7VmXXL9WjilP068w39ZviHzGv8DjtFWDILkhomTOYGLG9pk\nNmHCyQ1XG4Nwv1xsm+oytMdqme77XMNpl7jGxHACXsaQbJGY4Il8WVn2bZIU\neTHCJLsziMdrWheKZGI5BDOw85vFMjFp2Cp0HisXLiIwSWygAih8KU2thVtM\nqapEKtq5vVTOvBpfaRvceKIfnrX39TIV3aO7nTANU8uzrgBG5CwUdUabXV7N\nShPc\r\n=IUxL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.2.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0-beta.21","@aofl/register-callback":"^1.0.0-beta.20"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.21_1533455115210_0.7939443298919462","host":"s3://npm-registry-packages"}},"1.0.0-beta.22":{"name":"@aofl/store","version":"1.0.0-beta.22","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.0.0-beta.22","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"303aff9645c4e70586ee4a51fe30898bbfb83d92","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.22.tgz","fileCount":3,"integrity":"sha512-9LSQqD60as2jyFHYQr1AqazgfDDzc1s05ueiSeeyICt5lVe4xf71VM/0b8fzQSdI72rBB8g28EdRWlMSZCF7Pw==","signatures":[{"sig":"MEQCIE3pKi9tT0D7j/On1lVxTC9n7be12nTbf8LtiQXCCV44AiA8XbxE08QsDPybuHGc31q8RxXHXoykG61cz57M94fKIw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbegBCRA9TVsSAnZWagAArM8P/2P++R+Jt6jRZg3gB4UN\ntgsmOaJxRyd6Q2RUDrwe5udnvKXfITCTJLnBhbwTAEzHw5a88bnlfolEWbZh\nwMLft66udk6FxD/0oxUg+ibaDqX5CX0VqmAQrRoCMluqCQppUXg7SJUDhCPT\ngBmtCTyjBDAC66NW+OGlBX6wHf76JxTRnD7SmFLab6tUxEplySBDD7/bC3u+\n9cg2+1HISqCTI6aBmJHC84tmYs8dcAFkDQYshaoROPCzbP4u+nYTCC3xqpBq\nTtsh5nVlXZS4aSiHdel5kuZ38NNc7C1iwx0OMAn99XjY2BtoCrCJcikBB/+E\n4T0aeRxfJEB4FQ2ctOV9Z+YoIjKEWlBRC5Snd/xYrruRzu1kIsA1dqEtBxQO\nbqeusvEGnJJPX4ls2jh327zuFDmkc4SlZox3RqAS0FMd2NhQPDJtdnWrxW4/\ny1FuqfPwhM/0hFM7UaPrSl9ZTJI5Dp+ED393OvuZNgqmX119DADAJ/e/ibhj\nv+VZ/lrlIl1pJrxLRwFkv1y43UuYeI3DPZdjC/MjeqedT2n3JJy5uwWO4Uzl\nVR+3H8zdLqbhOcrpP8nP+T6QjZ8BP0ASEotd8qeqephsKW4AxYCoufWhx/pr\nJn18dg4CkkZbGma2jOWgOW8M8Psjhwqisqq8Rixe5VIM3qgT9te3rpM+xZDu\now1Q\r\n=hI/A\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.2.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/object-utils":"^1.0.0-beta.22","@aofl/register-callback":"^1.0.0-beta.22"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.22_1533929473444_0.3994849697656311","host":"s3://npm-registry-packages"}},"1.0.0-beta.23":{"name":"@aofl/store","version":"1.0.0-beta.23","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.0.0-beta.23","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"cd9fe5348f8161b68ad0ec8bf609c0422b0db1bb","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.23.tgz","fileCount":3,"integrity":"sha512-zaoIKFuxns3aNgXiEUrMf1406ZNMJg6BDaP4oB+BoO+2Nn84dYsDJD2mxP4pS8WSt9Ye/nFoUcSx030LgecjPQ==","signatures":[{"sig":"MEYCIQDeJ1QyF6wq9951MztFr9BcR64tTchDNG5X9AQMiPse4wIhAJaXyR3NiGwFX2wq2fkNh5NVE1OnQoZsPvhb7JOLdvtI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdfBbCRA9TVsSAnZWagAAzW4P/2CTppLx0/rhDfI/SL0e\ntgkf7A7R7zqbOx6GmV6Eofb5s02yfCVWeHe1I74FnQ2bncW/AgBGHFPv13Qt\niR/ymqciS0narJlRlbxFqSNhZKveRt/10F95V2MeBw4fhwTJcgWLrg0Y4kHB\nrmWqoXg/fxUDiqKZLxMuxFGO2Jpw6yVhy5NirVPlcVEyuZLzoV8ohG4xiiIG\nD3N2qn7am0YRDnNxolW3voE4j2M0IMeDAQmdqk/XpLvqs1JtjbL2Ev0lETqO\nmdtISU/3nZl7BgQQpx9a6uWp/gdIIoao+2TrbqME89CIjLmAfMOUcbvL929o\nJzc6kHbhh13Nb9yYY/ZTaCa+0FSYV/NyB0f7gpapT2BQnZg1niZ5EghY4iLn\nFFD8PzggNRgKqfeClNMI9xNurHzpNNiMvxUMnamNbp+3rMozTxWb+47vdH6/\nK6qQfS/Bx3VonkSfkWxUM48ij3R8ZeTBsX8w1Z1Q6wYb8cPsfn7CLO6wCwQG\nWwMSX0k81f4dxDXQBQpNTNpIpFAm/GYuiJwBXUk/k/DXeHZ/5FzQt1P5SfT7\nFIV01vSg+CYgeUnEp21TnlJ8ccDVf5pMUmrQcnnWyv6wnyZMe1cH1aL3Z/Mw\n5o3qyJFVYsCrJ0/H02ct4VkIy+3q2dK+6jU3x1fxO8E8PBRxSNpWMHTJTLER\nzGax\r\n=i7+r\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.2.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/object-utils":"^1.0.0-beta.23","@aofl/register-callback":"^1.0.0-beta.23"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.23_1534455898610_0.029291496229162606","host":"s3://npm-registry-packages"}},"1.0.0-beta.24":{"name":"@aofl/store","version":"1.0.0-beta.24","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.0.0-beta.24","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"61aebc49718bf1884c9678b8f567308d3e833221","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.24.tgz","fileCount":3,"integrity":"sha512-7r3lq8YdvMTHjON6JA0AiZDTPFHzn8Xxjtif+jrXlAk2hc0R9SY6BF0bGB8zt2MKTERs99NXtIzmdIMB6IHwaQ==","signatures":[{"sig":"MEYCIQDNX0mid52mIMRIy56WgWDmZ/ZnSmmbJlLLDKMGH6QDQAIhAPGMyJIGlSLjLLeZKzdI2uSXFHYL2R2bBdBXQbJgeUVL","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbfeVfCRA9TVsSAnZWagAAhoMP/0B3smu32NB7ST56NdJ9\nAVnoIidSn8Zm0fml/2UBD9MFNiyeLVV1nEr/HUGWppg9QM6dOj2o+EHIgMWY\n8v2veX61g7a9w2fbLfR+Tbt9uMgTvYzM9f/2gFIeOnlC/wcmjWos5wS3fRYx\nb3QLmNEB8ScEj6UAJR6j9VCQpkG7EnGosVt557XOQgODHkBnaYRGcyhsNqhj\nBf90uEtndAgYcpcwFuhwHkzhWIp+zJ1d93zZhiCKkBYlQ0tERg8XNo1Zgm2t\n/qLY4SVhSs6Bjr3p3ZuLlhiRS7n8v7VLGTpuxASVrTrRm4MIcQFTc33PmRQw\nRX9g8RD/ApFnCF//oGcHdHhdqliP0oW+ASQgb2J62FJdBn7DDtmMedAVXYrd\nhx+DwYMvpgcxbuMm4Y6AypaU8cdtuk3WMU27HZyGVXzMhvTdL3MfYC8fDYKU\nZCN0hp02b30Js5qV7KKBV4IIoXj7gsqgVfgSzMMcOqcAZ+9sMNnVLwRStgq6\nRJQDIbtuTS4EctbCZas7PUOsuQmWU70hcspkfNbJKUuEKJIPw+DBBhXW+2B3\nWhkDyXW/CwogbOU6Ly2d7C8lpWsqQ5Y8dL+RID81outJDVzVVZeuZUOktWvK\nUAP+uG/LQArpkGByQAS2Br3X2HNBnEMbR6qZ8esBg/hNqYpr/qa3vML0XRO1\n7hhe\r\n=JdLW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.4.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/object-utils":"^1.0.0-beta.24","@aofl/register-callback":"^1.0.0-beta.24"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.24_1534977375237_0.5883471849829642","host":"s3://npm-registry-packages"}},"1.0.0-beta.25":{"name":"@aofl/store","version":"1.0.0-beta.25","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.0.0-beta.25","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"34f1babad65903e242512bad2e2b1c62bdce57eb","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.25.tgz","fileCount":3,"integrity":"sha512-rS4gBjbn9Sg7BSzgDk91ZlnH34FbVQFwS5nb7GXDNgKGWAbZhHoNJ73FG52wCM9K3Mwqmac/jP+l+6kOPTQGjQ==","signatures":[{"sig":"MEUCICJQsv9OCNkivM8m4/HGclNL/n1FdFffO1zWCLgP1dGGAiEAlJw/9BK161CREHopWnRxERBrmGbUVFgyQe8SYaRWtGQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbfwt8CRA9TVsSAnZWagAADpEQAIDDs+5eCdy3sBif7PoQ\nxzjok2znJoWVuNhk2R+tkrUKsuv5ZLJGOU6Q+5FXVYmMzt5gqVXsRK/xo0o0\nQuGhx5N89Vqypo1D5ZFt+Diz6dVdWP0zxYE7cLCl3Dkrt5v/ePmX9TO3WTPh\nLS0kzev3bzKLxrWsRIhpBpZWYtkGfbJ7AvV5xCCIDWUygKq4vM213Z5xlOF8\nwXu0N9kQtqvvKBMK3pfq00QTNWie8lyfUvrjXWTY45MO5O2OR7Q3fUkgFxdx\nc5qYuY4tORkdV15/Duz8usWu0CtI7Znjv8f8nywu0ItWe4FIx9w/GcwWMf0P\nifpZ/3e/Fj5UgvjfpKLDjbvCA99cTSZbjDB5hv7zx+xPFCoq0lxf9YNXhdbl\nvGGjfdeEVCji/9VC/eKLoWPxe+ylVgaCOlxjT2ERY3kTHcEMsSqleQQZ8P7I\nGM4KaAQ48ZuTQoM05X5TWjug1lfIoZ7F2A2RotFMIAujJt6xfVkGec6RRl2G\nsjE6+pbNvYo5UEgSlXckk+rByh679vyZcc/y+yLDLj40Wo6O/Dr/uc323Pp+\nRYzqT9xQxSbNozziBEVr7cQ9tqJtJC6igq0FSJfO3UXuL0yeD1Hxd7RXtqdA\nAhxraoDgYZ4zyMnL1vsdmGZxTBMI1EbZZG3PHANh7Qod8acslUCWs/pzyD0B\nnPRj\r\n=+5l1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.4.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/object-utils":"^1.0.0-beta.25","@aofl/register-callback":"^1.0.0-beta.25"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.25_1535052667618_0.38585847292810516","host":"s3://npm-registry-packages"}},"1.0.0-beta.26":{"name":"@aofl/store","version":"1.0.0-beta.26","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.0.0-beta.26","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"6dc8ad760a466bcf4f3b3fe9338d6a54fbc6d15a","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.26.tgz","fileCount":4,"integrity":"sha512-9Jya7qTrR0IClceMVsDrrpQ0UUaUDCFv0LG/Id7jW0ZgHoYrjHBZXPpnU2PPW9RSeGlURvP7o8n9f7eF9f5aqg==","signatures":[{"sig":"MEQCIDx+BgZ+93aRmkKiW1VT5c1SZgEjIqVD1Q8XHEba2FYkAiAiDC2ao06fBeWoBf43LiB1wzUwQiC+3pHrU43Fuwdluw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4788,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbhEJVCRA9TVsSAnZWagAAZDQP/0sYfmoRiAGsaLVZf3I+\nf5msSV/ret0DllUpYNvu98MpPs98QeEBFsITHoQMJGfXStza5RYW8RiZHex7\nwTtPUwTH+kv+WyaPu9HGCLBEb3NjekGUA66DOlbqtcwlWMydt3MH+Tn5K6XS\nO5bKaUYwfrjEpbSWvWzdSYwtqmb1t3qdWzxyVuekf9UaBWR32K9ONR1CJEJn\n0ZdvUfzakcEEFKitKtKwb5JK8Ls4zeHM45njuYyne4HTD1xO2ePqMh+zq3NK\ngF9M6qbieChO8O4xQCEN4340kggGY52x67dVb/P9sEJJfzujtveux96HtZM5\nyTz+zer2iwrEZhol53FgQak13DLlS8on4ceSxh25P91PIoGn3Ml2N3VGAQbU\n1DyeQ84X4CDAhfP8wcnDRKFMZRpkuAEbaKWX0z9JvxirjmUcaduJ30T0sbmp\nJtppNet6fiFwS4LD1Hkq3NvUTAn12E/+0egkbi72Ov5Rhz1CGcm3VmEV2fy4\nahGet7EzC+jlVq/5Bgf+D5cvVdkoHEBR/zGX2jUPHYJlOJG4c33D8SRbp6nP\nYYaraVHR1FHmw/mw9hq39+YniaZa6ZG5iW1TTL9U21/MDK9hSpXGCnyd/fmi\n6+8W3nahEKmWEF9x3DVEwOeVIqiLqfG93pJWgXooFw5QeueNkhMLm167GoT0\nOsBv\r\n=RKx5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/object-utils":"^1.0.0-beta.26","@aofl/register-callback":"^1.0.0-beta.26"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.26_1535394388560_0.7063033844263071","host":"s3://npm-registry-packages"}},"1.0.0-beta.27":{"name":"@aofl/store","version":"1.0.0-beta.27","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.0.0-beta.27","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c88db83b491960cd667dde814072f1f83479fe3b","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.27.tgz","fileCount":96,"integrity":"sha512-RmVv7T4AlL72PdPfPdZVLKBZmn/ZcdlngFVPn5+X4kQ3XM3mBy8wtQ+P1WQkXTE/vPH8Nn14MuEt3AgTDisGPg==","signatures":[{"sig":"MEUCIQDCLGisIIOeyF2ZSNej4+UnltRnYWD/4+vcZbiwiAjZJAIgb/2kPAj8vbE10Ooc0FTqoz/W31LOeAMOB2q6aBDGoso=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2663365,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbl/ntCRA9TVsSAnZWagAAg4cQAIrtzSM1+ln+gGWa014f\nrE0fYMode4aXRYjY9nAdW2KGSKEdOjThHrJWPfb42zWHPh38jYEV/ZOlmWYp\neFyYhCcM6vBniKnDCW1ifJk4M1XYh87lofK5TBOtRJGVUF08saEM9l/CQx5L\ndveMHw4/0y+3/z28uo5ilzolLAL8AXZLZtWJQz6KAGYreOS7HcncbJkp7Uyf\nDTE2F5YXZsjLlSZ5LzES7Dv46TePDf7/aKh7a5HXzmPpBi9SBl46P6WH30iK\n/ythS94ITmf0F20IhARp9CiPHZBXgOf6NeQwfFbiWG2HA1q2+NbyavvTfKms\n9yW8xkBiSCHJgGQ/2C4ErtPRPbpLOQJ4JaX+s5DlabpNt38wLZPAYpnKQIQe\n5k08zGZU24si9W29YozvLcEOzru9+lx0GRhNE6+QmsQzBWAqB1MVHxiSNd5V\nQBMvThT9ELx/d6s/PVGtQxpsaxtxfKFA8kKHH5TC/AaKOGZMQpM6Cc+nIJvL\nDTwJpZqJbmwpcG5qAeB8xeJxJJZ6Vl1SeG7pjUZx0YvhooAVahvOw0SnStI6\niRLgksWTJQs3u7+52QpizkhyyEkJkozSsWhXX0xOtpb1tlEvClev5CBvWeTC\nQGMyFVJkzBV3hZsE5inZEcx1ElrVd8WTAzpbInERHz6PbB9Gy1MMN/BPXdiG\nhOys\r\n=5Hkf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  setActiveAccount(subState, {selectedAccountId}) {\n    return Object.assign({}, subState, {\n      selectedAccountId\n    });\n  }\n};\n```\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.0","description":"@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/object-utils":"^1.0.0-beta.27","@aofl/register-callback":"^1.0.0-beta.27"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.27_1536686572730_0.13549538784863846","host":"s3://npm-registry-packages"}},"1.0.0-beta.28":{"name":"@aofl/store","version":"1.0.0-beta.28","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.0.0-beta.28","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"aec15c86fb02e277126ca124ca761377082efa61","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.0-beta.28.tgz","fileCount":91,"integrity":"sha512-GVrZLRcT5WqEoQViOB1GF5wJfj+7nKkdS+P4hS6iyolZpHOKdlBpTq9PK2zz0bj0hax8vH926Mi5WVpf+dG4RA==","signatures":[{"sig":"MEYCIQCYgim/olvqgHVgCOFIpBceqm+t92/sUPzHl81q2JrRPgIhAL1RXSGrQ4W3nOevRiS55q9pGAiennlLRO1Bep4ftP//","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":427032,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbrXcwCRA9TVsSAnZWagAAqJMP/2g2tyuuCDKxfElTdy75\n5qQdcg4hT8x+mvzoWIE/f1b78UTWtxrC8Te4hWxvCLofBnG9ds03JkrNRpTa\nA2Es1XghAOxMfs84FPXHDgmiI+gGypCQiEQw3rtNuoBO2ZdNHuq+5D1Uapqh\nv3LOPqdSYE1bxmzT0vwnqMC38y6atIe/r8fai48kh0+JT6FVdcFDi/vtVIMO\np+bv+6MOXcru/f8lClzO7NsNK1AP0/CO/7+cC/7kgbOzUBy5CvOx6NadCbNI\nUrd8R92SEuZGqkH0K5qK7HoDglrDE8prENDulO/sOlkyvOzoPl2ka/EbcO0x\n7Oa91QF/ML0v4nfziJHIaKO2QwV4/3whDWz8s3VvQvdUskufyXpO7XZwxAG3\ng0CC8brnC8o/GlMrqLXgnPtDSOdBMO7Za5Xr6THlitpBi+rQGycRMuIqiqpi\n5aILSwDDkwzucOEwxewnyAYoyUXpdk5QjVuyHjLo69RKVxlM9oYeOQYYDoek\n1NduSuhs0aGWuZgDoTzCoVALGkbLSyqWy2AlNpy8/TfgDl2pXtaJmDbjPp91\nmEdwk+k3QIGZgko8ySLs2Q3hzTe+sKK87NtaIVE+mPcxxjq9JyxOeuVIcF+J\n8IjTZZ37KFcokej3M8QJUkRO7dheeVSIoYQ2Nvi3Z+U/fWULymuiXRXjX0pr\nXzMh\r\n=Fj3W\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  setActiveAccount(subState, {selectedAccountId}) {\n    return Object.assign({}, subState, {\n      selectedAccountId\n    });\n  }\n};\n```\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/object-utils":"^1.0.0-beta.28","@aofl/register-callback":"^1.0.0-beta.28"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.0-beta.28_1538094895584_0.7408760234661407","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@aofl/store","version":"1.0.1","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.0.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"835404bf398a64de1a11e936ec2f9a3582757a5f","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.0.1.tgz","fileCount":91,"integrity":"sha512-BEdPA4PueWEgCndelyVndKyXdCirU+sqoL0rjw5iBx+My88JIYwDTMz4qQRYbuEAQsJeXGRwiHAwRcBph3Smyw==","signatures":[{"sig":"MEYCIQD94PsWVVeWlBVEwwyWDSJ373c+YqESP1Owg7Dy5KPLPwIhAL0ITjb9Qs2cv9yFH/j1f8s2a5M5odwtTheTBn6rq881","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":427005,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbsAVcCRA9TVsSAnZWagAA5AIP/jW0QsO3JYFKp2qhigb8\nDHI1U7DaVup2e4++xxdfmDoQe0Lx/9nyVBNqM4NLdc8PVAhy0madhyjqcqoc\n4k6mUxa4PfvKz8LE0RuVNH5XAO+UfYY3l8aXabyLr5b+cCEx43x2R98bZmsj\npU2AHQGeQr8gwjg5kw7DbQLifAqfvwL7fbkTab7Nd8ZbAyO0bWa3tLlOf5kT\nKmtTEWx3QUrLp2fXh1Ez7jV6bS/pm+RfAI0ltd3GMaNIGCtjm6x7gO5Lw0qf\ngt47S3RhmLK4iEkRy3fgnz3ylAgzf40xRjWCCa0F8xL52uCD/43Uh5h5ZT4T\naZwWf8ruYuE4KYKkr/+0nSB+Njc+95pCYKXQdg8vDHppcsGQkYH59ko/IaHk\nWUtdIPOH/1XxYYvENcP7UPtSF5XN/krf7Cl7kOeVp9gjQQHj9cL8+CVlbzQ/\nvM89KvtA7AWwsVsHSUBMRMLqOowuJhT6NObfo0bgMhkVTUAr+IqtNKq/goTF\nt27Taix6bXgr9k1P/PTZT1ldtlpWYUKkla3aVAbAgFl2ohLz9hgvP8n/e09f\nCtquVDazRP4DRLuI15nBDk8g1RjLH+KWVPEp1GVOaY4KGval9hLzc55tK2uR\nZBJRSiXw9UAldzDZWU5/RojVtOG1QvjKwLvSQr2b6ZwMuvAA5yvPwwmI7bDU\nyP48\r\n=ND3/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/object-utils":"^1.0.1","@aofl/register-callback":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.0.1_1538262363248_0.6692046218253873","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@aofl/store","version":"1.1.0","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.1.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"17de0fdef26c2d3aac9675e96ad517a6f24f9d97","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.1.0.tgz","fileCount":6,"integrity":"sha512-zfIdvZoiHcFXPj13CppXblW5wocuOgl4wjyb1gicdfBLGNTLXNhQffKrswlbaT80o0++m5AW+ADkyVLM9Tea/Q==","signatures":[{"sig":"MEUCICQVWrwP+HgYOFN1cb3ooaNNyNynhmcuJ+Q9XYi+o6tzAiEA1wTyTwoPjaXhR/d/x0/AICln/3U1TnMr4tvSfnx6pgc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20843,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbx7hPCRA9TVsSAnZWagAAfSQP/2P2J52/SyEAzU6T9z8S\n9Vo8fhQZFhLiR7Pl2hsbmCC1axQR4EugWb9gwAqd+7QFzE9MlF10GXijaYxl\nsUqBuZPHHeL8j5lbUP1LUSjapMYj9wOEwh81nwNOdoyAUJPol+N8rgXO5v7K\n4ZwMTVuZcwqf88uwVZH5+Fmmi6i1DakDhKn/HbQPZDgV4+ynlGP3R1u2lGob\nHAl6AgMFJklDS2xCY82QSJOmRCFPCBEUMOWKTh0KyIX7Yctn4FfrV/7Sz0n2\ndWGoD56F07Aw3gROvjR7PPfbmB5tm0bY/RjtP0pp9CeBtByW1XUsz0n3nPQD\n5Iy1W8ecKVaFfJZrvTJQRuv5IXUaQN+nRaQFZXC9uDIz6JG0QzZ8R7oRO4gF\n9FiHAqFo94ugvxKs/UN00W4XU50zXWQo2ROtVrldyGApqzPfahmVvrCtUdRT\nnUh1HTR8OXc7WVJENFumguc0608EQgue5kV8tPsjz+Eltk2SaCNOfGjYW8No\nTlPav14/HifeGiRhF38/aCunMNvWE7EFNDHg46lPTqsBmZaNBs0ANbjGk8VI\nMx0BB/L4pF5Z80sygvipH9YCgatdlwSaWhG5UR3xKjJhzFqCqdhwYN8urRll\nCeDOveqFmgCjka0RE2s/ohjEY2n6GPfdJBQEakZUBvcFPC7dnrAk0Y6Kfyg9\nAdKM\r\n=GQWu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/object-utils":"^1.1.0","@aofl/register-callback":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.1.0_1539815501673_0.9928110582022895","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@aofl/store","version":"1.1.1","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.1.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5090353c6894ec5d6618325f6c3ab64c4d74e1ed","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.1.1.tgz","fileCount":6,"integrity":"sha512-VLViNGoO21EIZbWBI6HnQpnf1Lzo3YIeR/aFRjULbowlq39tOgmPrMgMqFgtDNcoSUE2B5GpyVpwrYvTEHTdZA==","signatures":[{"sig":"MEUCIQCjiIOIAdGCxDMftm63DbrgKX2L+H/8nZmEHn407NUE0QIgGyS6aO8tJ01qoI/DDAY/HsEiTdsLCR8E+GImQxr6mjg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20857,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb12MICRA9TVsSAnZWagAALw8P/1IgfhUfvNicdrOLlROJ\nLX3yfPScpewNfuRsAeBs6uR6wtJm0EEHfjrwQv3UQr6SUd24j52dzh17Du/d\nW+OLTA2jOPkvSs7oZ1BlG4ZUBYx2GiG7fI7maoF6KOjB0ga4Y9FuX4+zP5b/\n7YEMHCh03GruOiWQw5VbzKEKy1cH8OQZulg9eZIJ0AK3J/E3oIZQ1mDh2pDf\nKdX0iS47Rw4ssTzcSBc9fa0Xc8V5wA1JdXWVh6rhPoaNB6ilVOnL/Z20EnAn\nFVKU+iyEN43DrDC3rfSMMJAZc6iYWB1zOJ1ICIkIl4Sa2O1Zxbyscj+suxoG\n/Wny5NC7Maqlvbv1sRteKEjWrZ1j0IwFfvROkRR2dgNR0aQfl2xPmsz7JPwr\nTzlNNVBB0Y6DSWAZEj7UQPmpBu+H3VDfzeU1FqVUBXasYjRXVHaoMWKyucUR\nk/IZ+N7vEDoC9SZH13ktOIBVYPjqZ6JV65r1JJ+OLvg67L6j6DebV1/ua+/6\n2qoZ/G5l1+AxQnwZ4fOmyqfDXzfT0vxC6sQG0i1KVzftIO3FM2gYYF/C9Kax\n8aFvLYR9DByQ9xzw+KGeEoEEnOVlYvn0I+9ZLN/sTE09S0MvQCPbKXAjNAfQ\nK+jd3m4bKFEiP423or/MbVDV6dHTXf4Nq/tBvdVzSP9E8xMhUROjrn6izyrw\nifBG\r\n=FiWu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/object-utils":"^1.1.1","@aofl/register-callback":"^1.1.1"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.1.1_1540842247625_0.9480121287670475","host":"s3://npm-registry-packages"}},"1.1.2":{"name":"@aofl/store","version":"1.1.2","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.1.2","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ee159253dc017b360264787e55fcd8540d975788","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.1.2.tgz","fileCount":6,"integrity":"sha512-M6j68AWFhAPDCF3a6nRhjuW/iHb5NwtgKFr2qs7y3YVyRqSuYEMz3+xLKpaqSx7EjJMgza9iK7UbcLhKQ+xK8g==","signatures":[{"sig":"MEUCIQDA+amiYImFO3tSiRLswXFr4/x7g3myHiz7U7fYOpgViAIgH1JnnaHQbOXuG1/hQfhJD2hBKdfzJl9ShcXqOE3uRV0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20857,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb12McCRA9TVsSAnZWagAAktkP/2eAPzTKAMFlgxNwA//U\nJo0RbRrYAcIx3TQZWY4/rG7wPAaCpfiRHz3kznYnnTEgXBVUAlebexbJBRyu\nfGHJUvIyWqKVtMfW7Ohuy9C9b949PQxHjOf92U/qv76k/+U1dvp+JAJ6OY2b\nLze+T5EsK66gX6rCVju+0wyFvC0pNQuZh3n36sjSwflR1Tp3DLB2Vcfzmg5G\n10kxJyjBXWLxqn9EIk9djDK7iwjS5fwB1FdTlXulq8TbmFWmb3QULkcwzx9I\n4NK6ehMvZ3mH5P6AWtSaaRp9DIRPQGIdtCGoHB1RfTwkdqrFp2+uuEsazf0X\nWMNgPK7Fi83IdX5/2hSiUGCSgbwv7LV8qJvECIyEFP7qseZo65gVnGOKL1Jb\nsPOi8NjO76o+Yw7he4ykj2GJRKzLkRV/LLNEzwAj7edw2UljRXyZZ0+j/hiA\ncR8V+ba8jfKzJF1UCn6aXj7DA1w+5X8yz2PAmtteRRQgKN/oQvqVM5a/1Wc9\nYA0jTULbzJBsrYcRKs4c04uXph0kjbE1mIZ847Bmh7URfidv4GezEKq2/ExQ\nG66Y+tlvhHhQtVu8CmyoqPgOLSD2svZ8a8rn8h9jHgsF8i7afMafnFEaL0ZY\nBPFjUX97I+omT2wkos+6n/GcGIbX5QFnOYVOybCzuPDyFnfNWTJHc1kgRZ6P\nhkU6\r\n=tRY7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/object-utils":"^1.1.2","@aofl/register-callback":"^1.1.2"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.1.2_1540842267417_0.529825455210748","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@aofl/store","version":"1.2.0","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.2.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"a59fe8812b3a4f739f573b937b45c35dbed15176","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.2.0.tgz","fileCount":6,"integrity":"sha512-vwjYuT03TUqEgN++MqjU/azV2CrLIB/w6hQGclXALehdK8KmZkOl0P/VEwl4X9YwgO51vn/sw4FWj3/QU9Rpng==","signatures":[{"sig":"MEUCIFCJqUZX6uOeyVp0NkEpPwIYmCFAxS12o5qM+zDiM7XsAiEA/cjfiXlikMWBS+PBCKeyLHBkDZckNM8agahfWcFalaY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22365,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4f73CRA9TVsSAnZWagAABgIP/RvTky88N7fcE6jby24q\nKl5OsU4HtRIhXMl+8uxYPEF9s3/0nH2g2kY9i7UPv5Wa2JMSO7X5lOiiNdMo\nnWTkFCUJZZKhHIrf/qS+uOIVH38enmcLDPdNFM7c1BGD7bCdCFnGeqs3Viqz\njhX1zZEFJwTPXQbmSkMO0l7pcLMiSOYeBN5lTypHDOKm33wv2KLMvlxWSfNM\nI+f4m/NDoO0F+Z2A9tSoI7XJQUxkioVnf4blv3C4UgALFXCfeofDYKi1zci0\noV7K34AIGnKrbGMz0pmFr/DDGp1UxSlTX9OD/Ac8fgsl+OSjESvU4jZ3Lulz\nFe+wOA+0nkuAQrEOBuWifwy577Ja0qNDiWaUcgYbp3ASgJUaDQjeZRY3XdUf\nkDLjMXukhPbq9v4Kiwt29jHisJa3l+MYK02lOl4cAgwMABfuKVlZ/jCcX/kK\n3QD5rYQ+j7uZuVmUP0o1FbAGmKpCS+Ssbzknew9hgv7Rntuy/vqt6e008Myx\nDuiS/WKabTY35GgI1AjrFZExbYBwRO8/0KDRBn9xa7AMows5r26B9YzUDFDG\nFlEFxkDZqSU8S7zxK94LuYcQQmTooxGaOOjac+zlx4uW6zhrNsTZHL6zXKQU\n05jEAfVL/ziAdpC76eswt1IkXOMesX9/j4F50O5xR8HKEgKJIvrrkxCJyKwZ\nZL/7\r\n=sT0A\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/object-utils":"^1.2.0","@aofl/register-callback":"^1.2.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.2.0_1541537526969_0.5113844532001814","host":"s3://npm-registry-packages"}},"1.2.1":{"name":"@aofl/store","version":"1.2.1","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.2.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ca6ff6f55bbaa142697038e9aee5859846522f7e","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.2.1.tgz","fileCount":6,"integrity":"sha512-iQE+JJkkqBjFTBlsWt8Iu2Aa1UsRu9cPmNA8JQVoABRDK4lJ/i+tTSe8mKLQDUeymWyU4QRR1yU4o8FwkhH1/Q==","signatures":[{"sig":"MEUCIGlfD8qDD++2XD8348GcASPJL46kgvC8+MS7aHc7y9+ZAiEA3B5eAE2alCvRJYwP2qruIm2OM5s9v0JRv2uCJ+BxMjc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22726,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb8dXTCRA9TVsSAnZWagAAGmkP/iIIZfisNblyq9jocGFl\nIlVlKeifik0KcU8dPedBxE4MNayUXU1fTu4AAzdKduZvimHISi/Cykwp3RUy\nBDL7XoPKZQ6O745V9jlUKjv+HmROpRocro/uvkh39HeEtv3to10N5Y2Zq9kp\nVY/wWWWhKDJHdIMQRWyX1+ZuUD/PyjWKK19UdMW8UIXneNyCokHFGvK3WCqq\nNwklPRJ8c2xXEYmqFiuIhAY8lF8wl1J8vzRPQfM0ARDq3oBFNAk04/H2UZMP\n0UiBfYY8txbUe6i1qu6skk/1j8UU4kLrNLWEvuptyx7zB+sKNDXCts/921pn\niSxeuY0UWwGJyvM4ModnOIWLT5O+dd44XVhBQ8xlZqWdbTY9ueLnPFs9hOxp\nGTNNFytnxIGQxnCeB2TUSaUJ8ioxVu/rMNOHrGkA0PHnmrZLcm4WZlVI52R7\n781Q929LRj9X6TBQjXQ9A71U77KQUBJnkHPDtQf7i5SV6kTIN9JSmDZszJFP\n8UG6AT543vrHa3qZzgiFRUk1tjIh2JD/ltY67dtJB7dBGNOJWhq2YPgmn9oR\nvMyttBjQ4WVQftgV3GSkQ9stc8gPC5lgMshiZUiiP/z2LpiEGx4K+PackQRb\n32fb0MhFKatuXi3Heze8sbAA564EhrAFmSpA/Rjmk2YsaCXnHNtYjkRxw50e\nsM/d\r\n=2Oos\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/object-utils":"^1.2.1","@aofl/register-callback":"^1.2.1"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.2.1_1542575571295_0.4729682944646141","host":"s3://npm-registry-packages"}},"1.2.3":{"name":"@aofl/store","version":"1.2.3","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.2.3","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"4bb4cb6a6f4fe61db552f68cda25b38950ad2dec","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.2.3.tgz","fileCount":6,"integrity":"sha512-9OmG+ARSKt+vucuI5e36OZ62c7WF7UVjXyML4PIgarFdrjNttnuQw1nW6x2GWw1FL4RApNkMm7FcAsVXi94CPQ==","signatures":[{"sig":"MEUCIHLa258mwYFbGt+Zl0cEbi1p43efXgzwMNCvJJyCH59IAiEA4LKef9SxCDsVA9hw8S+llOFK6T61KHDYVgBFb4qY+pw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22726,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9KOwCRA9TVsSAnZWagAAfO8P/3Af8qlCqXgOUBvexTUm\ndZawNK7iDIzQAzHbDFTHnJsZKQKEy/HUEuZ0Q+lWW1hWlN6eWQaUq1JQnKmX\no1Eg9L/6rl+tBOIe0nvZYP+yFfcitNJnJSRqw+XXckyJ7W4CxNPRELA9Zotp\nDBcK29m7PNggzgp+GUvPyOoAbBWni9OgT/tULMVtVXWWczU/Ghpcohp+38WP\nFJ+3VtVm8dX6sopyXd3dsAWNORrr8tTk4WoNZ/B+n5+UrEr/4qWPILp30zyx\no1U9LsA17FrbHmrvx8QCPg9fcJS5kp9BNgXeOtNJtkXVaYmnisBMjiujthrR\nwQ+Bak9ZyZd3vvzgxRe5ZB3Fi/koPMiyatRQY4P8viknzFBvgXmML317VYQW\nOvASBEGayhbuHEbicd0AtFyR4U6i4BFbD7kGhlp3zYL4lFW0WwfXSHsykXKr\nUXH1KH/aUps+E/UUZiSV5Po1O9XfljWH/Fe9gKyT8viIwd3c1eg1I6zw+Fdq\nCoZOJyhLSEny0NdbuAvIoKWQ3ykpieHHbsZpETBmemfNSHujjIoaxriFIZDH\na1xKEJJVef+lpepYka2UFpVbDEwkyVIm2RhIWHw0OO9rzQ7BrSjWt5orhVSE\n78edXY8GcSCU6sFWf5Lv4/3jWBXPsYEaQtexrMFenQod/qnalf1H4LVxZd7O\nrwUF\r\n=mh+v\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/object-utils":"^1.2.3","@aofl/register-callback":"^1.2.3"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.2.3_1542759344095_0.1640143356919368","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"@aofl/store","version":"1.3.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.3.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"af69522bf085c1b8f996b354427bdd94abeca5e3","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.3.0.tgz","fileCount":6,"integrity":"sha512-NXQ8RJMz3emeD1YTiUY3p3HZm/5soQ57YzEVxWNCcnpaeS5xoEwImW9kRjIuyig/2OW2wBSpE3XqDOunxjYyyg==","signatures":[{"sig":"MEUCIBglz0gCURuT3oypmg2UE2NNTQksCBqCqKmyXkrWdDb0AiEAy8yWSyNIGQFZKnt4IQU4EPKE5DLa4v8l8FNRvI00GjM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22726,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCY6UCRA9TVsSAnZWagAAK1oQAKBekHssmoKDBR0xXyp2\nJQtNMH8W5puWY2Xhj7kyJ60SYYpE2ZvSZRj7eW0jgi4bs/8N8GGQZxAmWzrJ\ntSsjHmU6+kR8AjRw0JAQt4JiwYGINGpBPSQOeJby2v3WRmEM1dIum+DmsV0x\n6mN6in2frSRsxbJJvOj4AQLfg9i9e0N/ZTIx7gq4Hs4GZNL66vKTPv47sXCA\n8JjIdxowuH2Hja1A1Fibv3qowpRdVYDPMFFxMEWItLp2decLEQKjPVGnepsC\nTFrZRyiQoxrKa/w/Y3vHmYJ83FMzxhu3tcFVI0/nisuseAo8Ddt+cODIEXEt\nxB2DXY9iDRqEY1fE1xG1dxzBrgT7hUWBLgdro2kGEO/4WtABkIbKOZli7i4T\nRdNaOJUMKSR65lNEAFbH+ElWOWsNB5sdMhAsVs3CCB3cVr1U6/jPOA5L6Y1O\nIZROtNGAx4vf+g9eEXUAHvWsBOZK3PcNe/09rBG3UHrbnHx+Kl0+nGz5UMJ5\nlJS7S9DvelwUEBsuMhtkiUapoUomSKwgfU3HojhNacZmXRz7uh6h81hkCM2I\naCVM5b1ILglDGvpKdWB8Q2jbIOma3LrRFOQsPHhckCfSmNAWXPrhOftU0cN6\nvqMswew6g4w3qbEqYRHtBdoD5zUycKOkP3Q6dxOPCnXTJp6NeSeAmlrfdO1r\ncDI5\r\n=4ZR2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/object-utils":"^1.3.0","@aofl/register-callback":"^1.3.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.3.0_1544130196033_0.09766848764837688","host":"s3://npm-registry-packages"}},"1.4.0":{"name":"@aofl/store","version":"1.4.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@1.4.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"97cec40195de7773a7675fb9f031d0a95676e83c","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.4.0.tgz","fileCount":6,"integrity":"sha512-XZPvGRp4RETSX6djC4klsmvJ2Hv/uerdx4Tm8yeaJ4/gigKtbw/YRLBGqChf0f3xsRIcX+VDARx6+XtUPygUcQ==","signatures":[{"sig":"MEUCIQCle8IJRoLSkogJgVMA5gQ2S1mefWEKGAAQ+jw49j34AgIgA7cRYq1TrCYm/IC1wpyulgFFK1xd+a18GHEaWBzMd5E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcJY22CRA9TVsSAnZWagAAf/AP/3t9IuNe/XzJFOvmyl6A\nAO2zktU5bANSKuo/XIIgla1IM84BXBGHEuI2IrsTUzouaaQL15WHFi3QerSH\nIfnwRgIkGijUsVI7HunjP4rMN8J9zsHCQ2qh7kLwfAuIQv6+n3EV7ikGOrEq\nSSgHEFnIYQgxk3jCRdAlMcTB8gYw8UQQdzqidizkFDDoxpMT/xPrq+A9t9NQ\nJOE9uIHGqk2fKvLAi6ZiOG6ELWCI2id9M+3XZOP2ZIi+bHatCGzTv0uxsFp4\nuE6/uyQafG65FoYoACj5p7z0O5SSn+O6J2g/69v7l3/pZJ94X8DZn4UsffMd\nL1C7ghe00ordPKnqGTj3hGEMjhvbjOmwZoLUkTMjqbjXvXDUcNQbtdNlyuwm\nqf7jJdh8qG5ps13gJHxe/WMAqocULIdfmxVfNndg5TMlUnnznBIIZUwtv5+a\nrNSyHbdqYHXzmjhvutNkECSjC7QNDnfe6rho5DVIGQpYTznyWL4AUmuyRGi1\n6G/9cW+XkVT+AGwHAu9upKN6SbxsT2KJzpwVr+rWQq8dFPny/IIu+0spyo2U\n3JYEWKvngWPQFOXZNmciHagSJ7HG4U1xiw5OfSIAzluxXs22fbIZZlhL68lh\nWKJ5144Hh9JAkVosy3oB0E6Ou4sVdQvtcivYit11wppWykEs+WVv5xng2XYs\nU5eK\r\n=U8dB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/object-utils":"^1.4.0","@aofl/register-callback":"^1.4.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/store_1.4.0_1545964981626_0.915330275058188","host":"s3://npm-registry-packages"}},"1.4.1":{"name":"@aofl/store","version":"1.4.1","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":"Arian Khosravi <arian.khosravi@aofl.com>","license":"MIT","_id":"@aofl/store@1.4.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":["Daniel Belisle <daniel.belisle@aofl.com>","Micah Blu <micah.blu@aofl.com>"],"dist":{"shasum":"0210d8939ad696e2e47a68f110e2a6f107ab7dfb","tarball":"https://registry.npmjs.org/@aofl/store/-/store-1.4.1.tgz","fileCount":7,"integrity":"sha512-2mHHiqzvVSql03AVt2VAjouVMN9gVQexC4c8LjTZvGtTHkMHyIBADobCbAuStKzxJ85HRRXTf3R/QdazHt5l+g==","signatures":[{"sig":"MEUCIQDQvqIqw7J1O4Jhtu/3u35RqMOEWuH2i9WRtr4sHl7qEAIgcN5wMHxJsW4R4REjOEBjtbI5xJuylIxsFlXNkxtyH0U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcM5t5CRA9TVsSAnZWagAA6F0P/jN3YIiq0Iu9mTSBPaZn\nUaeHXbnIc063GxmfMWFldVuhW20mkMcOSJ61YTi1xyFv4WLuOMN4WC9yeHGv\nGZgNf0EUR86r9X4WBEuWwLqyzI+ER2PQ3yx9kzVUk3Q1LqQHXRLlhsP1nrC0\n6M3OX3wpSLE27eI0060wzu1jJ+G5Ic+p7REyrUby7CBEhfl+UBacPfglaDEz\nAuUa+i4KDcifHCIJxKnjSMzlCFRNITxvZn6z14fuOcw2G9pbOZ6pFgJb4Ku6\nC971uBCzYw9D//XGwMxelgUVznbgRIl/+DnSDxfNIa5Kz4juZmmNj7lgyBD0\nDJ0oUeP9lBId4GMzkjDegUsBOf9da0V08Xf142YXBP0t9PwfxzG+2IAExglY\nvTOXiQgxTWAN/tfghINx4niIGxGlB5vkXfRJt0sibIcRVFECtzQJD+bBBKoj\n2qaueRXckhh8IBUkhQHLn+cCJv/9rwvl3kL4cizdvOavVMs3tSUsFsp39xxu\nlBBNL5mpsfqkwoevDnKKLk6X7Doe8cAAnBmuLaYTsg0fA2BjWJvHCGJauIgL\nbwyAYaMbBUcstU9TQHFKQzzv9hhaExDxxhtS5vo8BQoje6GD/TyKa9j4Vk8H\nyETaA97qjvMahHH1aoc6rYccp+PAzZZqGY5qwsgbTGG46oZo48VWp2I6GAbe\nL6ZY\r\n=mzYI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"60297b316858cd061ea1c221a7e04406b910ef38","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@github.com:AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.8.0/node@v10.13.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/object-utils":"^1.4.1","@aofl/register-callback":"^1.4.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/store_1.4.1_1546886008422_0.3501989824248446","host":"s3://npm-registry-packages"}},"2.0.0-alpha.4":{"name":"@aofl/store","version":"2.0.0-alpha.4","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@2.0.0-alpha.4","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d231ba6a64fec6da9843adf34b662143458d9337","tarball":"https://registry.npmjs.org/@aofl/store/-/store-2.0.0-alpha.4.tgz","fileCount":8,"integrity":"sha512-rFLpaUMOvLD+VQB6w7eE7fy5rA2Di9C14q4zvxPQBRHiSNm4CJdlgbX3XCewtNEwK06l8iwCh+XYfZN5U7CTgA==","signatures":[{"sig":"MEQCIEcKZknxIDa+e88RTRD5FR+3NjSAUZxCigX3O21TYS4NAiBYgoMfNOzEheus2YSuLQj899mRvoOJ34/LhPT9aCDtGw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24911,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVM3jCRA9TVsSAnZWagAAqlMP/0MJwbeux0Rpede1PrtG\nH5I5xj4ROhZB75W+ivpdO08XdAM9d612OE3Geg+3G6PzBoNBPCiDOOeFWVHU\nV+YaLk/H2oIiCajPK+ODvOzZttHvfuj7Q2G7OPW8YxfGadlaiQ5jv33DFWTP\nnV11qXRET5u2fRkvcVwVu9AD7b1kqvKvSePCbc/pGhQ0Rjel9Z0n3s7mzC2g\nwFQogTSGEX77Z5R74KACVS8AbPOdxbZrcMgztYdkXoCPrSXRS52gZVoJWzML\nfNkasR9DRQLHIeb93PVVnq915/5zMo0M4K51xDBC5L4lnYAjsbEyOBJfe/db\nFf+g0kk1RIjIhEXQeWWjqxkujfQz3D8Qq2MGrghXp4nj4iMOaSaspjGOZF5A\ni41DN2TLcEPNA+RdadAs1GdVG8uHpdRpTJyG1/agurtbkEJJ3LuilBCUPkmt\nwK6jIX22qZ5WLMYMKqGyEESOJHiRncJ7+bsz6BCqkAuQ4xdQ/UjQCLrwfG/P\n0RjL1K4YdWnDIAAZyEsFi2syy51FGgjkjvkyepx+YIdO6lkxLw1yo6VgEkBn\nmil3LfRG/LY96TkLRSz5EMkGBgoDILxjGSDukLr46zFpTyehG2IqicmHJgP4\niKbuXPePVZuOlOhPEfJZBi4XQW0oyRuldjkelndQYcQxXZrHdxDk+QGarWjf\nmpEQ\r\n=iRzy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://stackblitz.com/edit/1-0-0-store?embed=1\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"d1409b4f59da54e1e0c5ca051214ed5f8d0aeb79","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.1/node@v10.13.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/object-utils":"^1.4.1","@aofl/register-callback":"^1.4.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_2.0.0-alpha.4_1549061602909_0.5823128367407402","host":"s3://npm-registry-packages"}},"2.0.0-alpha.5":{"name":"@aofl/store","version":"2.0.0-alpha.5","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@2.0.0-alpha.5","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"45568f9b40d27c50ab6a887a9e9fe263f7343239","tarball":"https://registry.npmjs.org/@aofl/store/-/store-2.0.0-alpha.5.tgz","fileCount":8,"integrity":"sha512-BrgQ+4CqXsqz/UnWulxI6CN3n+/BhrW317k8BShhfmzivDAhtI1HkcYp5J7aHBV4OiQ5qf6E7witA75JWgO9+w==","signatures":[{"sig":"MEUCIQDz1/9rvUlDCrPBg4CmiRu3qnc9uzfkCzvsSmVC+ggeIAIgFm7bvnpLl1EFdg8WC36mJUgrbL1PKSyjlwRKbe3M4xQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24938,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcdciTCRA9TVsSAnZWagAAgY0QAI965QrIBxl1OJqerR3n\nIBVev8Te3PdAkWNOwKIIR0gHEW4D1GgiiejX2jK0GQbKl36Ij+rVsCAkCE1h\n6xBxIz3ypj8ikN+IzUpt2oIwYEDkQIcvjDo4rqUVAqhOMZzBfJhfK00DxnB5\nKMJY5Eg056tdEX4nSJBQlYjN8/KZNonsquqrwNjd8D/Bwg9vqUp+XMRdRgTK\n7D74/W2ZEswDFjTpwWyUAEHUFuYvq+83OtptEuAFMuLukNkTWjSRXiIiVcfK\nBDQRk86fo2Y2G7Ew5P2bFZIFlcTIlMDHzqkEEKQqcJWtK1tgrG5n8WjVehNk\nVcANqx7g51X5AcYPrlemwZq8fQHH8x2HE5ifeOPTJZ3lqKyWENPHMMgI4wTo\n1g/SagXHI+sQm4jAD1hJ7ICeBM2q9Yi18OWQSHYgW7+RRzw0pT59UmZxhLwU\nIWo1Y8C/kv0ADtzhdU2p1vFXpzsAVKmkzYj5B91io9ShwEtCzQmhNEf+5lvi\n+t8eL+fnB+riOG3U59w8DovNZm0AT4Lw1N/3AAMpFpOxaMN8Gy8q8s0wSiBc\n5qAVCS/ckyPQrZPHr+0sZ72vlcXlpop7O7tLlLE50bxxCE7bqCavDO4748bo\n4HDh2nsvtYFxcuitLUPR6oNfH+dLqodgD7TSf1SkSuLz3YWln9JrBzjtn0uD\nk3bc\r\n=u+ts\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://stackblitz.com/edit/1-0-0-store?embed=1\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"00d91514e0c953e8cd998150ed5705b87db20b39","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.13.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/object-utils":"^2.0.0-alpha.5","@aofl/register-callback":"^2.0.0-alpha.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_2.0.0-alpha.5_1551222931326_0.6970605817690569","host":"s3://npm-registry-packages"}},"2.0.0-alpha.16":{"name":"@aofl/store","version":"2.0.0-alpha.16","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@2.0.0-alpha.16","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"13de3825386ed84cc4841c7d413b778c9a56cf90","tarball":"https://registry.npmjs.org/@aofl/store/-/store-2.0.0-alpha.16.tgz","fileCount":11645,"integrity":"sha512-xAGL83SA702GtaGWTPIOFZWSMB4prxOFxkjjWf7bAyNzbaKlFYR4D3x1VtQUGHWHgh4EEQfD5xhw+oAMLV/jVA==","signatures":[{"sig":"MEYCIQDFfMu6kNNjZz1XjVDtrXJZSqUstXpwT7Jp2v0G6KlL2QIhAP1DBvq2h1LplUdT23jkJx0jV1TVJR5Dr9ZJntVy3eyl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53685561,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcwhE/CRA9TVsSAnZWagAARfUP/3al5aWQG9w/9C7Vb0+d\nDtSB3EkO7PMMQziBzdVBtLP4Tm6RjuCYNRB/ioiNJvuJgLhQMHBJiHfIyla/\n+SlhZj3U2URU9MjWKVeeQT42T3WBUMKlkcnUHE2w0shcZ1eYuB89xjsjZ1Se\nIn68JqYP8edSHQQd7GJpQw5kLbkmaPQjwUGaQKTtf2f21e0V1490+W+3+MK8\n+AG5nZYX6ChWqybTiP77DBvMH9phk2xolHctUIqUhPYKLGixJLwskqryuUBs\n4dn0CzbP87j0e+TGEfZpw715MhPLV4R4Io/MG/HqmkXr5t8HP6J6kL98EByQ\nO7AZrQMhcxUI8WNebj/A/nqBBP9ELsezDo0Ozwd4fhQEWNSaw2TD9Wffay7/\nVXOpwh4jcg1D7QUv0oKnhptTwJlVDxb1xqT9EPtShQfBKQ1QnuIjgiqBchiN\nUxYuDkfudtgOOX2FsC7V4qjzn6sQdHbh7y0MmRMvi1fEr+ud0WWTJpRhzB+U\nNJ4Y1r0ecJ2XZkLdoQjnxVBbTJf2jgdigD7nfCjJ3HZUufhIyQ3l10QGZV6T\n62wgtngR7ukl2AqucrQ3SWWZWHt/xqSECTHJ0q9wWKCl4y+YbnFN5lN70qad\nnrk47cU6q1XAqLiuwtBNhrRRBDo7BB8lWmq3sP/mQXFNeg7lFtVDHU0Jt3hg\nqeYi\r\n=QTrI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"0b6aa717a40d408713b5b981754243de8a8aeb55","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.13.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/object-utils":"^2.0.0-alpha.16","@aofl/register-callback":"^2.0.0-alpha.16"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_2.0.0-alpha.16_1556222270224_0.5377185538480582","host":"s3://npm-registry-packages"}},"2.0.0-alpha.17":{"name":"@aofl/store","version":"2.0.0-alpha.17","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@2.0.0-alpha.17","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"320b3332a446b59d7208402a21a98c1b961d1575","tarball":"https://registry.npmjs.org/@aofl/store/-/store-2.0.0-alpha.17.tgz","fileCount":9,"integrity":"sha512-ZfL4ALMQdm6dqGNxwX247R2uaC0czWdFLdQoMOeEUjpNfjTbAw+R/GotCcz8kCdWMCRGTQpMhdo2jorBJc5IJw==","signatures":[{"sig":"MEYCIQCJ69IJlzheTOkdkphjDA0RghIOtpg10iXrHOKA1aLM4AIhAJl/oacPabd++BTXcNIuXLpuqQ9XLzDeBiOdWUQDkH9f","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25876,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcw0+SCRA9TVsSAnZWagAAYxQP/3hW7HkJx/RQlLfB64ox\nGn2M698JZCixQ6zoIzDCHI841eap96dsc5Of+dncbSP0sNxv4y+xYWYdUx5y\nLV4+S+PFaHN8sPt/pr4o/IB/vZXTj4bzhC6MglakNIkpyPiKoQ+76dZ82XR1\nf7trLBesRPrVRxu6+Zefae8vjl14DgHDxDiX9Cgs/VjIzQ3hjXnHZ/15+uug\nFElSK6YxjY+QC8Kd5kAhc5RFsdfTiNBIpm2DW+mE6vh6TQ+o86QozfDnZ8qU\n9i95556rbIOyuIlDNJHvqYRcAj6HmuXi4vt/IkYLG75IMHUIQVgGMJuRHUTU\nITdh7r8tdERg+uCixb3Y2htPRyyC0DOcejG6DDlmdUnml7GwHlNmUQ1IS8O+\nBqR6/aNetDp4rxf2kykiVCsGA3kqOD7Zk0arKySxzfCCWbpZVt4yeBDBU93E\nAi6YeySgY5a4dxsHH6Kv0u7kPKtp1aBOVpfOwwq40JcsrSRVCyiXHWXvZXGg\nxRSXERR6tbPs3M+J39KUVtwoj6SOL2PwWHT+NRzU/tvQGwy41Jgl1F8fm5wV\nMKew5pjAP1S9m1K0IzpDYSkWwVKsi3vG6OLaYRM/QZEuc8j3lvOwxD41WdXR\nDV6oBqgFh28oJFmpGZ/QEo4xMhzLW0P7ILj7TKEq8H4Tk5mtRjHzVWODzc21\n+8ZZ\r\n=Ujf0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"6a396437dcb380ba2269ac50a5b3b88e54f99027","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.13.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/object-utils":"^2.0.0-alpha.17","@aofl/register-callback":"^2.0.0-alpha.17"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_2.0.0-alpha.17_1556303762117_0.9982066643458016","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"@aofl/store","version":"2.0.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@2.0.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"b19102851312fb368ae4df7d9b1a1b5aad379fdc","tarball":"https://registry.npmjs.org/@aofl/store/-/store-2.0.0.tgz","fileCount":9,"integrity":"sha512-lqbFCyvwt6rJ+Q6Wvgi7MAIIxoF2D5/Z0nn748bHTu8j+xMaxHDoA+JjbvaPVjtEFWxzLHe/pt+C5tn5uyCvDw==","signatures":[{"sig":"MEUCIAfJ0KA35AJ+5edcPmHQEfUlk+jF5SZigU7Jhi+nxRoLAiEA2jLPPFKeKyMEV4KNIskT85CLD7sXjgoLLhhWNmBPUMY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25849,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcyKKtCRA9TVsSAnZWagAAr6oP/i+do7qHZxfwcF15ols0\n+3WhqpbiWwfJ/jDxsn+IMU30FgA0059dyehFbFNLQTMOFJrraS9yLdApq+Y2\nt0S1JIp/Kc38xfwDQq6bs20fTpLa6KaT3vK2LZWeAy0eT3OOtW8nTpwvJLCX\nmEZtAwktwHqOFOKrqPA+J9CnuD7abPUwDqwT4W4S3Y/JKWOj4c0UtPnStOOm\nZPb3csGsLadSmiqNrtBG1e9GJmQiPh6Da756AXAVwybyFhdYDEsWpkI7jw3L\nQqKf6SUZv9H3OTRx+yhNUzWa99EPOMbTJu9XbolX51Oc6JvrAsryNSKELS9Y\nI6XUF8M8WXEBgId2HvB3xofAMaXIAiMPUVrmDIdQzoKl/ES0T+6jZh2wYIwh\nqzOTGHAOib5mPsjlEFqTUrivra/OY0mCed1nu3Y96r3l74XhdWgjukeg70vZ\nFvCakBTe9F9DJcQahsKnhmlYlIGTwVeIm528TygJW/1IjhmOPEQCt14fFUku\nPmT/of3Tm+WTDKOSM47oAI5rR839bLBef/8ek/Tfb6Zx6/mESVVOx0aS/h4I\nQn85KbmdzRcAErYkFss5mOvDNbLnTd1CAJmtzTPluUaFB3lA/9t05IiZOxby\ntx5KRuKyJdOQReUaw0Vy5fVMYxyytcOcWe2glMU6wisFs9fRAY6DL7zENw4Z\n4Fae\r\n=Y7rn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"91b9b3074f7031a51ce7afa9b542ff5dcfd64997","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.13.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/object-utils":"^2.0.0","@aofl/register-callback":"^2.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/store_2.0.0_1556652716648_0.44843632621136886","host":"s3://npm-registry-packages"}},"2.1.0-alpha.10":{"name":"@aofl/store","version":"2.1.0-alpha.10","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@2.1.0-alpha.10","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"17cd7e7f7c2d4431355d13c88363672ff69b731f","tarball":"https://registry.npmjs.org/@aofl/store/-/store-2.1.0-alpha.10.tgz","fileCount":9,"integrity":"sha512-ClEAzk6MA4/ALHzAAvdnmC4MnQ5Mgsq8cJZw3dP0onagHP1YNDOwtjQeZBXSLd8F3X+xMUKBWmWIv6npwZgKsg==","signatures":[{"sig":"MEUCIBJl5vRWDUzsiOaKUfJl1ChUzAOLbkK3pu5IxnbLu4mLAiEA/6VssOnp2vo2m47237/nQrz02GDT1Qw7s54h+JZTP/4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25867,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdW0y5CRA9TVsSAnZWagAA6oIP/RqGNKSLMCqWVcGXoWlD\n3mr+fAq0FLGJp4Fg9gPIT6rhHJNiwx+mX0t37uyAuIxfffaJqySTMn8CLETs\nUeVy4uYMrPRnR8SZHEWwZqNRld1RBP8WFH0dIyeGzVF8lK+UmHWAs7KqbzxL\nr7v7zjUEh4BmAP3BDnn02OETEnp4gPhriYXyHPW9u3970JZxzloumfP+k/i6\n1rnP5A5C+hl07Tyoikss9EkqaH31gyQbxNBm9jU/7yvOGXL9UvQ67bN6kEYJ\nQMx2txX6ehUtad7jhTzocFMABdC6WjaSOepGzs7tfDlXkdfRGMCZ/FZTan/F\nYMkKjw5POu2wPLZr6kCyCbu8F0QoiAtjwUtO2buIRP6bizUTnmMojVjmZsGu\ngAR4ELhPRK57h0d0Bgu6lyh21yzngHjy4b9P0e7h3ODCgaRfme/qLI5s3u5i\naU1NXtiyGBZ0+J4W0KMZCA7d90hNYpfDZVS3oCv39PG+K7byOdiSnwgMlZmH\n+opJ3Ex9fMQYp7JE5/G3Prw4zZaaa0AZHr2vtWEcUuB9uvabCeOeJ/R/8Yhm\n9H4/PPxCBXY95EQxfMNQ5OtRYX3AHvWGlPFVt0u/BZ0I+PpOFQU3A9rRM4vZ\nR6Qy6hKQF6Qc5iA5I2VkhCPO3vEKu2I3Vy7NL7tREXhbsDD3PeYgKx2b9ZUV\npi7V\r\n=bM6m\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"338f4323924751e2aa0541a472b0f39524c94b64","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v12.8.1+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.8.1","dependencies":{"@aofl/object-utils":"^2.1.0-alpha.10","@aofl/register-callback":"^2.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_2.1.0-alpha.10_1566264505289_0.4506215975334762","host":"s3://npm-registry-packages"}},"3.0.0-0":{"name":"@aofl/store","version":"3.0.0-0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9b27f43e04970276358a9c666ca681e337d81149","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-0.tgz","fileCount":9,"integrity":"sha512-MairBb6n1Y4MCv0AI9HLeQIbKYeEfx3gw6FcDjRvwoNYNC2LQ0UIGROgN30+Sao1i+YAc9oNRgEeQEp2keDCBg==","signatures":[{"sig":"MEQCIEyAAQ2sfOHlgNHVz6RMkuznpKeyWm/1w6Go9N+JXkeXAiBGlXnM5SJYRO+iS2AV6l66yTUR/FIDmk9w7xzsbgHU0w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25855,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdgG2ACRA9TVsSAnZWagAAL38P+wQRL75CNJY1YHY+RNeQ\nYod2YSiPMAv83xLTzDNPBZCw20dO2XaOR5ZqdUs4IIaMwmFMuE8/JLbm3xD8\nao2LrTCnHtf/GIC3/qHZG0nADnJ4sx/NXhnlRvPjdbFG35+jSLTQ6BmlN8Iv\n7xeFwr3dgqHmW8J4BEoXnNdJMh2SKe2rK/aUYP/fW5QFuYiIcCW/B6cu4VAF\nGuKj+ft/gNmcq/CIx9Kc5FPC4m2tnKd7P9cDQiIl+KaF9J5c6qEYdmmw+Zr/\nLjFKkobaTxEZ+MO7TYcsmp80taeFyMRXS2uyps1bCf9E9iSBhp75tsj4qEbC\n/n/cki8EoaXcLNCTWiWERO0l929ZVNI5KOsufN2OrSplhCmjs/TKaP/lRX7b\nk7/ueqR/h9YDMT9MVjMNY6j2wo+SP8KJh6P/8WdXk1IysIti6lKBFFn+uY5D\nLKvMH7a95Zy7Phw/c6sfQ18CES+pZc0H6QWyD77JH+tJFqHohq7JcEMXX7/B\nyWkimlo3gF2bleD1pnb1aWEOjWRSjI72CC+odwNWWp5XmZ8QgaNNtxq1q110\npUR3olHtnjxqW1VIMaYpt3LggyRLO5bof7/HLumX3RyOIFwTggKSrMKQdbbH\nJ2sOwEvTJUv0IxfFvEliVI9Df0rU2b4VrBcNdauLTn4olOm/huYwoRgqZ0Rc\nEM+e\r\n=Asra\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"68ed707a605f1a3cb02ab70ff9ed8a188867028c","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.15.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.15.3","dependencies":{"@aofl/object-utils":"^3.0.0-0","@aofl/register-callback":"^3.0.0-0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-0_1568697727655_0.9197032803706857","host":"s3://npm-registry-packages"}},"3.0.0-alpha.0":{"name":"@aofl/store","version":"3.0.0-alpha.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-alpha.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"bc2f4df8d142ca60d1bdc18319fb585071b99145","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-alpha.0.tgz","fileCount":9,"integrity":"sha512-CxHWPt/DDu/3Z3Esqxj1mzaaU+CwypPq6GBGFqVdcjEBgApxkN9eqRembzBr4c+pglu71WrZuuzO+82OAEF+QA==","signatures":[{"sig":"MEUCIBbPqSfmi2GpLDFWjDYGz+xYHQyFxjSCf4Uh928tLHQGAiEA2jehsWlsjGw7paaiLdoy4ncP06mXlYhWK91e6XyJo3k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25873,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdgG37CRA9TVsSAnZWagAA+BAQAIi6BEnCmZUlIOkmV0t3\nseUr4AO6RWd9lucf5qPVc0KDjy3V+fshto94hqOreS/j5VtLGG6O2FYHk2E+\nNfmR6OzbPisDGLmKx8wvQvLGBWhp+Fs94YKQbkfLCheF+JYEYISUN8YxvOFz\nvTOQd/u/hvPwbvCpOdFhiC7rEbAKkrCGjJOFnTkYdDzcuUmFCypvmfQVZkc9\nxnGjFx6SLAkkmU4sAHtiN7gMUCqoS8hKZUagV69f8nZY+T58jNicx+e5IHrQ\nXO8L/D2hCdXGsPBCj2kJ/auD9X+2xqFNO6M2+W+bD9ahO82+dshlV1laUnQv\n7lSRFsjOCYBcbcLynxaxe/ZA+Bisks5RnMVcyK5wnkwwLcQPb7+dq0sLKhds\nDskR+iN9Gl8m1RpGwC4GNkAPuKeUnvoQXH+VxoTDnP0kdtPgwwPXqPiH9zNL\nToMepCwL1dnoyR9TIb3PJItYeUxrmuGDdrt8znwvBns2nkKn0ryKq5k/J7BR\nA7PzVu2WBNQNs/pp8MqTcw1pVF1dBCJw3q+yW4jXp5jETXqbkxY1p1PoYP3S\nfRXD8xyn/QKJD4sbARcb+yHtuPN1X++3HqEMc8qHKmy1NQh4PKhAUeaDnHiY\n4KVA9+DkzYxa1EFHXtIjRKE0E2BCMtBMxZVyW+JexdJ6vropoEQX02uxMO8i\ngLSd\r\n=Ffw5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"c6c4d16f33cbd321585e3e7c86b1aaaeeccd3627","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.15.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.15.3","dependencies":{"@aofl/object-utils":"^3.0.0-alpha.0","@aofl/register-callback":"^3.0.0-alpha.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-alpha.0_1568697850635_0.4199752308687601","host":"s3://npm-registry-packages"}},"3.0.0-alpha.5":{"name":"@aofl/store","version":"3.0.0-alpha.5","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-alpha.5","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ed2562ac86a1ff8327df11451cbbd4e8e5065217","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-alpha.5.tgz","fileCount":9,"integrity":"sha512-QUutIxFKxGfJ2ReGwyzVy+hPQWximH6NIVS6kyNG0/Am/pvWzqt7QLvgoG9LyH0rnhW7Vj54IIhVOIJI8fYWSQ==","signatures":[{"sig":"MEYCIQDB+zkr7uhJ4jtsEbhtyPvh1bWQ9l6bNP7rGsW8pMtnOAIhAIQnvcdR3TccXNVh9X5PNNUCv1WV2mfFU3nRFGMgnxRD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25873,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdhHKSCRA9TVsSAnZWagAAW6kP/2KGvziIt5iEMLZt/WCd\n68+jXiyVS8iyP+0rJOaCxhU6ok3k6jgsQiNeaTpo9QcNo1Rn4wq0VUVeNGjn\nYL00Cebv4N0RkBaOfolTgf7MMCh2pvA0xxYb9Cp8mO2/OzWYKbL7fLtAyIXW\nPZmn30DzqdttlYMOi4wkmDRUR44WnxwYSwJmDEv3uylUjtlGb7fCKcQp/o6H\nad4e4vUiX99INVG7aC6GhDnBJ6n/myTz2H5CoT7Wzt6twiWkQ8o8O1NiW7J0\n3rSgVgIvC3VWW6LG/OGkOZIH+YmAdLl30Q7QNL6zBa6QmpJK7NHIMo0GANZS\nSAtqa/yqplt2D4Ur1oMedvGiGf8o444E3MO8XvcOXR+hc1ZNXhfrYuLV82F+\nK6nlBTXSOhoIKI19j4v5XoPRdRt4pyjaCMQQENjoUCmV7zflxHo6sCm9kf+g\nYhMvMGNqJRVioPzbxJ3tgYBmx3kDsK/upMo0i/MKFVh5841eyPN1fyaiwOrJ\nQkdTFCVAawzBkbw+CiXs7O6RoGJwOmstVvHT1XcOJQT2YqnLNp1aQ6j9eddR\nnxUEHcUTv6syfQMabXcm0YjBgh2bR8UQBHdVS7h3t2yZrjMey0JEJftKF093\no78Y90ybbKV84AdFzyjBER2Uic3bdu8a7+gA6ANWgDQFmz3CKhm6FRRqr1IN\nxQ5J\r\n=+OWM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"09f43882b317744481f4b6845b1cfae0461775d6","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","dependencies":{"@aofl/object-utils":"^3.0.0-alpha.5","@aofl/register-callback":"^3.0.0-alpha.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-alpha.5_1568961169457_0.854949332237027","host":"s3://npm-registry-packages"}},"3.0.0-alpha.9":{"name":"@aofl/store","version":"3.0.0-alpha.9","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-alpha.9","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d79d8cf87af0b3676b123375359090a33dbc29ca","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-alpha.9.tgz","fileCount":9,"integrity":"sha512-KR57qnzVFrBEOdUk76ElsifZzuWpYENhOwzCXYvShx0gXSK64tOggM7L40VMHzykw62PBTYOA+WB5JWYAdZOyw==","signatures":[{"sig":"MEQCIC2sI7hSrGq3u9FA6JKRWv/cwTKIS9eL7w6a0ywN4G7qAiAekCCfGS+WbsCHBGNoAJtZx3fKF6JBuKtmNskjO/gjtA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26024,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjSZ4CRA9TVsSAnZWagAA2MAP/RQb62sREVCGBtzA4eGn\nXxUKDvt/oyXahLoAx0NC7EM3vFY9Dz3DSXmgazgQWjOL9h5/M9YGLkR0LkWe\n/GsjhoDJIZ9oEucedjL7Fd4d/W50/2ycZGVNvefQrxiktRwtw+t7FG5REgoQ\n+KyfhtGQVPDUYB9qhTSXJU6SnLub8LmZT02XsWBtaPSJOb4uJFd4ZK3fL/tc\n2HUiLxBwEOM+UZlBa74q02VXWN44pOG2RuZ3YYD12ovVcv3bvEMRxRJy9wGE\nWePwm8buYNvcLdV9tHklm9d+FMCcTaOTVzk9p8Ofl7rB5VMhdSFoywnuCv8z\n2hdTP8sA7kTfAcba25Ih6PyMWk+6MzvawZGOA+6lCLlxVbDzEmDkha8z5TxJ\nHiKl8QtJ+LJiQoPdYGc5RhbRLnQSbQ758FJEyl3wCrf8KHze1FEDvbSisUnG\n8Ap60bl9JiFjARpII4RxeJVs5gNp5mK1mKOkP/R0lsGVaPsMK2z0LwzfoqUz\nSadxrzlMvwctVb+u0nV5J7zif/HevhKkCbE1p1fJXRl6nF0QN1aXtkB5wCzF\nzg4upPCYx6LDrDXIXFdjkPH0wE2AedY/DMyHvFteFdq9kjI9feUtyJOR0Cq4\nKd17msQadQc23X6JMhUXdxoy2Gw0Fi+ZZ4aRnSaEQ65dLSrGNfc/kPnKRFQP\nxY8O\r\n=Wqbb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"af4670fc661aeb5d8cb38bc049ed149e776972fb","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","dependencies":{"@aofl/object-utils":"^3.0.0-alpha.5","@aofl/register-callback":"^3.0.0-alpha.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-alpha.9_1569531511644_0.34178996171771225","host":"s3://npm-registry-packages"}},"3.0.0-alpha.11":{"name":"@aofl/store","version":"3.0.0-alpha.11","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-alpha.11","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"30dff311d53f0109e842ac0a83e02078b90916c3","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-alpha.11.tgz","fileCount":9,"integrity":"sha512-Xjds13/y/mEf0YrfNkBbr4k4i016RxkJvS9CFM5qIooDEqgpQ78pXG4U54NaMvA3ZLqHlMLqUm6KM5oSkUAWBA==","signatures":[{"sig":"MEUCIGNi+3RzJ0xsWFZ8fHznqWOc0tvmRq3dElw/Pwj2kqOOAiEAmnC7isHSFg8TSC/tTEuVg9/fJgqoqtQ96QDqobQ5Who=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjbD9CRA9TVsSAnZWagAAUEcP+QGtNu4phzhfrZUFQc2l\nehc9wmFctenNX5U3lWyeOl4XZPXcuYgJ79ZKzFDg3M2q0AV4WvaMCKj5jM0Y\nq0sq1t+n7hYtly2FtKZ4w4Uqo7Q4Jp7Jhv2Nx7Mv4cjetkAlNmdbhOnlZB7r\nNqemUF70wxT3dH7gC6sIp7R6OJYUsYJmMm5KQX/VfLZaq0pteyItMIyElST/\n0LZrJxU9EZUCW9UzLrbYscZIUNpGDdDpq9lAe4AReMymZuN17yQO4h5EOaxp\nkdB9LWFLTzvyiXUKLCgUDs+HNLD9lZLC3rQicKt3/Ao/VvztsWjMAjh0sI2S\nTxNEQfoWMSOJpF4hGp7czT2swTkVRI3aqkrshsHDpyCtxyHLf6lkkcS3PchX\n7lydE2wHY1unXhwVU6yfCHh4NrUVWK3nv9LyW4MjWxHo67SSycSdT3OFKMCp\n3Mn/xF3Wlbx8bhnn9k2F5Dc5dGlKX4NVz7+umxT0PoFTp/7+wA0H3bHh5SKY\nESdbVGdNeohPwVMgyVnH8tHRMcNVSggxeyy+NbazFXtOdobP4olluY9UnOsg\nLrGp/2J6q1dmkQ9MFmYLyN5x8xQQ6Kc8sbfy9QVVcnhOXdCOOFbOmCTaT9SW\nQnO0shWxIiw8hi1ICvNQSlq/sEwUACcill6K2Nsh1fLbhVxyt1f/h00Rcy2Q\nXGS7\r\n=KLkW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"ecdfe7e68c95cd3ce9eca2c86626275d1d4559fe","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","dependencies":{"@aofl/object-utils":"^3.0.0-alpha.11","@aofl/register-callback":"^3.0.0-alpha.11"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-alpha.11_1569566973413_0.7025883642374664","host":"s3://npm-registry-packages"}},"3.0.0-beta.1":{"name":"@aofl/store","version":"3.0.0-beta.1","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"66a1a7a895dd3ded3bb59327f53c6012e231af48","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.1.tgz","fileCount":13,"integrity":"sha512-+DybRvo8Q5RFd94n0yQmTz4YlGQQbUQjddGH5CA5geW3PQ46twhNsfz9LM6FuH2W6lkTG5pZkNiHcM4vQdKcTg==","signatures":[{"sig":"MEYCIQCmIetWUxVkzdMzp/LXWGxvtnmqSoG8nPNQnOIXOIFELgIhAO4hoj1TN99roggV0drYXvbUWCHWdzrxlVrDMiAEdEYR","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":34851,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdmahnCRA9TVsSAnZWagAAoOMP/RMQoHT2E7sATTP1q3/c\nRuhQCspfIQc0VN2hMEQB+dyZPS3vm2yMGUpDZKNa2XEcJ/G+G+b1dNdGPxly\ne+Hdzth0J23nYNWLpaainJkt5mYPhOzdXtp8HjIul0YF8PyqEsbal2h380gw\nhcU19YwmZu7WOoTnmiuUnCdOSCuYBjZe8JkA8tCfMary3auGxdeKDe+Hk3vN\nskPXLjnsfG4KV117959qUcxDql5Z3+z1908hsMGoQ0bhfvHBKz5NErI2FiRM\nqkrQPQ1FR56jzHFP9uF3gxV9N/lzLpFqxWSZvlRlq7uS3AHIvwy2CzPuZUmg\ngbvBJtYxn010JyBosw/7jyMueqO3/O8lqKsn21OYa0630ZWXAyFM8TOAs/0B\nMy6WlgfYE8f50VJzpT5hRoRAImOE+urUeh7nObh5TFJls8ptqBbWShM9qhjv\n4mr9u4jzZMep1wyIrlY5ml1B3pcFJSesM4eFZg0/GdLtHZ9iKc4vQ7mUMt3F\n/ExxB0Wy9/+upKcvG2+/2glRQox5q5CtvFf1FKlp7rWU6mdetX3ZUv6Ij4wa\ng4ylKKwjmxJSLfk1YJUGtU+o0bwA1WgQA+98mKfTlFiNYv70lleYbm1gcgF2\nu4ATisXnFl4dvJ871e0sCXHuH6N3MHaGK/XpA51ho6i6qEmbifSV44asuD03\nPx02\r\n=m9hP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.11.3","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","dependencies":{"@aofl/object-utils":"^3.0.0-beta.1","@aofl/register-callback":"^3.0.0-beta.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.1_1570351207152_0.7844026309699923","host":"s3://npm-registry-packages"}},"3.0.0-beta.6":{"name":"@aofl/store","version":"3.0.0-beta.6","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.6","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"0cade2725a1d1dd60268a89ee270a92fcb90f4cb","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.6.tgz","fileCount":19,"integrity":"sha512-BFS6sKwvpzVFjxvejD0xpigAAPUAQaZUxlwIwj9+BkAUdpX0JoG1AqYLAJtx3+9GCTPN5LW7gPBBpWfKvYHNwg==","signatures":[{"sig":"MEUCIQCauiHL80MjUWtqN41rOrNY2ezU4PSDrrSCisPtz+8OmQIgEhljvnDb04zwkYlYeUp7RBijDCZyixj8M4BCy9Vw5gU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":71439,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnBVvCRA9TVsSAnZWagAATL0QAIGzdM6RhSa9IJFiwQVm\nDs2ry8rJuZLaeABD038zfGjUj+5fc46FRJy5Ton1IGObPxX0IFDqH1/TxD6w\nz96AAoeKSkx19YMOq22K9uMclwjgVPvTY3xDZ/e0GjGgwztoOeXsmRLWh5D/\nAvHWytERKkoxaSp7+9vas/E5yTOkIapXKZm8E39yUEE/ccok6loEn6ox82Yj\ncgw4Welesw7Vb14Okn7EbkeEwYbOWQAXIPHVUaXIkLND76dletiXX+4fqjU1\nkCJmsKaZAtRI+7Zb8V6KRUU9FtpOi/sM8IYWYd8+/aLD/Cs8C/d+OcTmL1Ti\nUSwFz3F7EMYQndu4LXLs9GU3tg1qVkZy03B1xkFGlTLgyemGBtCQa4IdDZ2o\nhIa6/hnCzkCZxioDuoQNWdP7ecPmw00p28NyQKKk4BZM1zx8qvdGmXgbb0Li\nvtAY/V2xFzIvbnklKtLrxa9W9NFh8Oo+rL5xWo+I/IZQE0J7E9aTAmCZSX14\nGTJyqaR251AB+z6YsaMD0VVT22woxjgcqN0WLJdw0QeXB+S18OOSxg2zuNav\n4cmNiZAxKiKJ/otvdTBEn+9scofaRIz0SUgmmIL8ozZkHyVYuuDkRvR7UyDC\nbQlcKh7YyFAKwy4s7UQrZl46JxqfyKMux1YzuvDswdXGfHjc+2ii4RdPndKc\ndLht\r\n=YE8i\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"23e8e9dd00e515c9305baf320436e43f51d7edd3","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@aofl/cli":"^3.0.0-beta.6","cross-env":"^6.0.3","@aofl/object-utils":"^3.0.0-beta.6","@aofl/register-callback":"^3.0.0-beta.6"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.6_1570510190584_0.9503526783783851","host":"s3://npm-registry-packages"}},"3.0.0-beta.7":{"name":"@aofl/store","version":"3.0.0-beta.7","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.7","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"a2030c7239b1296fe56799b8b7cab7a5a39ff75d","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.7.tgz","fileCount":19,"integrity":"sha512-3Qe2eXjjL8vkeGwARD9ZySWRQnQ16Eo0MEONwE4zXs90+QUoCNvSbnCxT9qzQ63IG/wUpQyTBIqCOdhhM2b5Vg==","signatures":[{"sig":"MEQCID79cf3q0CsCoL8eiAME6UQPf603MWcic/7dct0lm1eqAiAjcK/N42uigtQbXwfq3r3IX2oGLYlyvt/WPj0gPNADbg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":72175,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnBz1CRA9TVsSAnZWagAAaKcP/i4AXu1UpGSLDRbrzW//\nazN9H6oTfzKlUqYO95oadlrUFl2BYZ2k+CuYjeVNRMprpZKoQ2kX3HKO9aNH\n+yAVj2vSvrBhT+qs5/gjD/zta7x/cp4QZ80KTjBzoc8rwkH6DRDdVcP/TxwO\nSc2ubm6G7DhLRmbcyE56R1eapGyLMnmOhBIqaWb7tcnmf6Xb1/D56WGNxSxp\nHs6GRXAomb3EszkVlHeanILYiaftgYmuVjqasbk4otVmksiJZ0zw0IxnYFM5\nTQmHUlTGIH1yzHRfy48CEBWvclU2gaBb23RQxa5ETnHl6ltgal/GBdrohNy+\nGoVJWWGmkfIYWeF7AdvzFQlZbVn/ibQ2SFS7UVKPwW1/UWHBH74gLKespwL5\nt9iVDLa0psFYI6I4ZonToCSLbbmPcjw0s8PcGSS+cq3h8uNGK5cOa/F668dd\nOW1dsL4IC573JnpWRxdr0f8+vG7dKcsyyzS1U7Fb8JRP7czT10CfQUdgUvkP\n42GMQm15oFup2+AKjjDpEGOzRgF0MI7/7nJpRY7PnefGQhhsX1IqjWz8y7Z5\n1Vy+5xt5PUDDbn4zg6bEbg7xKPsBMz2aEaSjZxaom+55cFX7YzZDbSVjoVP0\ngXnf3vzSu4tiNOdELVBhgMqgyVd0ihGi0NXsUZWbSxJ3HPVSbj/UvklFJzV3\ncgEx\r\n=Y9oB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"935c64ab2670b83a177719b549692acf9b6fe2e1","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@aofl/cli":"^3.0.0-beta.6","cross-env":"^6.0.3","@aofl/object-utils":"^3.0.0-beta.6","@aofl/register-callback":"^3.0.0-beta.6"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.7_1570512116997_0.43440939244508026","host":"s3://npm-registry-packages"}},"3.0.0-beta.8":{"name":"@aofl/store","version":"3.0.0-beta.8","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.8","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"28a821cf5eff7de55aea9db760e66dc5339fe391","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.8.tgz","fileCount":19,"integrity":"sha512-021cW5l82ZGs4Pz5SP8TE1H0+97jaoALshKK75lyoSa+oTn1kGxHtnmrBWtji8QcR0kh0KsI+LT3ygxrRWoOew==","signatures":[{"sig":"MEUCIFigf2YBuDzZBE09LbiElnpqTnj9++M0XiA6Jtoocg1VAiEAh91G3h+4xtCxP7y4nos8nv46iI00Ih9phZR2DKXN6CI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":74596,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnCMoCRA9TVsSAnZWagAAHzwP/jAL0XDeN6gGlV4RiCRr\ntL1qz9d15LcZkOkYLNmmoKbTXqR2tcxcZ2JPBP5czCgqp2/uXOx6Ad6PXlAH\nS1dlUJjq6zLKpqN4IFmndV504KQY3+iFnbk6kWGEAaqATkiQZhtq08Fl2ELz\nrwetC3Vf83VweXbn+aZmDQYc7j+EsJqoGbC3ktxkvpTffxX2tqw7esruARj2\nJqpuPJWVnqKS0/yoyKU8J6bxrK41AN2Qzn4NI0zLf6HBEWZyqclC4eHj5SpV\noxwva60yUGXtQIoX0Ql7MpAMtO3BrOiPNzy5+6rybR4paRfJBd3JbKKYvPPX\npe9t42thXM0mRF2sf6da2jp/NVpmzN6r3uO42OSXVe09yemFF0Bu3Sf5Udd5\nF5HaBalv0AQTzhhZq6yQzhWeOpGtuGeyYGt7+E5uJCf0FBSf1UW2KCUiEQ6j\nw3GSJl2teGLQPfzvlg5+5k9mQ2YQtdBdJZ+IMEENhbtj0HftbFPp1mpVeqAI\nwtwZ4Uqj9P6kcagn8QT04YRG8zKMOK70jW3WiorSc/8F+C6jBbyx/YaoclWH\ngRDWFfdeFevvCl6Z5Prtbmxyrz3hROKsSsHAiiqGh52yHVyNS0F1AdrM/UDg\no+y9Q1AHVpffOH4BsKUAc5OcxMk42k9DlyyEOvw6J62r0Z9/yKXVRXQ3eV52\nHqwU\r\n=P2YM\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"31f766f3cf621147bfa1530b863757cb08e5fc10","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@aofl/cli":"^3.0.0-beta.6","cross-env":"^6.0.3","@aofl/object-utils":"^3.0.0-beta.8","@aofl/register-callback":"^3.0.0-beta.8"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.8_1570513703442_0.3956961008590023","host":"s3://npm-registry-packages"}},"3.0.0-beta.9":{"name":"@aofl/store","version":"3.0.0-beta.9","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.9","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"0034464890e86555bd8c82239e74741f7a78320f","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.9.tgz","fileCount":19,"integrity":"sha512-JiO0xfbKcoBEaAMiSt7oKWEidbTJUsEr6I9ZhCDAVgF1ycFWPHZiZNaXtku1R3FHQnrp0EetvtV7o0D9pVJw+A==","signatures":[{"sig":"MEUCIEi8rQjjdXPsPfmhrAUtnj48lt4qoGioYUEEkOLAK8NSAiEAlmGdFX4+0lgycKxYENuLVcCm08e1x1JIOUEo2LHNH70=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":72175,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnCipCRA9TVsSAnZWagAA1C4QAIy4i9IIgBQV+NDIybnY\nYDbTL5IwNIimSVBNeSKZKLeZlJbraJ788VgyAEVPSwvQYxhZ3YvaW7ATG+J+\nsfA2WPQLY6i54UCWyAhNVnwtFDwOO90DpPykC4GzKwjxN6tKLf1wWkr+6bct\n7Y5wRMJwfwkgAsWsSKPjuhf63EZtB4J1BAH6MHTRW5jWlUyNEf0DyOcSjXPM\nr8oSL0AHzPqJOkShLjIsGkNipwLLtlwJgvxTKtYEeCaajl2KVRVLK+6yPnON\njYCV0r/KmnqJJ/EonRZKieIpmcKFNbo1Ach3/yuh5wKg2Rw3PYx4PbK55Img\nGJWjV1RWxvc0bYTR7NTMisxciWgajI+7ozwPjlNxiEf09PUe+3uEiN5mFtrI\n21epVyOYrGz4RhVDkVpP/5df/+GrPWEeZBnqjLUo3iMAfHuN7PnQf0ndoC7j\n8afAm0+oiiv3Pd3O9ooLNxpYzENjsez2XpAc7+JUfDa8KJkGlRhhziXCmldO\n/iorqWUJ2ijr4x0Og+Ib0BhXvlJRXQXcCLlth5Po/nk8jLBL8nnCtw8Rj4v/\n7EfxHsk7mMGA7XJrFvU31bvoDWSFjPpo20/eyYEVgCv+rIBGBGmXieYbwiSH\nfLoMRtpO2maluFt3hmYSsR/Ov0aApuDy/xcdel5l00uA8Os3Ldy8bb3HWb9X\nV/n0\r\n=hc7m\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"e9e6bf24a51611b9b997dc99e770d43466ba063d","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@aofl/cli":"^3.0.0-beta.6","cross-env":"^6.0.3","@aofl/object-utils":"^3.0.0-beta.9","@aofl/register-callback":"^3.0.0-beta.9"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.9_1570515113304_0.743352985379832","host":"s3://npm-registry-packages"}},"3.0.0-beta.11":{"name":"@aofl/store","version":"3.0.0-beta.11","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.11","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"558a1d8766597d90327efca17da654f39b6cbf6a","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.11.tgz","fileCount":21,"integrity":"sha512-2LropWYOA4MZa5sPLbkUxuAY0iPhH0bEYJ9FSy/wcrrMnNoyJ9fcVsSF/uHe3Oi8yQ7WxwFgXoQTyN9Tz62CWQ==","signatures":[{"sig":"MEYCIQDa9EzYsOvLIQE/IsDBXjIZ53ZG5HMd7OBaGLT/HqerJgIhAM/C8kKJ9kPR4BGRNo5BhSa2VHwh1L3ioFFaRlxaaM9X","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":93024,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnFopCRA9TVsSAnZWagAAgIsP/ib18RZ0El8OwSdb0lQS\nLVjYhdT6NwuY8kcCnXR1UMzQobaDZTerqrp/7f0aNBugfv6e9pNGOwxNoNUz\n4QGVDf+5oG1h/9xyuNwsJSEtxI4vDHt7kM6QGxg6KxFIQymIrKr+rAP5F/L8\nLmht1B2i2moc6g4LPChHCbmeLiTF4qiXy/dWVn4U7esUjigRNj8pqbq55KLd\nDfoQlJweoNxK2e0HkSDAi8r8sQaMp5scMHsq5yYv7aSq9zekBt9h6tgN1Fc5\nE0nU86z0TIAq2rPok8niztwlNFca5hedAz0xSCKZzhstuaqLLBhvDnISNMCE\nOLyRzUpP2QUQbA9lDAilvBJJ7a3SS4oRTmbdzljAAmy3rU5NjGYgKz6waLAb\nyykhgVZ0LBKvaHwPoOsCLT5TVpsQ1wHIWfMPad0usK00cMPPaSyWCmHAKY7w\nobZqjnS8H68wjRVJs9YNoDp2I+KNNfJUIGCLt9yk2VmZpzM+j08YQnRHaZfK\nI7POspTRSSCG3wfdQWoJm0G1pZ1RbN860s8FvgVcCbM/Gfn5G7QB/OUwvILp\nlPcxFEQWirVx0n8EBEudIv1JYixMU4asXrNJIycI2gzOxu7l+eezvUkMkdCj\ncCc/NPLXyRPWtiYgouJ6CC2UooN355EHLn8oYCDJWh1H95zAeplxtHSJLIFX\nkWI2\r\n=5PFI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"ad7cdc30523ea031f8d1bf5c62440f80f75a7308","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.10","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.11","@aofl/register-callback":"^3.0.0-beta.11"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.11_1570527784955_0.5649155094783556","host":"s3://npm-registry-packages"}},"3.0.0-beta.12":{"name":"@aofl/store","version":"3.0.0-beta.12","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.12","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"f3b4531a45042ac78d7d6285f8f3bc82f3e7be77","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.12.tgz","fileCount":21,"integrity":"sha512-PusLULT3d9LgHHmjJ7V/iG4V08OhOZIRcnMa7R6hWysYMCCoWy+dvI34uaN/MI13BFgbYR4hNFO4WIqzv4MIHA==","signatures":[{"sig":"MEYCIQD3UGs79XsmT5L9aAAODmHweiaXAOASn0wYh2uuMe9xkwIhAJMjhq3Zi/HiqnxeP2/vzMlK9aCLP/19bXbNEEP5RD4c","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":94301,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnFywCRA9TVsSAnZWagAAoT4P/iPitNiFbUjeonV+Q+jx\ng+205JiJVRGNcnWy/JjquSxNs6Z1x//O4cDstbpJ3OPkq3WUGtxQughPbS+g\n4vpYRx0cE16gfAse3Mo6Aw9cOXZGHhDPdxL9OvjMP19JthnrS/FN/QMfu6aP\n9RchnYBwYCMUaVsFLwin0+b8P1ylZmVPqEVszgwTTZ2zDuL7617GysXpTrGj\nY0GTTVYLciTbMQhH1oI5uoPk2bnOUGVLWYhUq+NbD92tQi2jRueLZ8MGuRyz\n90x7KwIMtWhH6FFCq5CGRCucegiB1YCAZN+asvKhPEPdQAlAWGocykmkgqNt\npJnmldFVHFrbyiqzb0zuA1HlSsmZo8VpuN7js8JNr5+xROADnoUv149HX7ff\nLM2Ph8CIH9z0T9nJk2x1FhYLErjs7L6iUPwaswxXodY9sSV811MR4sBy6A+g\n7r3rtMN+FtJFM+0VKbMkStNMkGojXo9UfBPh03okhu4jbRmneRHuplEjvUj8\nzFnuShK1OACtNB2zOanOoqD8krVKgo6be6+I/U4NWdsSGKLeghcFxvRjI6cI\n7FtKgA4MxFvWUc6P7qjg63S8FsL3IBY7cpiK216+ML7UDRcUkbHc/Ma2FenB\nYKkGH0bjsVrfvYEBWFRTfugQmA91hF3K59BqshD6qz9enH6LEshRKnPSlENi\nA41c\r\n=Wk+f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"7fefe74af1885e7b807b6ed3522d9ae661e52645","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.10","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.12","@aofl/register-callback":"^3.0.0-beta.12"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.12_1570528431903_0.1972286716166638","host":"s3://npm-registry-packages"}},"3.0.0-beta.13":{"name":"@aofl/store","version":"3.0.0-beta.13","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.13","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5db07a14114d74bd8e32b19b5d53cc91f48b63ac","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.13.tgz","fileCount":21,"integrity":"sha512-A1N304+FOV1WTX8seAighTJP/3MOvyHgatSpkuHwPb2XtEND/QZwk68IZ9xYEZpAZE7xUBerKuq5tpXSa5PuLw==","signatures":[{"sig":"MEQCIBfDb/P5pWdnnDJkQBU7P20SMwWYqobqwQ1H/0zhOKrHAiBWxJuqSqvgT2ajKrlgYz4bQRjjetfeYTZ/2JBH8VStQA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":94325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnV5vCRA9TVsSAnZWagAAl20QAJ+4VAZymDGG/19e/sFQ\nSwVPBFf1/GZo6vTRgfMAuV78vRI4Gz4IaErLX2lHp+jS7iYh+/2/cmkzFR3D\nVAxrPOXkR+esjVp0xrU/Eu4WKHHKobbpY9NZv+QWqe3Rsr72RPvOpanuEhET\naQzCT1HiZcNWe43jXu5Eb2vfrPA+vKYcv5XloFP0shuSH76McDq6G7KyHxVh\nBaiww+V08Bc+yL+zN4FRT2gS5jSJpD/bZsay/yZBXBRTXJbC0SzjNBv/Uu6F\nGIT+v1uvr5u1Jw8c+HTcrIIda1IO97HL90R7shTds+Me5JzoxlEe6VC8QsQL\nxRQ+UIG2ZJGDkkx7JUAowfj5g57Z1zrEdyKksC8NVJJMcjb14TxHtWrMIl7q\nb3FMW5sg+STHCxAaE1BgmqgUQ7pakgEJRKrhMdjZ5UCYOgMNrhNyFdp8IYuA\nWurTwdByAlF1+XVPUDJr78tPVUyO+K4OLUHTLsDKlS6lZI71rMlOub9MF7v5\nF81yrUzYFe9S8lPveiw/Qj7PTnxiCt29cKBRMbFhCtxhq2EZOJ7ttQJhzFSi\nizMsV7hXCarAQjMC3BUjllISXWaATrQm+P0PNr6At8ErcX/u8boG9Y6c9t7n\nQOr+DRSy8nE9IK4uKhgiTIi6ozZJsT3p+Nzmo54If9kEGvn9Zz6OXPu2tAew\nbF0A\r\n=1q+A\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"aa2e52c46ae9451fde097de4734398430f2127a7","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.13","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.13","@aofl/register-callback":"^3.0.0-beta.13"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.13_1570594414756_0.3457087015872866","host":"s3://npm-registry-packages"}},"3.0.0-beta.14":{"name":"@aofl/store","version":"3.0.0-beta.14","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.14","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fd2de18511349f275bf465df88b7b55891a2c553","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.14.tgz","fileCount":21,"integrity":"sha512-VZ+ftbLGwzY5GewsOMOOTgX/PrnaS7fmfUz0JochDRS8fQj1jvOLktKYj0empKuH9NMPq2MtQxJIVkgSv1Boog==","signatures":[{"sig":"MEYCIQCRaYv2nt2WyzUi+zMdfO5kXfarqWWDHW+SeB/DOBGosQIhAMUjdcdoNKQ6/f2erPD5qe/M4dXPAetZWwh6/ohgQ2hJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":94350,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnWMLCRA9TVsSAnZWagAAW/sP/18qTiXUTix/PMNcL+Iv\nz28QzD8t1wZBErzFDDsdg9dhu8Cfc+5tSOceUi5WPC3aslAjOcrdySDdIO+G\njwutV8u7saJ56jek5FY+xSsMcLIuf0tztcZX5j4yb0rCCDc+pKEhlGR6vlrh\njU/MDEpodDQi9ZVrnmMW7yhlhblZqCNaOSGynKhg8bJxUQIEssPSqUQdZ06y\nSgw5sg0uYG4ZvoOs+UdvNdoPKu9BDAglejV2UW3ZEvuBILLwt82YYcNMBujS\nECbPYogJlEfcV7efCbp+7PssEk2XQ+GI4/quxwSXyrQ9Ko4+48QMB89k9JTC\nnR/h0mIVLW19+26u0doimhf4q5RbqOlASBzyQH+Bf5dfnhaEtp9sa+E7SAet\n1z5fN9zJX8rtmkiK/InwX472Az0GUSYRFdSbu0y0LPD87VIYwohQfTH5o+aJ\n4Dt6RO4J+kxLH6qguU+9hoQZc0yibpHYRnok/zNi1N9A+XSqnueOX6fobCNE\nZzVHRLd55CSWvKXJulsk2zxAhQlchjQk/E3NNLu6kqtkyk/jCECNwpftBOSM\nNXIHCacWB2mLj4TSc8JNIv+tvNSSgYQ96NsKO3SjOynMjnei+SoOUY+GXuEs\nhK4HrxUyGPj7UzZVrMjkWJKo0F4mOoAwQvkVTTM+H+hofDDNGDQ36ZTKpKhK\nNtV9\r\n=YSfs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"80c0c882f3af67f4584dc8d38de8a62ca5632c94","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.14","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.14","@aofl/register-callback":"^3.0.0-beta.14"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.14_1570595594799_0.14297521948575098","host":"s3://npm-registry-packages"}},"3.0.0-beta.15":{"name":"@aofl/store","version":"3.0.0-beta.15","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.15","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"a8887f1a65e6c6200fb52f7ad3d04dbacb0581cc","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.15.tgz","fileCount":21,"integrity":"sha512-D/eAmL0Jp4hmxKFwsa9rhSpHge+W0RmV6qFyWEmnZfcnCaGjyBf2t7kMCnIdM5k1Ga4S8B5IuiUWRhxUoMsCCg==","signatures":[{"sig":"MEYCIQC7JuEQkZix8Jh3IV1kTLe18E2aN5fZeADHo0YKt5Dk0gIhALMWtgtQ2faI1EnKxGoQ/8EnkMFv43aqqtI+lYF1DnTt","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":94350,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnWcvCRA9TVsSAnZWagAADm0P/19n42KyHMmZ+r8ticlz\nm2oRcy1iqIVr/FSC0mLt7sq8edhD+Qb1B+gEbt/KoqD0//XZ8EiUfG/nzclJ\nvBNQS0k46WVg6xyWiglg5mHZRvJlQJESO5mPQmPPQwqM9R+aIQa0E6GAYt95\njc5/vFlCsiJW8ZR9/Qm6yP9CEIxsFfDVGiJMZeShsgfzpKp9S/tL1zEvlWw8\n1LIS+yUHG3Dku2NYk4pPauEhC+pUycMFhBG1bTAlN6Kr0z7sKmON+rQtDGPs\nHdUnouMQ2spQbTh6XvKC2/xST9fGR/tZjt6J3kuBSnzha+zt6uIARDFlsK/1\naixwZxlq8j8o+qO1nVXpKxSbrKzhtbanFr0YFYXcwbf7t5gY/OdDm38me8Vn\n/IPMgGAMfYK7un8429FLu1SzS6nn0PB0qlHnn25OKYvTwSdoISym6Zc6Zu9c\nSvzVBh5oLe1yk7Hw6aX8c1M73qaFYhWEAyIbjhSQfJlTaMan1CLZfyZVdl3y\nXtkFtZ17FkjzxkOxuq0VWrk5wLwSbQuMylABuCECq56YNUUk/1lk8lmtTjZq\nfE32SYkd6ea65GHWM+M1ByhtAJfLkzIW3pr/HZqk3Z1TbA9uvA6nFvYFqShs\neYBhX9Oph3XXO2Bf5E/Na7gwK9/hMqcnB9EuFDeXUDRWqDpVPFd4TMWFr1Jf\nSuED\r\n=+MIk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"0fab45fd3f4a1789a3683dbaece87d579e9de597","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.15","@aofl/register-callback":"^3.0.0-beta.15"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.15_1570596654491_0.8030546955692661","host":"s3://npm-registry-packages"}},"3.0.0-beta.16":{"name":"@aofl/store","version":"3.0.0-beta.16","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.16","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"6e05086ceaf40a965af69dfea4e0ffae82988fc7","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.16.tgz","fileCount":22,"integrity":"sha512-S4bfw7HxCrkUXsxSSirRnqA6rn3MLQSdvq7jna29dg810uHQd+8NlgtnleYapq2ELJlptlq3hQrJuUFwBWBuYA==","signatures":[{"sig":"MEQCIC6++7b4ueYQ7Zc9rgivjWBCvNX5kVxyUmZdnuPpBpPqAiAzan+qPdbTZ0yLCXMLHRNktFh0+b7cN4JiTb/2ejcBjg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":94391,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnWrECRA9TVsSAnZWagAAeywP/3hRp58UlfY3cVxP04yZ\nOy+0K/y7jf4Nt1f9cixUgdD7xKtp/hdwhXUx+p1n9BvBxbPKbY31DqgRwFad\nV/sBWHtp5jrzqnFpZ0RnTeZ5IznFC3XupXN/y2ztcZ54gS0SwCpHCGvSbXhA\ndmeohYclDT5MOVQSaZN8mehZnSu6tuGWLjWyyn9/pKXh7RW6UndQhGWeeE7A\ntUaoiBKMJDnvLQkVSAKZIdQPq6S4sh6SiaOyhiX7RFMlhuDsp4HATResjZug\nhRzyvBq5H7uhDBK4zZ4MLNbl4Pg61seUU7wnCQCwnsXqWKbNSnELIuCTjeaM\n/G5xXdcN7kJTQn4+algPBHbPg4rMIfMfs5WFmoZgXIrAbpt7/tFvhTukMlLA\n+LXsLj4RalEY9DpdUESUOPrugs/i+9iK7+Y1YKntK2hvbdgVY/4PhqlttFMC\nZKJbORAyENr9q0d1j9fLcO72hQXv4fvqhMSMKfBt2Pb1Y/juiQH+ZjAOQGiG\nfRXXO9iFAhw9n2lzAyjta3zkFzii49ncL4g3HO9A/OU8/xepOUI/VZ87b58v\ngUnOagdpBoqQEgqbyxRYEwd5RI8P/OvbD/9B9CqbFwQRqgLxW/cqFf/RkHE8\nk5xrUTXCjMsT4xh98iFhoDzI/BdyS5edBhM9WB2jJDf+gkU1YbF7lLEb8x32\n+aG3\r\n=vS72\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"32c2f889b64c30fba2458f8704f7c135b47c5b95","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.16","@aofl/register-callback":"^3.0.0-beta.16"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.16_1570597572412_0.5723637428315942","host":"s3://npm-registry-packages"}},"3.0.0-beta.17":{"name":"@aofl/store","version":"3.0.0-beta.17","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.17","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"347032135de1f2cf49f0a831bbcc16161d8ff473","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.17.tgz","fileCount":22,"integrity":"sha512-0dMFP/mnkUfxSW4uPh+tXBi74yhAQkNE9eGY3C/t7zMVu/cB2IsAj+b6jW99WShBXuf82XFi0GHP9Hm0WD4RtQ==","signatures":[{"sig":"MEQCIQDaQS34UklqgbPdllIKK0cuXqq2KmxlJ5BiFH50TBG9mQIfKRJIgl98gkfcEfGjGIZwtaYtya8/nLCEPkcJbfAs3g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":92486,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnW86CRA9TVsSAnZWagAAcBEP/j5AcTtULL1PUUjJxzwm\n59pGJe921nkVCn2p1UQI7RAdv1mcF7lKKENpr07UgV/+BrQqpSVRryJa9HBk\n8f8mVAbWTWa9ZzbIUQuEQm95bKBdLRIqLIXZ/I2js0YnBsfo4RPlWQVknBUS\nlKfkORn/us4Raep7uHpYqkFYHFOjUISLGvJrhb3uXYY08hOfsKWzONdEXWCU\np1QjPVfr/8RI6JdGn2ZkAtucvf0IupBHSCcFfzafbTaYzMO2iK63NXEvb1Lf\nH7WVpgbLPaQg+giv8UcgBS1Ak+/xGIK49C/oM2W37M40xVjqcriBa3xJkRyQ\nFNrBuXkaaWOBlCLNUN7zZZK3rD+yT4Gi4Xzei/ZLrbhMk0EtxEsNCHooV41v\njz7+x7WFRxxPu7eori4qpNMNzRb4ruFlUg9kV+7o7ZkmSjTVVCiPP0bi+sof\nXSdWVnapo1eqaC1wIiW2PfORcu77xiFqCXTJHfgklEt4wuquKOJhJEAmjwPo\n6BXV9zllGQlyHkjesF4NXqE4bhX8Pa9PWttlcHItH3hbKczsP7QsUQZbc9k7\nyZ7HcjhjF9v6ZGC74waHMwlxC2znEjrA7wJC3fw6vgZpT+W6OB6Fau5MOkqm\n/65MrOoOXPPwZP/7jLmkrZFpHDF8FzkYELwkaOT3KQnGGXgvBFyT0vYYuNn3\n5m+e\r\n=IyWI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"1a9a0010d531b8a6ab7287dee07687c312379976","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.17","@aofl/register-callback":"^3.0.0-beta.17"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.17_1570598713640_0.9980416385424422","host":"s3://npm-registry-packages"}},"3.0.0-beta.18":{"name":"@aofl/store","version":"3.0.0-beta.18","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.18","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"eb3fb2fbae24979c32b3b18adec98c83419d50ee","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.18.tgz","fileCount":22,"integrity":"sha512-KslOKoKLSmsdJ5skR9Xioddy9/ojVmlsMky0OzSoVhzjprt7tWo8iMXGAIvYrfBJlgFrC/w1wEk7+DZDWHsmQg==","signatures":[{"sig":"MEUCIQCKdlvrkjTL/LNSRxpBDqd3HiE1mCYjaOzmltKiQYzKBQIgIIzodBlVMQczh97gOyRbJEO2klNWLWOym46AMMoxBh0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90546,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnZo5CRA9TVsSAnZWagAA5E8P+QF4Z/PHHZIuyznenBRk\ngdaI8zHEWOcVOGXwl4JWiMe7lo2DSu8mAGQkBnhc1571UC4r1vbpm4+rZFZ/\nNtKVZ1K/9RNbvdlFTUtCP/je3F13+4/iu7EaZ6TktXBJRdT2Jgn7yB2Lf8sh\nhlKOEf84K+YP/2Usy8md7pAQZ4uoFzg9ufJ7ptyOVLIZekB+87wD76gxIDIy\n28uCucO8+5mMml3Wca0GJLcbCzwt5UWRyZKqw2U0dEJ7PRF/KSauIzN49t6v\nUVS6UK2DR5d4WCwPO4Qxo9YE2tQKJoNiQwrM+Tx0oJe4VX+9WQRq4ZjLRIyw\nw63wE6U5rzG6gInMJbScQu/mExizbNx33tzqIdWjy5tW4qSbC8JNUuHfGs0t\nfAwIgyZw1ONm2oAIgYvLTGqqAxQp6dJH9xAi81Mgj444ZtLHAHs2JQ3zeFsL\n/4edMqq00vlh6VFthSO+u+7wIWtuY0OCwR6RAjkQzi1GdjK8CN/TEgY5s/7h\nwaWaEp3xnaUW8cAsPCT1mx5FWfnFA9Qa+pc9HWqL7uqFsWaQWzhwb4rVSLUI\nwZ9i8JR0JBoPEqJj5dVhHJA6Khgsju2CGjkNbhfajcquq05LIf7wxMQxZPkz\nakUumX2FajuB/P/zkUaVf6vSYdDlXmItTtsFV56VEf9OnS0yPeATgOlaVXTX\ndpU7\r\n=wFWZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"ab2dfef9429103078acc848e0e35e4dd927fe6b8","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.17","@aofl/register-callback":"^3.0.0-beta.17"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.18_1570609720663_0.458645403633656","host":"s3://npm-registry-packages"}},"3.0.0-beta.19":{"name":"@aofl/store","version":"3.0.0-beta.19","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.19","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"10210cda7be72d7681cb1b2cbb86874ce8055e1c","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.19.tgz","fileCount":22,"integrity":"sha512-VPAGx4oortpcjOZmIlI13ETYqeffIhFZ+X6s7C9E7RTWzrhaG6Uf0Icg2oEBAGucEf2OgiwCQPprWRmTi1tQyg==","signatures":[{"sig":"MEUCIArRa6qlQHKp/BdpAwAym9AYHf+h/87vsUxBnXt/IrWFAiEA4+Mi5c4AOKiF4gTkxWeUXQmkQ5B+jntGJ2UpD+FUxn8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":91314,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnuPdCRA9TVsSAnZWagAAGjwQAI529TKsXDkSy2/LNZAm\nn6u5v+a0hb2Htcww3NPYZHk8iVUic2NW7fmKf5PwDzy7HTotRK3yj82aFNMP\nesTzan8Ld3kKUMOe93A0eoiXWooIhiqgFDqYatQCaEN16JHztQmr197wbZg/\nRSzr46LocWTfWWvyOm5/ESERcHLNf2mn8nUcNjNNbqrhYK513SYjjY3CV0IS\n3MkH7sSUJ5nCVIifnEuP9Dpwinz+nPvE7d+AHb0Fcuncerv38P/BDxb1F7bz\nZ4Ifg9sdlkKp6S8uVYeal2uRCgQLGqn5tVHXQrCXTmzNTzHjvqj5f+61YKDY\nQF4k3t7ukAQhDJtmeVkixtPGndcRCjgSNrmnfDbWwjXjDiE+6X7v9v7Qrudh\n2RA+lyljCAgtUGJlsbQtXnjIzU1Pd8To9xpr0QJ6Mjj1ADlSXaTyo9zT73QG\nSk8l4U3GkR7sZkpt5MYydk3ZTKmWNJjRDLM1Hl3/4bUUkAlqvUc+dFjYtdpN\nRrL7GLqP+guPH0rWJ5WblhIy+twwoed+MeJhmTj/XfZbMrBcxQNMgnBmqU0A\nH4tl/BB0gH9leSrFE3ikD9jYzQfZcogxSSfkrYvYthzLV8XWV4RN3Jm1s3zp\n+pK67WGnemKAZmk0S4OvvZiKXYP80W/6GsutR7oCZS4JCBueqyYlIOE0nlIA\nQG3q\r\n=9Hcy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"8b0406693e6cc6402e5fcebbd569807f2806d66f","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.17","@aofl/register-callback":"^3.0.0-beta.17"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.19_1570694109357_0.8021701096128577","host":"s3://npm-registry-packages"}},"3.0.0-beta.20":{"name":"@aofl/store","version":"3.0.0-beta.20","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.20","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"747ebfc86256477d128715c58b9e5772a42f7a2b","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.20.tgz","fileCount":22,"integrity":"sha512-lujgzeovBPBfAQbUAoefYbGx0F8oh4nwhQJlIovUWV2WSXhrgonQx32NhSx7+hS6cns2KkQ3egxaojktCZBxfA==","signatures":[{"sig":"MEQCIQCXFl6CIku/dk/BJ7+sbvfCq5bZoJUrWC+/GCTCKKM/RAIfSrXhvjNo8uuBRu6Oh10pX8ydagH+iYS1pska/6xpaQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90844,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnvToCRA9TVsSAnZWagAAj/kP/REMXro+0wqkNOgGlEpi\noKTNpZn3S2S/Jz65ckxbYXkwPtLKbFoTuEpX6CaqBZ1VZCcIKPnh6fst2+cJ\n81R702kZkErqSZryy6nFQY7OCudqO2rznB9t1G3si45QPr7ZhpNI7tC1VDtK\nnGXTclzEnbSreu94SYgoJXYGIe7R2nUbj55OrgiLiTbL6OQ5SpEs+Qz67Ryq\ndGWNCLVdBC1ezgi3k+cBuof0O4KjlB/GpHidqh1uppQI4s7hsYDF7NyzVV0+\n1G+lemqfmavntLIzew28quGiPQans17Pb0GhQcQ1faNfd720sLv42BJE/zRI\ncz4qQexKIJLOU1vCmLVNqnvaTNjVxAqOnzGM2UGWOvJnWM1hKZ7XAho+JEuy\nB8FtOPXR1sWU3KB6Z+UfL+jQXMAF124FoXJsEfjAurYEQBGNOs0BE5xLBBa0\nkH3H5v2QELvUvcz27iuNWMGpMYZ5akvLm1FdC6XG4vYdZbUcISuYHkzQ0aoL\nLBvrA55mxKpPbINr/SsVEjmorGky6YWVgnGZo45u7S2acQD226BPT+Yu6Q6I\nk/7rMmhFgdGAmbalbfSZLYKc/j1lzKdN0c+U/j29PLlsO5k9I36dB5IEI+wd\nASSGJ3Mli5AIEupx3kk8HHeBsy6G1NlMZeGIVp3idLuLCJcpFlIreZvvDRMQ\n/Jfr\r\n=rK60\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"91658d059c444309728ee73174105d2f30f4e6a2","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.17","@aofl/register-callback":"^3.0.0-beta.17"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.20_1570698471815_0.8640658756461332","host":"s3://npm-registry-packages"}},"3.0.0-beta.21":{"name":"@aofl/store","version":"3.0.0-beta.21","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.21","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d5d36acd7f6c9be9f2c18959d0044842865a8a3f","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.21.tgz","fileCount":22,"integrity":"sha512-5qoV7d47xX93HlHf3zG8K8Xk93rVerRy8P9XoG462pBid2P/+O/9pbMK6weKHEMsiVF0BOGRHbp2KD2CQdAaNA==","signatures":[{"sig":"MEYCIQC8iHy+du/bxusDG4zbC0D6tqS89/Y4flndDvaMwKcaEwIhAKSmiOQfjluiNX7IbdO4AopA0TVjaHJs7FUb95lVwv+H","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":89931,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnvqaCRA9TVsSAnZWagAAQdIP/R/Dc7nM7utMW3udDd4S\nhr+8kdSlGPI7aTCsxig14fF/NxbuOe5FJ8bwFsUHVq9k9nHuSIUd+eCpziM4\nAbp+ON+iuG+/nyULh0sNFmZXbKJHyzY/h73n33q9kW4IIvNFE9B2CbKpv6Ri\n+9IDYuSdJ2QQ6K+6+et0zM2j7If1fyofg6hKK0pQ8pUyyHsSVRVMdqznqXmI\n8/FHP8URNqRlSc48hxkc0QdaoXB6g2pwlgVaMGlSmHAP9mtuBfI+YyzEASm0\nChgWhd86PznWy0UfW6q+7lZjoliCLqUW0plepCHxFCpCXn/N0LbiIhVvNLAQ\nWjrJa3CwcH7Zpdrbk5vehqdNN+OLQDaWBBSTBfKyf3eIwuP53+RYr8Zvg/XD\nizuXRAw3Ox1ID6xR6N1h5TG2QUZ1LeDCjRRMviqw0h3xqKONBDj/pt6E+mIC\naAEBc9cS7TuKCzSyxfROG+Di81F+MQZZR47k5B5xZtyip7SGrY9jK1DPD1Rv\niIO/2uJ23Jkf7p3sgQvwwVEv4DFV7buOSQo2RsBmdVKMv6/Ph8R2TiWqhwgi\n14Y0VlfCXqn/yG+ITqdZZOikgAw2iHJGN6JGXlPBa+JPx3G4tHRex3jIU2I/\nH/WKj7NsAV7AxjhbU5JH+x7VkkU2bXFhhRo17QjNQSV2u4nx+6jgXIZyXy1I\nBcSe\r\n=Zquf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"bffb15ccbde7ba9677f7d906ef636093b5094969","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.17","@aofl/register-callback":"^3.0.0-beta.17"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.21_1570699929465_0.9030735437099224","host":"s3://npm-registry-packages"}},"3.0.0-beta.22":{"name":"@aofl/store","version":"3.0.0-beta.22","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.22","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"7b017ff00e3a6b0ea5794b427c997e98a11b83d4","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.22.tgz","fileCount":22,"integrity":"sha512-H09DUpAM+moklAywHlf/ZlQG6LgoBY70g5+xzOGVw3yh9h4AExzjWZzQYdVoOzFAsEZynFI31cZnTiGF5cBxAQ==","signatures":[{"sig":"MEUCIB2Gr+fbsb+LTKX1f7jJI3C7NV0dtw8QRaUOeINVJkehAiEA/kI+YkCpw1pguNR7j9s68gn3vklXQ5s3+CWALy/ZONM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":91288,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoAfeCRA9TVsSAnZWagAAnwoP/1fKwUQZTnXcLwinKq5w\nM67Z0DwpqINjq8PBICX13V/uEXfzasRNiZ+YYTOLnEIQ2oF7gRdYm2mL5+jL\nG/bxLW+oQbQvU5/R29tFzjOgcEyOwJK+P10i7ged6/ICwqnL7jCp4QAkAp+x\neqkb1As1KuOM+WeYuInnQ5TZVXnwFCRXj5ngJKq+eHb2PfkPHap45X/+htvo\n/8iztqZMyUTJRmxzHjM9JtXi8XqmxLwRN+pRRFF17ABzk6rBS5EMSp5Z4+O4\nzIVT4jimWhylDUdFLzR2texk5C+b9O/NalX38E5zvkyDsBuUcFHMxxjyAb+j\nTQGPuJaHfNKcYSS3tpUUA1B6HY0ZSw+0z6tJ2UUkmtUxKnsYdYTcdufwe8N5\njMNdGS1b/x0i7QnMAHLKeZSOCMdHeidje/vWkVGmCcN6unZiKpDFDVQJz+YE\nlETywlGdsYaUkntIada0206eSHBrNHLLzwrGQllY1xgDdPn6IFe4oChiSET9\n5t9jZ7zor3pvkf97tS14xR8OWkX4/ixvilCG6YDFq2SB5aEN83UKeuFMlOmE\nI5KhbJRVKx1cqS1C7lbwc+SWoODHk4egpcBkxVplwyOiq3FkgFIihN/NWcpO\nnVuH/WLE2NUAhVSVp19fXXpMYu3ikG7ogVfoRSjcy+tbCHeDJZz1tiq6AKbp\nQcFE\r\n=yvFZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"6009b3c38f31f159b65265ddbc3653c0087909be","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.22","@aofl/register-callback":"^3.0.0-beta.22"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.22_1570768861931_0.3295857521200609","host":"s3://npm-registry-packages"}},"3.0.0-beta.23":{"name":"@aofl/store","version":"3.0.0-beta.23","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.23","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c3c38259218addcca8f7d81bbbda94ceb81e1010","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.23.tgz","fileCount":22,"integrity":"sha512-whVvgJm8d1Ga6Bra1dxC6YaqrmsfLS0Zmmutk+LxrVHBrnufTQeuRtrEn3mhtAl/Fq0/HP9gJzXaDNQHVsHtYQ==","signatures":[{"sig":"MEUCIGtjxcNURHQ0h0aDjZQvxD9Icx0TP6dIW9yODKvjEP+JAiEA5Nx0haoi41NZwsXoX3NoGzLFoEK73pNv45e9x+7fx9s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90368,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoBW4CRA9TVsSAnZWagAAL8QP/2gQZ83QD9r2ipf7Bq38\nyEmfVTQYZC28ZfYzuyrL2YGcfmchSftSOKIoxfjn2ajwhpmoKVRKHgEfuMfU\nIeQPLtZn9wuu/X4MdR+5Oar8tWgLqGyDRXzOa3W0F0QxYRXgOkF1o72zkMVo\nFa/a2q9QT3fdcDM3UcDIPz7FFnmTwVVTR/0J2FJDOZEEv4D5KNj+G6JDvj9f\n00RiAy5xAtsjSFTFhEYoZF1IXjEH3xSInUAuI/2bDCRie5vn2IXhXQnsaO2h\n7svQ9XufIRH2IEfj4OUKqHIAXWqM2l0aVU3x1R7rxg4N8Z0F96X14eP31rVP\nV039DQQooMVj96QVyegZQfyM7ssdZKW79HRpjdGwc3xv9KUAoGo7BMeQkyQt\nej22PEemD2j3cq6QeJHLzWgP/SIldO5pnHvBUDNnBs7a+btcArVRgIAlX3++\n1uJm7yGs7po/A1okUanZw1HcKHutNW8PIBBG4dHoSqN63kXLoTV4ISYPQDpb\nJPEGjAEXG6M6+1AAiQK7GrzO8vJSrxovlbgnLud4W7E/U7uIpOKlTVH005+A\nb1Ms+C3P8VAftr0MWzO/hfkXtE8AT8brp6+OeoWSlPLdnYUNnwiE4LmBPr3Z\nkqSjxlOMknGYcK9vqMTxRcye2DdErPmeFATyphDmUvquTJ9c3YDvJQypwwWt\nAhs6\r\n=hiX3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"35327a525c0190a3c1ee36be061e25eeab73ed33","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.23","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.23","@aofl/register-callback":"^3.0.0-beta.23"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.23_1570772408381_0.8643308817818656","host":"s3://npm-registry-packages"}},"3.0.0-beta.24":{"name":"@aofl/store","version":"3.0.0-beta.24","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.24","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5c4242399d6898396c7c059717f55274a665c0df","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.24.tgz","fileCount":22,"integrity":"sha512-dE2UF3AOvhuNbtneRd3MIkDrS41d5jyVxuhrnFi+DbCVELshajbV+fWcCq3+O+ulI1XSbcfVu5xGpIH+ZyALVQ==","signatures":[{"sig":"MEUCIH4jwzSke5O0Jzgj2nM+65Gkm+3e749/7cPY8Jgr0iLWAiEA8+CzBOtxWNGmdAm31zlIaZDdhmV7DfBsCCXgOtVPS3M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90368,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoCKRCRA9TVsSAnZWagAAKdAP/Rus7r/eKyjgh9XUtOFP\nt5XAcZoTrCcrrQB4nlRiVYZANgp3XIuIgVGYfkbfFQdIypxCoiVBDCihZ+0U\nk7WP7kgclLXo/zhJ5s/ArtAnWSUw4Lxi+//7d8TJD9ke5y3K+Cop5reoU3DU\nFyH4vEtvJr9BmTNcpUq0t20cQWi2eDdWhh3oRFH6YLiODQ/nSL/zomhHlTSh\nsbZUIVRWHAeM2AlzJlHUcUqx8B4eyUWdS/nGHFW7EWuPB6Y067S0ev06aDm1\nLjXNoAHS0XBIPcgsh0KwbtgRz/5IEY2o9ju0K70vohccsbdQILcwyiCZu7Zd\nDvEruZoHTVaii4kFpPdMRuZ8qeWzjx+ywYVNtc+xcKCAwc5p2h41p217JBJO\nZn6p0VrPntAJjlw4LY7nZXCvTOMVw0iJ2/b3NPOZKtj1rv9g2QALjgTjKgtc\n75AURsySNJBzxzGL8jS/O2NvfN4CBCu4knDc+33nwoAWOFAzFJUmkls5abHw\nqer61Vb/5N9JuxArISKd7CUSND/S9TWLpLJ+MCqr63vrKB5jERACO4qhZEIl\n3i73MEep+76Kr/ZW1NPepvC/5LOfl5NvXgoeBu8rVoBMfpe2dckSLuuzpRLx\nBEWdsxb+SmUu4GVL6nvN0YSyONOXrRztZ01rLaPUX9wNNwgHOgAqAV3g07Nq\nnt8n\r\n=XYLc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"be81016959caf66748582258c92f8c73471a9f67","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.24","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.24","@aofl/register-callback":"^3.0.0-beta.24"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.24_1570775697154_0.6249315362240819","host":"s3://npm-registry-packages"}},"3.0.0-beta.25":{"name":"@aofl/store","version":"3.0.0-beta.25","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.25","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c673b0e8769d46d9e6616e3ae0de167063e6dc4c","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.25.tgz","fileCount":22,"integrity":"sha512-k5Ji3sO/1OSc6ruqy+LHHaUKyU8X7zrrltUaYU9NhVIziyZbboLevG0g/To0gOPM69pk/8XFHzj8QuDcqeDyHA==","signatures":[{"sig":"MEUCIFfg4Ob6DBSdfyF3dhP+CEreSTfNUHqjplczTo5gfPIIAiEAnz7zEmP/2r8+WFkKinei42gwbwFNfP5Hzg6FzQwUVdw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90368,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoDChCRA9TVsSAnZWagAAgS4QAKHF2JTU9CbXTxa7ND3t\nUf7M78octoP025kkd+cGVCH0pe98Bty/XSkChOP+6sb4qXE8k/GDoOyNw4Iv\nwyLNI08u43bdqDuoh3Swg5zjbrMbMbLLphiL0qe0UW1JyEbbd26YIIE5j8Sj\nxpWo8E6bbnAHK3HPLFBNBvNMH9qmRSLXrsJM/Q7U45o8MvGXw9CO6WmqzXNz\nWViHqJYF1UP5yaWrxIo6jT3QuuEnLiioatSKQnZFjryNMXF/bae52hZhmkNW\nipH2NbENr9TiiueAU43UcJ2ZOWEkI+27sOQXSQokC1ROvkh9lok6Ss9sQVgU\nyVZ0w4x6lMy0kHil02z1TARW/MK1tcl+okRSXLPH9M9WqHfrfeJawg30uDRB\n4404g6oREYCh2gaFsOwWVnUJe27OgT0cqtp9l2+1weKap0gOeckXs82TRU5s\nK16N+Z3d1kRjWo2y+iv8tBFcMxYk16ImvbID8a7BUDxF9P6gDru8l61ARysp\neShOu8DMdGXdcxUv6EAr3b3+OrqsSXUCdc7nxnJ0PlJlSk4hZN7yN7vwsmsk\nL5MHeQGNm05lqWdeCciMZrNBJR87jCWTS5orVu0v1JpqohgumhsTXp0t1FcL\nVqvzB5lw+aHRk4b/txB6GrRxWPgnFIv0C3emLvInumukS8Mb8eLEXD3Br3Sa\nF3TS\r\n=ZhBc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"658a5f60a694ddcc2ddc62e8db80688cc6b71c68","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.25","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.25","@aofl/register-callback":"^3.0.0-beta.25"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.25_1570779296469_0.8559062187633579","host":"s3://npm-registry-packages"}},"3.0.0-beta.26":{"name":"@aofl/store","version":"3.0.0-beta.26","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.26","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"af56a063945028873ae171f6fdb8817afef38d03","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.26.tgz","fileCount":22,"integrity":"sha512-I/49Cp2SB5CCrmEJ1623SF87Riey+Tf8YJh75RyOEVLL2SgCwYt5ILlfql5Di4QkldYDBIONqYC//4HYEvfWYA==","signatures":[{"sig":"MEYCIQDVTUBz/CPUTUydrecnTQge8bvxjynfyn+hR2HA5NWwHAIhALAs75y8YqylWxMCijVPxQtuuoIxVSPQ4ayCvEYh4ZtY","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90368,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoDP/CRA9TVsSAnZWagAA584QAJy5SYa9Z+tKiboqUIgn\nNAtjNAlfG8YTzNEMVU4e0I3FYxQ6ui2KgCVkSDA6ooqIAgoQJj+0YMHOCeHp\nZTaCUWAZtGbvx9i++iGDbl5b/QgPzGbUW/2UqMvJFcx3fK4om/Lmq/PwYEOL\nebfmUNdD7U0nL8KMlk3Few0vVpUzG2oaNE01IRFiL/1SHa639Juc7VIUgFWK\nT31FFmeDI7XdUnd6fgmxg2jMUflcusByyqjru1mlorLgFDT8rmfzr+2wvopM\nDcv/43mFePYwMY9se6azI2N+FVBoO6eYrzxlZIoPx/PzlUErL7hV/TASH7mQ\ne2i9kJbNVsl9e9D0+UgEMNYOGXsp+k9jYQpqZaeGkqRlRRGCuHvd0SHfHzSV\n6RMDntTy7/1GQATdfxk0MulU6aOmoxCcg4lO4XiB4+vcHI3qgbYD9/NFo74g\nXID4uQCv0KDdDwi3Ved6xSiJ/SbIol+7S6eSmlaZj453pP/srixqvWxE3zAF\n13TIRuOAZfXopCmRIgZMkIVtLvUaamdHf+1ltGDJ73c5WfMPuz5RxeaLcvkF\na8htrpsmdeJa9PaXIlxxIvCoGP2LD2E14K6+f7SD76EX56ILfR8yMMM6jtVc\nRc0Y8Ciq9oJAHGZCMjQOyRlBEZtRYVrclPzg1n13Af41PNvWSGjBpOq9UrNV\nK9wf\r\n=MGQd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"12fa62b6d27f95d1517f1ec4707c284b865a7081","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.26","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.26","@aofl/register-callback":"^3.0.0-beta.26"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.26_1570780158728_0.23869159866583667","host":"s3://npm-registry-packages"}},"3.0.0-beta.27":{"name":"@aofl/store","version":"3.0.0-beta.27","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.27","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ff06b9fabf513672018edf17ba9bb08f453f5678","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.27.tgz","fileCount":22,"integrity":"sha512-A5bMhW0wDdL4xchk9xfvmtvxxNPWFLyLsBgIxbOGxL6Sjsj6kPHRVvl6jHG0qhOsv30sQZyfr5ouUy14qgBezw==","signatures":[{"sig":"MEUCID+ymNl3QEZo+OXS3wR+qTAzhuofpaaFPUlS7XSbnLYhAiEAh3Kcp15b7ENRWc/lX9mrSJh9pn4Eu9towvdDznKoVEI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90368,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoDUjCRA9TVsSAnZWagAAMKsQAIhpAZBRU4FDjyEtIWHV\noSGF4vAxuEsglaHi4a0O16kTU9sPvrKzvePuawM4GtYyaoNIRYKslvISONN5\nOwwun7oEQQiTy0azIaZoby7tC7YWTDy9RMq9I9zCSvPSjS2d+7n/Kz+g+O0m\nMBLXgz0DYjRuOUp6h/LAUNA1XtVGhvT+jgFCkudjCizSOwCGX01MQSxDO+OY\ne93P1Sdi8PBkjXEPhgu/2BqRqWyNjVtjnVrsSXEBvZFNTxf6swa0veS2XesW\nBfUgBdES6GYD5uXi5MeoH2HdncOY+w6S0f/wcsKOVQK+9Vlm/5106bkZylvh\nAMqgFjHKfH7/ImcJt/BW7B35eRv9aeaqiT/96/AJax7wuaFHLUlG/Oafi4h0\nqaFzPd7og5/+tY7uSBya3bBMpFfC9+8S3Hz/ueDyYL1iMrUUqG2SK3jRuRpp\nZbQYzhhvdeI1zOe6mfUZMsDoD2Z2skv6GqbmIL/Vcf4SUY7XAjV5jvFL4Pyd\nY4qcjpRom7jXpqNuBePXxALxLhmx6WAhCefgcTULwHuIQXHlC+bD5aSgNPJN\nSktxKPmkouZdX6w7GmLTTw+X2NMXw3ZShd29uGebJGib2EkA4fVbTaFBLbDV\n0f6jIUibKis3qBPk5V8rznLRgBdzL7p+bu+lh6Q4LhV1UCswSmEK/mL7e/XM\nm3oz\r\n=kUF4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"de2f0be87aaadfa43212214d4f491d68930b2495","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.27","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.27","@aofl/register-callback":"^3.0.0-beta.27"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.27_1570780450880_0.7386842669569011","host":"s3://npm-registry-packages"}},"3.0.0-beta.28":{"name":"@aofl/store","version":"3.0.0-beta.28","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.28","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"a513614a839827cf009653ebfb21234354ecbaae","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.28.tgz","fileCount":22,"integrity":"sha512-KmCOZe/h3TU4c3HuCZkBd1IWDbeX1qANz9ESfbxYPrKI48+6uOY66wRqtTwADWI1ewoivtnP35segVX9M/A/7w==","signatures":[{"sig":"MEUCIQDQL2RGLh6duNJr0/w7l9UZPwg5NnxcsqRQaF6fdwrJsQIgWmzKu6w1VQIVxbsWeJ5EU0rJHM6SpSiJteVSxYxz4ok=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90368,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoDbOCRA9TVsSAnZWagAAHS4P/1LD/nSAyBiOuD94i9Iv\nypgJpo3I7yNZ97H4LSpI1dCKfKS1AHb2eJrulc3OMeD29Lfzpp6qxFNA87rD\n/RegSzSSil5eDwv8tXMoteXgrNZJwgjA8tDjfH8bdgRNAWB6GBv7Wx0Dti4J\nHP+FSi5djBlz3RdRYlTZORQMdIkqWcqs5lbnA35JLnxXnq+aSg7kMOI19AAF\no2ExzMMFIw1bhAgQdMPGbtg+Ny7W463e9NC2YKRgF32vXG/8n2hvHU6Xwfic\nfnmzEJm/x7o4+XdY73+VTLpP97g2DybRA+DggShn9ueo737pFy60D7qo1Xzj\nQTZLlcMd1R8m7vqbE9l+Tubvuari0+UIaDH4kfSc2XSuHQjOZEfHZ+lPrCWQ\n6UTHZ6ENX1c48ZNWLHTEkeqpK+nRaiEgQQjdwyRwgyXf1dIehUh0H7QcoprW\nNsv6cAxBILfmpB8thztf9wwe0w92GcjetKSsSVRUAr3vdDVJ8NOGggbjHK79\nOdvk0p/da8R74BDXrXoe0Q/vq8zEw6+NgtbpsGdBn4Bw84fieS/hnL/zJjzN\nK4Qjsl7/IqtkRwOaGMIFGj/GJxN4rL2F8Du6ysmRVHHRzMykPtTyfZ9z8jFa\noW93ZKt9aOV3/TRNT6ZMWTAyHe0kT2CdiNVcpGALwBNnJDvyn29Y9VpXMiHD\ndcx7\r\n=K/6V\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"dbd14b0bd931ea76999d514d051dcd0a3ef6a8c0","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.28","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.28","@aofl/register-callback":"^3.0.0-beta.28"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.28_1570780878027_0.3924243785025643","host":"s3://npm-registry-packages"}},"3.0.0-beta.30":{"name":"@aofl/store","version":"3.0.0-beta.30","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.30","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fc15a9e5b9d555ba60b172539695906e859d2ece","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.30.tgz","fileCount":22,"integrity":"sha512-CqK2v5bilw4N3OFPQi663tDQy4aHxKxtUTNbI6ivvw9hst4TDQwCGH5YyipHFxGsx3QuyZqPaTEjgtUL9eSV6g==","signatures":[{"sig":"MEYCIQD8eWIBTFifrzaSm+TZXlQJUC4IZi4iJtLCXr1ZMgjIzAIhALifShfUyyU/3jDW7P0Lvyn/t/99+lLsggXFgzDMzKLU","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":68476,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoQkuCRA9TVsSAnZWagAAftgP/2IwfZf4hwfDJQNtXXhX\nqBAoWRRhzkk8+Pav8y80dqW8TaRmE8UrZhad2x2X+J0X86OsTyVI+ZMmFsaD\nFDYwwc/OBC6LkYMXsY1OxbvI6teEJEPz1IaWkt7bxjhybDt7s/0doSPUvEll\nJJvo5VeDDMvfYtdC4n1KQboaaghYVJSjXpkhYWiHvxhjWIwjAbGsMHAE4JkN\njmkyanvntuTvoIM1ri7rAErAHMPe1UQBKEDxfZ/a9EWytzJcPqWMNFP+uTbm\nb0lm/Nvs0lI1dLIwNBQnlU/99CivVcM1HphVBjGzgTLE8SphGw9SQPP4pkTL\nuIwxzPQ6cRQoqbtXQCOCh5Jizk6bMgPfM5wsTzJ2YIWnceWWLsS389B5h+Fv\n/34RkIkVoderQC9PKIrZ6+ri+7fwMAwdCMhEF+aoSAW72TZK1QqF5Gfsm9XA\nreMq8kcacMRe30U8pCYEWRYE1Jpl5dS/NJS7sNS3NVO85LAYGLkPmmlBpWUK\nQrr7z9wiOsDyTb407FqedOuqTy3v+OuRASFUQ79WeBHQNM0GhGg7zvOKG97R\nl7KZaB+vuBv5fF5xA7fF30aG2YgMunDrUbzcWdMd1sLD+r45HE5t2+dEnkpz\nWVEjmPtp9Kda45P2y7PEsq1MoU8LfuOX3/6IFiVbKQn3bdQp4PcLtJbfSqWt\n7qmw\r\n=pWnX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"7bb6b9b6e2c1d77cf7e65680aeb6a4c60e0300f4","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.17.0/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.30","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.30","@aofl/register-callback":"^3.0.0-beta.30"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.30_1570834733883_0.4269750221975235","host":"s3://npm-registry-packages"}},"3.0.0-beta.31":{"name":"@aofl/store","version":"3.0.0-beta.31","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.31","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"30747455911b437612ff4045a14e074ba2bb371a","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.31.tgz","fileCount":22,"integrity":"sha512-xXurFlkylzgH9v4w/Wt1lBbd/YOw7arUXZGrYVXIUbW36BwwO+FhQyyiV0YL7U5/4gEUVjfwU5EMKupU3i5zIQ==","signatures":[{"sig":"MEUCIE1W32xno0yWlG15hOhW1gJeTlNSndBtayAXa8knQXmTAiEAo5hemEKD3xkvDww3fWPTXA/0SlPpeen7JN9y+yzOjhk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":68588,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoQx5CRA9TVsSAnZWagAAFPQQAJY+DH8ky0Bf7npF4xfU\nj+2lwVHruQQyYypapP6jFDB3VmpHZ70w4FbyuatZL2hTgqQvOVr8yq6X1MGn\ntzjixJ9D7pMpyVLXTl/6e6Ff35ptRSYAk+YluFNT0u2hfZytvBu8MFCX6CSW\nUik67ilH2D060QFPCVdHCuBiGdDwG9eQNwu+8pW2uo/fuEw5lIpkmkGnzkYk\nZmR13YsJXFLQx5iuffJKWTExfkoqYzGCY8A9EOn/pn6y+uqMmwXpKFDzc6/V\nIEdDmPwZA7uW4JCnjBoj7tLu5PMh1+jYf8oPIKTCc+mxOmnuM8O2BDXcKtxl\naTW+sYyPxmSOkISWNxfWc6uyldvwD0SpgPxh/bBvUcwNHkBh8EzYsuS3O76k\nSj3syp8Apw6PK8u0cTbV/9vEYOYKuidUw5ANIGqPluItFVBoK7LS4tXYsYil\nrySaOb2bl9fzzY2iUuuObhHz5wymd3xn2zMbXXH6Fix1u/6kDB+Sk1JbpwBV\nHlsIMfVSLPELTlQ8LIggolE7ZFH3dgyZ1fN5yjRcU1e6Jg18iy+U8O2WztnI\nmJwIPAqwE/NPV5FVdGtgC17bFTw3OwcNnw5+TVZ+5g8M+jFBvk7RPjsI/ElX\nhqHuzdqGNL1VqmREaSqQATPfHkdao5I5kx8TPcE1HkqxyAt6sFlmYD92qRG2\ntUYn\r\n=t/hk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"9210399f4527d13336cca428a2c6b4ec87434076","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.17.0/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.30","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.30","@aofl/register-callback":"^3.0.0-beta.30"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.31_1570835576620_0.48749892668929773","host":"s3://npm-registry-packages"}},"3.0.0-beta.32":{"name":"@aofl/store","version":"3.0.0-beta.32","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.32","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"7cbb63549f0f2413cc742bd82a6491a40dc4eb4d","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.32.tgz","fileCount":23,"integrity":"sha512-7c2GCA0z9IRHQGXuAtXkCswE+iyiwT2OdUjfmWtD6naFkvIET4nIy36sFArdTy52rLjSw+RSney1pnWULAvFhw==","signatures":[{"sig":"MEQCIBcwCIeZyiA4lbngsaX9AYVLpoQxJ7o9Nt8g7MDmXTgwAiA7c0r3pTP8VVhL64aqEPLua/bnBkekfFFYwzp7Mvkm4w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":72930,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdo8sTCRA9TVsSAnZWagAA/gsP/30lD5Ut0fm2bDZ1VyBy\nbK+43/vMFq4AoUmDY2LJ+pXODq/4pYKaYs2FfBYMKK5o42wMJNjbY50fzdlj\ng6jgzss6ZtveSGnsBqs+Qv7BhxLfRwVXh78lPwI4NEJGb2uDs2noi1mlq/W+\nRnaVrogLDCZGBEEKumPCE2po+Pk64xzvLxtF0RYe7dp+A7uV+Wg/8BFE/Hwe\nJ2Hg82Ws2F1eOZgouPpQSsUv3zZJmcTZ8UsrNJiKtid0R52kzjh3dXQebjdC\n2o4or+ifY7E+fGZo+0guwVRuSI5ewK0X4Qa9K+x76kj3zqX0+uJE+ONJQVNx\njmjbk2wnTMuKy7u8ogve9yXjNqxbz/SH1F5cJP54FPTBIOgOeWw/MVqonBM9\npTbnLtvJz6wFhGuMayT1Z/QSYKWjeA9jW1F93OnFxCYiMLQYbB+HxXrmLxao\nhOcLeLWmCAKgucqmwfeZUf5ZAnpPPLnZ1utPn09nGnTAj3KDpRelIFV12Dv1\nmHAQi3ghCb9YgHO95kIDGdAIFCH1hjJOct1jkQCQbp0RXm5zbzaL3bIJS0Kz\ngfyesM7b0d1AqxZsCZSwvDh7ioOBe4EmZML0O/mmabPYWkmuX9eEQeU7C90j\nSq/n+RKzd7knhsgIF0DcM9w+tapxN9B1NSMDGWZz0pSEpWu1hZ7lTsdCD0bR\nKzso\r\n=5ZQW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.11.3","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.32","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.32","@aofl/register-callback":"^3.0.0-beta.32"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.32_1571015443088_0.3270269860320687","host":"s3://npm-registry-packages"}},"3.0.0-beta.34":{"name":"@aofl/store","version":"3.0.0-beta.34","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.34","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"37a808193d0030c6ec3e20b9bebec12245e7dbf6","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.34.tgz","fileCount":24,"integrity":"sha512-MmuUaKaQpRsFC84e8emWmfHsEqo65m07d9qzxszsUkWTVW/jCA8i1oBYb77yoDyCf3bx+PCQc/Kjjw//PBB2Lw==","signatures":[{"sig":"MEUCIDcVFE2cUfjrpmh9Hs65Az0NnbsGNYgKBIw2xJt7zS3wAiEAq4NSOUtXqi/mA1kiwI8OwNAoSTzrGPrSlnIejoEwdwM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":74068,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdpCWjCRA9TVsSAnZWagAAaUwP/3YKRtYJZ1jTrBgVvzxM\nazg8NWMKTYK7gi3q5XYxlvg091Z+1QXwvMjvBk+Y2Sf9I7DublBYWlKHBhEa\nIyy2iaSzeFMXrxoGVvwJBN0N80zcqx6Xt6DBDlet1W0RZfB7j6xTrqzh4PoF\nTgf0G7MS7PRC5nMC563jcxJWpYUVUCimJawmu1A44lot0C4ttvzRHqdMmRQk\nUlqufZkNsSYLcGdnfrWdfawMGZL08hqGekhIj36BESp0jyXCfrGXGa/62ok9\n72x+JxF/Y/trX80bF1kLXP0SL3iFrdUyGHaR/TgBv1DerMuKRH+943cXRQtN\nKbquY2/EWtV5VaiqxSIC3/gafqDBA/nX3fZ3B5e9UpPP6vNoMpNkpJik6owC\n/KWDHE2+VCRU5HlcjKe7xw0FZEj3Tzf1KU7KuTc6iZX9OvR+2l0nlHL9EK/l\nw5JpwR0JBuRwE/HvwEU8PEseZfImG7A5QWhPDiqYMrPTzPFXO+d5YcomQ0Nw\nYSYolAoI+iHpXtUarkMinmcj59EpAihHPvke6StFRFNUlFCQd+2CcrmabdiE\ne4WEm4TSeOcr3BiZ001PlrabZidBFaI/7hG1GIk6OQVhRFrfbpoVTuSIAmg+\ndctrINhwNGMqXIOeF2XsColTqK4PSm/I4qaPE2xs3hF0B+EijXf/xN7Dzc7d\nIhF2\r\n=jTdC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"4cb990815f59483bc2ba6051e55cb593245567e2","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.17.0/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.32","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.34","@aofl/register-callback":"^3.0.0-beta.32"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.34_1571038627083_0.1335982873476793","host":"s3://npm-registry-packages"}},"3.0.0-beta.35":{"name":"@aofl/store","version":"3.0.0-beta.35","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.35","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"3e36417df51b5c8e9132d155482dd05eeb7720a8","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.35.tgz","fileCount":24,"integrity":"sha512-ut2We/ErFdgs+Y2x4PyVdt/St1NMWy3OYRCrAHfqB4YYQV3LYjE2UrQpTWC0iYwD2cFgzosrN5Ek1lCRQxtpHA==","signatures":[{"sig":"MEUCIF7BMSV1dvVdf6JLVegWpPBmRKwpgISS74P4sB3jy/GvAiEA+5mPv07FnFBBLaqXvSRpOmdk1amaHxZ4NctPG031SQA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":74068,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdqWLLCRA9TVsSAnZWagAA7M4P/j6LZ0H7YqxBkFpy6AwM\nW2qcbaNNmMe4YADCGxnFJjZSPXfm6K4L8/64g0qRL5Wxqjr1CmdnguU0Sg6Y\nBdxfL62d8xLP2Vcqx5fWnQVdEqPUnC85VS4JvFtymE8ynz4Dx5aUpP8y9xTy\n2c0yLozEI1IfCz52v+b9S4Al/qt2j/RGJDCuCkTAdkrsVRY8cgy3QzNLJQuM\ncc15qS3NfdyPQh31UMbAvmin6KIYsUJOeZPmmE5R10+T+hJgrZUBczlbkzKs\nZgE53+eGO2RrmxK77GtDcuGcEBuyodDp4QaXwg0UHhSg/3FgDUDHI1mrzZDL\n/va7yUKBHF+3IVDaDOIf/PfSY2/iCkAmDyl2bo9Qhrv+I54Jc4mlG8e+ed69\njJyr2CJNykHt0si2YQzF2V3zvYgELukP2jsqSOiCs7QDNN2ecu49r82gPpHJ\nfCcgxYc22EbILGvmF4sZ3JUpYBO5NJ3uftEjnmPr2SQwX3QbJqx612IocVG3\nuBTYmm8uroL+OHhxbMESKM8AIrdQDu4XMgpywYG7PMbjkWqjkXLB5DMvrbLj\nW4xOXF6qIA+dlqyM0/yk+k5hUlycqMLyeCuExdu/HZi1K3NnlYJdvQK5eTAN\nn+6vKINMqs2OeNSEM9v5cStW2soIG+6H+88OJ3qOzHmWo2QB9ZIKCBClM1D9\nVZ2J\r\n=jZ+W\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"6506e91bedeb6cd9a30c22f437603e14e02a3ca3","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.1/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.35","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.35","@aofl/register-callback":"^3.0.0-beta.35"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.35_1571381963326_0.9994050082908255","host":"s3://npm-registry-packages"}},"3.0.0-beta.36":{"name":"@aofl/store","version":"3.0.0-beta.36","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.36","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ce8c455f5f63e5b4b5ea2cf7d1ffec6c6882bb81","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.36.tgz","fileCount":24,"integrity":"sha512-6iqzn018/QpNer1/3gCTIq2sDfzuLdo16PhY05xWjNJNPcNaPhZ2V8q4KbyFst2MwrxRmMnALz+ookXKSFtUtg==","signatures":[{"sig":"MEQCIHWi/6FEGYf/YzaV8iUhljyoOnjCbkCREjsr5PSlZ9AlAiAP8Zes+X/ptQFv0Do49VZGJ2fkC5HdZuE1au+iDtiZ4Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":74068,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdqultCRA9TVsSAnZWagAAWCwP/35XVQCEK74GyaSA4atl\nuQy7GqYuLQnp9hsiWf7fc9OAFwGAQFpMYhDCK90HQJrAOeFSO9mwMNtZSg4u\n8Pn1ZJXED6Eh05AysCQvntq4Et8aSh9jlLkRBA403ggajpqw3sTtQVb3sOma\nhMEt6DlqneNx5I8mua1HYIOO67Y4iuNIh7mFcIVjRCyd8wjFSTmUy7//q9Hb\nPsIOb7I1GVBO129P1MFMpyx3V8p2r/yXsMK6R6mPRtQga53HdZXsJIJLjqA1\nh3EbiN2O/hNvj6sKJLsA/XBKOG1LQj25rG6gQix+zavVUFo/kTpEbrd3oPnc\nmbpqCVBfgIP8FA89F9B5ZViCyVfupJ6a46aD1F/UAxfUkxKUteJAKnf8LMF8\nrvyhfUgTfK12sVRHJnQH0/1YXbSQIZNPiggOFRSO4QNuaEBmBzcmUCL/ck6Z\nxdiM+lF7iWUc2rHbUhonWef1xcqErTtARWewbckuhqBAEUdlzH3mLD+mPZaS\naThTZ2ui5mZsVmWpn5Zy9yUabWgCT0cEwRYkYOQEs5WI2wpyquzJM9S9mRPZ\nvs5r7HGiubD7dXodVxNiuK4IQryOoV3usZ9zr2X8Frt0nQ7fyZm0fE7fS5EE\nNYZkXaBexPfgINdGKYAR06y2ngNwGl0W+6Fb8rnrUItPKen9veEQDr88iNOZ\n5z2w\r\n=ss8J\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"9eae9fc87437b61f0019ffedccbc3df7c8e02a78","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.1/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.36","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.36","@aofl/register-callback":"^3.0.0-beta.36"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.36_1571481965027_0.681206363708585","host":"s3://npm-registry-packages"}},"3.0.0-beta.37":{"name":"@aofl/store","version":"3.0.0-beta.37","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.37","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d6f02027904bcab2768784d8655e34d38cc02607","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.37.tgz","fileCount":24,"integrity":"sha512-UTLmjZdXsneuOeRlgmjATscEObz2bb1MUZEck68RK4pz1/PRAXU0vS4XrtKNoEGiFINUg/kqvEWIdPcC9sLrRw==","signatures":[{"sig":"MEUCIET+HfHwDrI1fFofcRZMjobKJGPtRKv+DX/gyrzC/MjOAiEA5aq7w+dFJi/pK387DFMovXC85VynT/Do58zsdnROaTw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":74068,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdsT/FCRA9TVsSAnZWagAAjZYP/R7G8yqp0hNqPY4MHfi2\nExetuCvco5/S+T7YChArvpWtPR0jNDJEJJNu8ztjF9tOXCiUKZWcAhqV+qV3\nNArmdIl16qWQnbUJ3xbsv43fGyQ7etW4aUuoDlHjl/2S0Ur6MnDs+r8iBdNT\nbT6sPqecBIYGUWHFF67AF1bdnxTeIWGmQJMohqM5pHi6DpYuHyjNAA2MrsWy\nqyhCYdfS7U7teOxUYlgtxfhof7HmOIFaA5JR4Fp9vSzdJza4kxzKr4t2GDHo\nIudDX6i4Bu8FFHE/rteY2/2r6cCWfsKN08+qvu91Jhqy1RnFpAH8blI+vofu\nSW7hsap8m00feAmRMlNav9FxyViHBMGz2qcPwGrwSRcaaiGFBYKVRTVxykH9\nppSW5I/kWF7l+/0i2z8z/eVh8RBfGf5tSmqzczrGcqUYOHsDslIOboM58ZO5\njuYTldpzofvnZcV1QxOBJhXvpAHUBPgxPVNCgIRGIGjVd+5UEpyqwMdBXx3d\na/iCpLOUE0P6FmT3xEOtuRlEknF2i++uF1Fc02qeS5SYLhSh550rwCS9kCsE\nQ1GYVciMgDrzfAhsELDfoYX6kG2JpSf06wcsFQEDhrv98fVcjWEP6nTNnKtp\nQgZL3cSo78hX6NZIMEGXDmIb0Tb8C3tnMDu/KX591SyDQUJUG9HqmgHw6AX2\nOvGb\r\n=bq0A\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"90abdfa3f72b91bd0c98e09afbd59c21621fe846","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.17.0/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.37","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.37","@aofl/register-callback":"^3.0.0-beta.37"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.37_1571897285040_0.7193158428457287","host":"s3://npm-registry-packages"}},"3.0.0-beta.38":{"name":"@aofl/store","version":"3.0.0-beta.38","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.38","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"37724c5794575305460150d78f506dd6547124f4","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.38.tgz","fileCount":24,"integrity":"sha512-KsUUzKEv5lNY+lcGat4jgIGQVCJicCIojWepnjATcvGKkeMgJrGqRx+lWBpwhxcFRmScDHocAZHlS41u+m7F4A==","signatures":[{"sig":"MEUCIQCMmETOcQgRuXqeCoD6P61L2KrSv0f1uGe8d8RE/r6i4QIgB+NcztXttJpieeTWHS6hAZLk48SNMo/MyeZZVy00rM0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":74755,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJduhQyCRA9TVsSAnZWagAARv0P/3QuheKi8DH84O/Taa4q\n7t+KVtyTj/Io6Nnfa5TnnjlfFHEv+Ae6p9OhBuXOrCHsVeBpqijdKsYp4OvN\nyIP2rPYO1YN/lSXHAREDWxU1b/wZ/N80pqKXxNkJC3UDbd8puxPO+4XtMm3B\nm0bkRMqOHmenkn+5WkVPZe539DMyXvBuCsdW0cPwyzChlXTbF2dLHkBJsEDg\nBWpMu7YOoAsyP+xSO1cFJNijeWbPwOhO19XXYS8+XDPMTapMqvwO54ZPxfWG\n/RFRKf833hcB/WB8C8QQh2WKrMeMnjvHnuDAr4tF3W7Y399yDcJpeMe65zVN\n+UlXQUiKMKVJ33kzTlIYSFkJQ8LrmQQjc80+yehkSKBvo2iuWPycE8xYX3X6\nck9n1PMuRNBo8wZqJYKyrltkMNLh69wshQmGbpOP2fhD5HaezFI6wywOuUxV\ntd/uBcqC3X3a1ZudEpE/SYjryGquRkEB6VusJRQal5RiN3nTl6FrHF0Qkviv\n6j8AXwMldhl/LvCYG+uPFw5sDa1v4UW9uRb1Z8He1S98t+bbewZjKr9Hkhjn\nVVQ8qaVaY20pEiSvIZWHJ5zqFxCE4buXhJvrOoctVpRT76DM7YycTyvUgpmK\nMLCyfZbYBieE29kx3UFBwsieHMtuJgVr7R5lX3drAXsLRD681Bdl8o1wKOho\nhlPK\r\n=N35E\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"9fff03a99453d439b551d48a69e5d642b9957854","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.17.0/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.38","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.38","@aofl/register-callback":"^3.0.0-beta.38"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.38_1572475953949_0.1769176981292746","host":"s3://npm-registry-packages"}},"3.0.0-beta.39":{"name":"@aofl/store","version":"3.0.0-beta.39","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.39","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ae3519b7427aa8006e48bd88de1122efbc4fe417","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.39.tgz","fileCount":24,"integrity":"sha512-eWYGJPspE4KKm3LwaIxxTLNWKXaeoeMB2w0SGe9aTOCRfoTwxlQJZTl/MbLAvd9x313VZxgy6PNY0fx5Qm3Cjw==","signatures":[{"sig":"MEUCIGOx2C+bQ8Cza+KGevu2cZQzmkKevm+0G21M0lYB6iWNAiEApsF1CMy63qxTcoDuaRa+T9qpkjyGJmVYhU5ZgrMG81w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":74755,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdujP0CRA9TVsSAnZWagAAwWIP/1XxcGM6vSoCqtDT5LtG\nbOb2F7SHVjgQTEL+OK+59Cb0ESkf86zIJGiBXBg0mPiERTMdCTll6uZAY3wr\nbA7nF1n/RSgI1PGP8K7tB4aj50+wVThX4NvioRF04LHv8nRI6c1B7S31gekO\nQ2TAO93nPhW6axd1hZ9zVmDSssCKv1tLLIn62bhcRcKXaLEoXyCEm+d+Nn46\nka1ZPqnCbUAJ8+WUoBjGzalFj0XHiSLID7JEQkdDJ5ZF6ykBDcuZnA0SbZjK\nz1u8qNb9GWldl6LN8vmVRmE4bMxLJgSAyr9w2mwu+QLN0OsvSyOxxvihOGlF\nPS2Pz9g/hFeE7Fn+xE8DPPGyJz/9MK0ofpQnsROpKBqe8hv9sK+BjmXO7Se6\npMZlMrjUW9syPPhRi0tMR6ekhTON1R+Li9CdZdegTFKHeY0YoWMYDW8zhxcI\nMz8AwxoaGwRLa8wcp5CbqNZOd1ilEGMSJk57OjVHydOEJ8bNHYVQza63kuNh\nIPZSaYGpmR66Ja4164mQ4xeQV7B4pgE99aIF/PM80wkmHHTUQPRrydZVSLzB\ncpCaXCtEAub5fRh8LkDzLHSm1Pi5dXlKjDbF8DyoYL4cBTrVPUO/mIs87OXU\nxK0UmhAPxbngqLuxiIDNwbV0HeLCKY9hcj9+wdWo4Qiaj0aIoHwrBnV0+0uT\nZJPh\r\n=fBcX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","browser":"dist/index.js","gitHead":"34d49dff4ba970447c184bbe8809a533b1146a27","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.17.0/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.38","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.39","@aofl/register-callback":"^3.0.0-beta.38"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.39_1572484083601_0.6934571951853568","host":"s3://npm-registry-packages"}},"3.0.0-alpha.12":{"name":"@aofl/store","version":"3.0.0-alpha.12","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-alpha.12","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2237d162fd9165df6ab6aa9b1b6a768d3568cc94","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-alpha.12.tgz","fileCount":9,"integrity":"sha512-rM1USCAjcPFgqNWQDVm9rA0aBZyU3r0869SzWJ2Bb5e1o0HW2wZIdyNZow3vA1YXgPQhn78v2zK0Ywn2RdXBNg==","signatures":[{"sig":"MEUCIAaAByEMmzV4n36xrdirkjHKk/fLvTo/fxyTDJQFm2S0AiEAwtkehJz20LBfsHGr7/v/Le3Rc8FPHpLNTh+CqBBHLTw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdvNfXCRA9TVsSAnZWagAAb2EP+wcSELiBFjPEchy8SoPc\nBOLqQC7RQrQ/fJ5GegyIJi++kMUMtr3Zj/tar5ZjtEZiICMZjYlBy4p0lDpL\nWuBHKTEY3qZ/kQaU82k5wLUYfI57mW8nV6V6TcmfHEi7fOaJA5dscImPDx9X\nd65RcZYoM72DXRq3Yd4qQtb1iS9PwZS3DoBWQt1it05MsdAnUGl0v634yKKj\nH/xugKKsHg/GI3TE4hhfOSIRnkp23Wy3gPXdG0IiIFswF+X5//SFiHCpv0tc\nEVBnzFMjX9IR6FMjFuDtL3x6CniibwK92cUbWP/RGfE748p2R9Ay0sjogVGY\nWqJO0lKtr7WmNRz0fgl57+RJqnGzJdonUv5ITD+PgjNyBWSpkwE3xXUXoVJH\n5zwN77wCjcVeI/Z3pcDCzC/aPWZB8WbRP/m0ON3nXDGNwWKVdKAkA5Eo1mbC\nGKyWjfAT+96nemQ8zVbrzPvmuzvv8mprszauR0qq366aYNYA8GjAGzOI083w\nQWF+7xhjdI7EyC0wMhEJW+2O+gk7yHnf/qW1PkGce0FbJ1en3ct9868WWlv/\nqlN0Anbrnrz6bMNQMREeT6WjoJk1LeG9iloiassl2+rvLIrH0UuGl6DxKl1M\nkv/wnvxjTV9jvZ1XwDHbDQjGrUB0ACBRz2tysTI8mFBVpv4jAHyGCOwmmw8c\n7NEL\r\n=KCVL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/master/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error. To modify store, mutation and decorator functions must be used.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, a mutations object, and optionally, a decorators array, and an asyncMutations object.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nconst accountsSdo = {\n  namespace: 'accounts', // required\n  mutations: { // required\n    init(payload) {\n      return {\n        accounts: [],\n        selectedAccountId: 0\n      };\n    }, // required\n    setActiveAccount(subState, payload) {}\n  },\n  decorators: [ // optional\n    (nextState) => {}\n  ],\n  asyncMutations: { // optional\n      setActiveUser: {\n        condition(nextState) {},\n        method(nextState) {}\n      }\n    }\n  };\n\nstoreInstance.addState(accountsSdo);\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    accounts: [],\n    selectedAccountId: 0\n  }\n}\n```\n\n##### mutations\nmutations must include an `init()` method. This function is invoked when SDO is added to store using `addState(SDO, [payload])` and sets the inital state of the sub-state. In addition to initializing the state object, the data returned from `init()` is used to automatically generate setter mutations for all the properties of the sub state.\n\nWhen a mutation function is invoked; the sub-state pertaining to the mutation's namespace is passed to the mutation function. This means, a mutation function can only modify the sub-state it's attached to.\n\n> Some rules to follow when creating mutation functions...\n>\n> * mutation functions must be pure functions.\n> * mutation functions can only change the value of the namespace they belong to.\n> * mutation functions should return a new reference to the sub-state object (Object.assign, @aofl/object-utils/deepAssign)\n>\n\n```javascript\nconst accountsMutations = {\n  init() {\n    return {\n      accounts: [],\n      lastLogin: 0,\n      selectedAccountId: 0\n    };\n  },\n  insertAccount(subState, account) {\n    return Object.assign({}, subState, {\n      accounts: [\n        ...subState.accounts,\n        account\n      ]\n    });\n  }\n};\n```\n*The above example will include the auto generated mutations `setAccounts`, `setLastLogin`, and `setSelectedAccountId`*\n\n##### decorators\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\nWhen a mutation is commited to the store. The store applies the mutation to a copy of the state and before the new state object is commited it passes through all decorator functions. Therefore, in one operation we can mutate state and calculate derived values. Whith this model a lot of the applications logic can be moved to decorators and there is no need for individual compononts to encapsulate this logic.\n\nThe nameing convension for decorated keys is that they should be prepended with `$` to make it easy to distinguish between state keys and decorated keys.\n\n> Some rules to follow when creating decorators...\n>\n> * Decorators should only add and update a single key in a sub-state.\n> * Decorators can draw information from multiple sub-states to derive new values.\n> * Decorators should always have a conditional statement to only allow them to run on the first run or if the sub-state properties they use are changed/mutated.\n> * Decorated keys should be prepended with `$` character.\n> * Decorator functions should return a new reference of state which points to a new reference of the sub-state it modified (@aofl/object-utils/deepAssign)\n\n```javascript\nimport deepAssign from '@aofl/object-utils';\nimport timeFormatter from 'time/formatter/module :)';\n\nconst accountsDecorators = [\n  (_nextState) => { // nextState is mutatedState and will become the next state of the application\n    const state = storeInstance.getState(); // get the current state\n    let nextState = _nextState;\n\n    if ( // we should only mutate state on first run or if substate or source values were mutated\n      typeof nextState.accounts.$formattedLastLogin === 'undefined' || // first run?\n      nextState.accounts.selectedAccountId !== state.accounts.selectedAccountId // selectedAccountId changed?\n    ) {\n      nextState = deepAssign(_nextState, 'accounts', { // check @aofl/object-utils\n        $formattedLastLogin: timeFormatter(nextState.accounts.lastLogin)\n      });\n    }\n\n    return nextState;\n  }\n];\n\n```\n\n##### asyncMutations\nDocumentation is WIP\n\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts variadic mutation objects as arguments.\n\n```javascript\nstoreInstance.commit({\n  namespace: 'accounts',\n  mutationId: 'setActiveAccount',\n  payload: 1234\n}, {\n  namespace: 'otherNamespace',\n  mutationId: ...\n  payload: ...\n}, ...);\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n","gitHead":"e76c3cfc8d75ca087492088254c9ef0e4010c0c9","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.3/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","dependencies":{"@aofl/object-utils":"^3.0.0-alpha.12","@aofl/register-callback":"^3.0.0-alpha.12"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-alpha.12_1572657110781_0.91839529294128","host":"s3://npm-registry-packages"}},"3.0.0-beta.40":{"name":"@aofl/store","version":"3.0.0-beta.40","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.40","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"4fbe7d1f76b99ce82bcc8876f2115f9627c53839","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.40.tgz","fileCount":25,"integrity":"sha512-8qmzsqts0zlMd7o/wqxsj3aEcEYV7xkLK/DH/bhROhqWQlfgf8uJcFAivfX/uUUFf8fpWbHEqlaBpOt+XyAUXQ==","signatures":[{"sig":"MEUCIE2+hRb/udfC9HAR9Wg/jDaAwniXMaUXiK/lqZ0U4rJFAiEAhE/QEmDhoQ8SxWDfWr6rbe2D2Qj5WZuj9e+Ow5T3z3c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80493,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdyeFBCRA9TVsSAnZWagAAF+AP/iVwsZ/Xs6QHMPmNLMWT\nEzq55ayHDZfasIHiI20UZnp/MQHKy9Zmx12BuNzqwZAoLgJfLTbuniIJgTI0\nRB3XPcLzvAtZvG9X4AQMzVXquCJ+1yFFCeC+PL1DY5fa/aCMEBss+CRnmZN4\nzvTJLMlUk4rLtvwLOHJD5fLOIKwP+nX49/L1ZCEnRbE+g0h/gQwfrg8mnGfS\nmpTPxNeQw5zo5ijoyV+b7CoFj0OV8Oer6fSvcik9MrdgIrjmkaHe9WSSDWMp\ny8m1EXW6HBzzXRLePlCVtAVlaO1ynURwcsFc546WakQxLPepIN25JCWR+eLl\nM7R/aEHDKwalVHJmI2ByDEQ0at4ICFxN4sB+z9TRa4GAHmuPs5Dr7pQVZhnJ\nPWBiVLYvhH/+dDka3SqFA2LxLkXa1H9DF43v5svuF6xu9mJNu9DDQwcphQ+u\ncvVbwpRic0GTAp+/6lRyIZSuCvYenC77kwS9OI6F1BtGyjV8ojTYGeGKU4Nm\ns5oGBl5WW6yZiJJayuFiQSKcPWVHn5PCm08Wym3SR/urdJyIGP1BvkQQARvW\ng4oMrJPpERgsv2Lq62KB0KUSZl1wFuQsaE7kI5HvAytkZa1RZsxDYaxTM9WU\nKXLPEPP+eJimtGD1j/pMmxgCms+CcVhfr4DHr2jvPYWSQxDR/qZ3528fddTx\nvN8f\r\n=wlUo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"0bfdc05f0d4406219d0b432a55fe53ab1726f4c0","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.3/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.40","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.40","@aofl/register-callback":"^3.0.0-beta.40"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.40_1573511489454_0.7959013604817786","host":"s3://npm-registry-packages"}},"3.0.0-beta.41":{"name":"@aofl/store","version":"3.0.0-beta.41","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.41","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ea6ff49bf8d2071000af0deaf7ac062575eb5d85","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.41.tgz","fileCount":25,"integrity":"sha512-JLhBic3EvMXhQk44VtYy64FeGR2TX/Hnocr/ikK4F9LEV3pb5hTOabs9/dhko3RVhjeBdpbRV7Be/RGUyoLTZQ==","signatures":[{"sig":"MEQCIGx4RdiokEqQX+yIMXiYTTPauH/oH8dcO6PDGVJxzbNJAiAZXS1kJoIJjeCLN0XsUv7IKZfcNgWeJoIy8UkR0nGXCg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80564,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdyjtUCRA9TVsSAnZWagAAH2wP/3bBptH4X1XCtDiBPUKr\nZOqfwIJnSnKdiyvA/7kSopjJyl1yAI7I+40q1RbctBN23GnDPoBVPED1WrO8\nbdmGWrbps2sJE1nJTh2RbAxWb0L/jsEn0jizGyjf84tHPpEz5LiVZ0sdtT9k\n8nSM3prS4OPNBK8QKNTH3GKLPXDBzf8DePwsM4iBN5cteU8ZeroZB7mZYcj3\ncU/KG4VYaFApySbbcE//UWnm8jhICADCMXeiGFM7zHoyIXRzXOy9NDjN85JY\nzAASgqhmpN7rw+zzUrLt0yJJwl50M4gAXgK+x4ET1YyltPgKwSBNYHncRuxz\n7B/I9d9F3PycY/T+9xJvneLvn5Rc12GLZEVwiI69guVxIVotbJWTwvhr6ygx\niI+mWLLidcoat+4dZOBaoPdSxD8d8l7falyHCHC6OpHKq3k7nCggvMfvDz7L\nPP1fynuu4nThTBdlLCi+McDu+/x07B3HHhyi2tabINOzu8wKHTTxl2romRxb\nVufN108uOkMxt8IjB42/vKXY9boCK4f+9PVrSEVe7Ch9j9R/x5Ud5E1Bbav0\nBnqqUFa3QIk2VDoQnGOmiSyAiPqQIO+zu74s6Fr0ioDeWiihmYpULnFvriPo\nVFQhFn+umbc9pzRuG2MjKtH+D2aCju/tiHUMBCvRnVMuJ6EUomY1Xca3n/8Y\n7jTF\r\n=wWP/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"212bc663acbda22a9679fadb2aa64484e35dc068","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.41","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.41","@aofl/register-callback":"^3.0.0-beta.41"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.41_1573534547712_0.012075754761603497","host":"s3://npm-registry-packages"}},"3.0.0-beta.42":{"name":"@aofl/store","version":"3.0.0-beta.42","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.42","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"4a9801b419ca47bc22925ca2f5d9a6de1a3242cb","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.42.tgz","fileCount":25,"integrity":"sha512-m51Yz1kjf36QuTILYuRDBG06BfHftDjmoUEVzduFEpDXw3IpgPLnkpviqIxanCb1TRmIjJpXSxFEk8EGDY2ICA==","signatures":[{"sig":"MEUCIQDK25HyiGdDNk2c7v+Jy+lqtJ97W6mDRFhbERb1VFx1VAIgYXMoYiUP3kKVM0F2QTariSgp2JgeYhSMslIG1nxRcCo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80564,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdykj1CRA9TVsSAnZWagAA0+IP/2dfiPwki0zmdoaJkuLz\ntsagbyIuSsQjK8+Uqt0GAzw4B2RpTGldew9IqnaIUriiCd0n31uf7CxfXYjU\nY4PWvlE2gawayDRRg63eiySYJbLH+2ui0zQiQX6BOrtouOYXV6qSnf1OBF9a\nLdosG5xGdT6yvmwVvfoxQwGDXQ6p12k298n+4JhuTB6B5wbQ+Ez2Hkdi1Xn/\nyNQYf0qq+jjY6evxUHeOr0iFZjE+IN7JHhRnMJVM3Mw0dd5pt3gifS+/Gxsf\nkbyij3u2393yr8XNrLAcBv+dDG4O5Z5xDnqVhTLeZ6pAU8U4vD0Qgd9jm+el\nygDwbCuAkKbpgIehd5zPYPD6rTS8S48eXXm8+RbZjzd4i5NNnektS2NbIJA/\nUX0DZ1OyKW2vWjMhdWmFR7qgzbdkMZSfhSy66iXQfbzps8S7i7jT5dKTCzzc\nhe6l1wppsly941OnLmjP5nFYEbbNUNirB57Din22zvoOW3PfvDJXTEJpvqvI\nCsq1tIVKpLMSKZN3fFhSQ+sCgKpk1qiLhV/do1wgMwGg9PJMq1sQEJ33MbQ4\nvevzo8DC3WoA5UH5tn7b9VlXfo6ARsU4l1zec1HSTgBFwkV2JMmaQ1f/f6Kp\nPZBEIXomC85ihN1lknizThm8G+8iG3p1X4fJLpvZ9mY2rXDdhejyE2vQo1YA\ne/wa\r\n=HPRe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"699b13b7bf651fa15a25ee2873b72d9fa1ef14a1","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.42","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.42","@aofl/register-callback":"^3.0.0-beta.42"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.42_1573538036625_0.4512121227228949","host":"s3://npm-registry-packages"}},"3.0.0-beta.46":{"name":"@aofl/store","version":"3.0.0-beta.46","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.46","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c7829a9c551071bc5be1022aa83210c2be690609","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.46.tgz","fileCount":25,"integrity":"sha512-QvJp8zCIHqqWkC2dvzomgW1eZa6rainyL+4akWt7dShtkGe1Swqnq0sNzrbfB2c4bRR0EoxgfUlBbMJt3DW8WQ==","signatures":[{"sig":"MEUCIHkzGjZ9s6SMYAwkcSV+9u5FePSiVa69yAXF6pUVrNMCAiEAmpdfAfdmnYpWsRasR9wvorqnBHyflTeLKvRCdeXcKpI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":80564,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzc4CCRA9TVsSAnZWagAAlMAQAIE4QbSjOKom6y77jR1E\n+BNKtVemuMYMkcK6bU/ACoYE0RkTyxcuHV/eKZvepHqUG+5islz4QgyTclHx\nWrI/VglCG8L0UJZIW87BVTL0uIpcgOhDTvHDMVspsztuSCfThuEAYajLYanS\ntie+4/oXWUpo+Qtr4fAvQdCgFLScwNXTPqZxcU+DAQS4WgMhquRJSvgaPU3u\nM1/nd6B6+fQoYpX7NvjwUGkE/6iyVP3KP1KL1m9GhDXYE6153u4wde5bngFm\nxmwsx8s+G/KjCTq/M58ehXjKXckPjYzQhwjvozKvwhF6bYni7xyOrRv/8kMR\napmv6eqHLUcDf3YHaj1oScjFo/varaHG7rNIigOH9JCrQsO+w7d/K/N+1Ww1\nxO2MxIE2GkjwpJ5QaDcVfFc8vXM1Vp9DgCSQwXzwO5S4odKSb9tmo6NzO/MC\nCkz0MsyiD/mjp7A3MotAzzNcFBrSGivEc4dlOD9Q1O+nkYxjYDN2pTWLYwQe\nXDMbGlYzZ0F6cVVC3EynKaUzWKGBKmhAdbSVBZnGNVB1LZXDMfpLvcEFivXl\nOyZg7w0coZRuxFsLoA1ldgi4Pi1dVkvs1j+uu5EFwMBztXEOTdpyMv+mINco\nhZnKW3R+MPE+WlKKZAgFBqg4LFH6c6qCRDA59FccZVdbohYNNsFthL50BZR6\ny6nk\r\n=Y5BJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"4d18597a6b3e63324cc8b2f401d986dff832a62f","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.46","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.46","@aofl/register-callback":"^3.0.0-beta.46"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.46_1573768706448_0.7896264452444073","host":"s3://npm-registry-packages"}},"3.0.0-beta.47":{"name":"@aofl/store","version":"3.0.0-beta.47","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.47","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"0ba4c73328c0c7ca61019a561afb2e006af0bece","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.47.tgz","fileCount":21,"integrity":"sha512-flJuFouaKal+RuA+A+Yhtaw0jC8cAtJTjHibPNsbucAVTuCHuJ+l7ZpZyDTmItOcgAob+v0BZBW+HUYS6qrsAA==","signatures":[{"sig":"MEYCIQC0BtFUT7S8ERH/XRBC0QzN5rm2HrSoxv4zM9vqGKIKEwIhAMhIP3YOCCSOIRS/fCyInH3YWmho2nnsrK8+rvUVRwcc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67459,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzfX7CRA9TVsSAnZWagAAd1IP/0WIFAR7E3qMVRiY+387\nRS84yxotAJxORgWTPSxyjFRkkmhfs1TwgfSjitaFQEdzychthJgkreOrVypR\nMKAyWNyicCWn2oZMKbimTCzhXNjJm+cKXl3lP5VHjV+z81fMaZzQkG9O4Wqb\nDy8XySC1V7X1+fft1yZabAdbSZOMLSYeL1bvMMPjPRg8u5LXXvARWr/U7F5X\np7JopnKUza4mBag7lBlIGwl09tGboK5tdQizRgQpUZBUXuK9A3CmxWWXV2sF\nk15oro7rQh2b93Tc3iMrBcmzfu4oJlXjAB9g2zTsbXDnYmTsJ1oXk2ByJIM8\nVcWH+IUjweDbQS7D4TPG/ByMV3RXrCN3RJAzQZKL5KZLSEcOY4IoI5WBd1XK\nvwVBgt9CT9B9Yue+MGYlwGiObEVGw4smf33AEFTwAJUHrLRPlCZyJHAP1H+O\nna+vDVkHDJ2Yh8P1Td1tQKHyg196BvRb5O/Dk0hOxYLdW8z4H9+ihslF/k42\nT8JlT+gFcIMiELU6nNpMpYshQIfUNk3M5MWLSG0WZA8in9XAEKErbmra52n5\nXnT2gBfYpggQ2UAssNCA7rHnz+/1rxJS3p0UlYECHNjTaQ6K7F5b7IRSvA6T\nLJCTu2/eM4McJChgo5FM3IM4ZqPYsM/2M9ZMWKYrvWE2zuOmZ4UBaC4bQHeH\nSeaR\r\n=0wJQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"11344382e361206a6f67f05f4904149ead37c1ed","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.46","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.46","@aofl/register-callback":"^3.0.0-beta.46"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.47_1573778938840_0.9974826206952132","host":"s3://npm-registry-packages"}},"3.0.0-beta.48":{"name":"@aofl/store","version":"3.0.0-beta.48","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.48","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2282accd450981f8c09f619417b0ec66bae78175","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.48.tgz","fileCount":21,"integrity":"sha512-SIPmNQiILD1F1/RjAicCIO9W+Dl+oX/yrPNKv/5JArfrMuKMXWjzQTxgeJQldcfDG6rjJK0S1XgTMVQTw/CnNA==","signatures":[{"sig":"MEQCIFVZMh90QaOFr24/JdafSufYXZXiHSJEy1Vdb9rN9RxBAiAtBdT/B0/EXKnEHG62bkM6YGVFhrLOqkucasHDvApFow==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67491,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd0IfrCRA9TVsSAnZWagAA4DUP/AjJZ7tADAYCzM9axCKm\n+aOMds8PXSil6SdJJWa8/sEFlBjXRK0IfyHr9fnR9mSiv9Mc9B8M7dB1y5e6\n7eRVNQOM7z3OXFbm8YI9WSrvfhdNVwzpNHzimCuKzt79Lr6ZbJLM98lwDUiD\nQE4dh15/VzD7Dj3aTiZs+ZfOpjdCTnoz1XyCHqNGjWN7WBE8E771Vd03QsDW\nbj5DNBhSyDFRxIFJZwCSycMRC853AZQSH3/xSuVzF+NDUPABoGPlNjLBSDBw\nlFYqjS6AElmjwCtwEHYXqoYwf0X26g2OoZkMD17rt0TrgfLJArYahdaLVSu8\nApFAaGUj8dYwbDaAUULGjrqikRDntM86xCu6q3P71edJdGCqThHvnw5Bfr3q\nJ/ca5CmxwRjX2BCzWsSRk/tiwas438E79AE7dfnG6gq1LlsyyxUpo2yeMeqo\nI7ekc5FI5ri2Sd/+3MjclsgaOOOnR26f2wl8CLyxOYdF8KttiLtVcqGU2GAv\n+e8whEPGfc853HPNOQfg+q9u0qw+zvVN6NpY/BcRrFGCuBQ1oqF3nOYh8KjZ\nsAxq+dkhckwkDk/FVmFE904gkLHzbST2M8elGBOWdTyKdOve+t1vnnablczU\nyvZwvb43o3YQzVxJgalCosy6Nfbvh/T94zw52SBm2kED8HnF4jiEnYeSQZBU\nr8ZS\r\n=PLVH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"d77a51a21b591d1ac0032de47395878116e8566a","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.48","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/object-utils":"^3.0.0-beta.48","@aofl/register-callback":"^3.0.0-beta.48"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.48_1573947370550_0.4200619329858437","host":"s3://npm-registry-packages"}},"3.0.0-beta.49":{"name":"@aofl/store","version":"3.0.0-beta.49","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0-beta.49","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"e8fdcc5ab398bc3f48da1a70e891bc2c3ab9d29e","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0-beta.49.tgz","fileCount":21,"integrity":"sha512-ywzwf6jmajYBi8u88zAnEfPB7oRcQq+ZKOTFqC47h7mqXA46aQVs+aGmgAsE78p6Xa8hgsKPRNdoe+TKYvTqHQ==","signatures":[{"sig":"MEUCICSZUcp+/pWWf+pgsjoeDP9RaXAVwqXGjiN56gEiGebrAiEA9wR+IOWRZy3gHHTFHxrkEq3/DRD1vefekREBYkM+ip4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67416,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd0MCdCRA9TVsSAnZWagAAXnsQAJd4XIwStZeoMaQhCRAL\nkMa9YWMd50mmQzbzYPYZa5wfW2YQ4WVOKJAM21vmzKcLbWEJ8aYv7P57GjVw\nwa2OMn3dKOFvlkcjJc8GFvnr7KpYdPFZhqsrEk3/xyxcUX2s31Lh5iehxU13\nTn2g6wNslIn/Rn/4fXRo0I+z+pS8QV5ePtNFLJH5bPHvm71mwqjZr5+UT7md\nss0lSxBGye/CBWBvry5VT4lNt1F6Mx9sdiL9xGLZjI211C1sFiCR16h4y5Sy\n9cWPacUhc0vP6AcJCbXKKklUXf3VoQezvAS8yrNaAio2z4rPawlBU1VArP2T\nvwgPRY1plBXw6fykXAhkZUslwgrGXyqalqfG6M+8/kjfwnluychCj7GZmXG2\n8X+8DKkV1NOXKChmqAJXfudIWUYAIyirpcAZRHsle3VHP2w9UgJBntoO1t5e\nLN0D2Xq51LX7xmHRg7Os4hXKh+VLAnqWmMsM6zRO3DkMsorup50qShOSItKF\npcLzQ2BZimrO0XI2LEsgeoQ/VqPBYXJv4uBn5tMV3aCsw/+3b7Hz4mWxXlum\nPQdnu5/NbN5lcx1MvAjNNmJaDZPYgbtmrtLANXSoFkpYtMPrWXBwbSZwN5q5\naGGBnHQ0JNq1RrVjvImJDH5zx+akzlKSUUu49XgWg1TNS2Pj5s8vyLgoRguc\noL8m\r\n=Whjq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"a2642ff8dd100adac8db3d609f63e2bc6a2247f5","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.49","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.0.0-beta.49","@aofl/register-callback":"^3.0.0-beta.49"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0-beta.49_1573961885086_0.65792870914768","host":"s3://npm-registry-packages"}},"3.0.0":{"name":"@aofl/store","version":"3.0.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.0.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"905c9da8bcd136f7fa9b3d6f2ce1f1508ca08293","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.0.0.tgz","fileCount":21,"integrity":"sha512-4WNjRcmDm4KM8Kus5IkqZUPQqnGDyB85Lf4YpPJt3gEwV7bQom3J6bft4LgBnEO9iW6dsj3IA995J3Xhm0o7ng==","signatures":[{"sig":"MEYCIQC1vxE67G8ZEex7gdDP29Cf9xnOBvmT+WDSVzIQ9dETfAIhANMvOh7o1TgqVWh8jy9nz4kGr769tKDUhxksxkN+rpm/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67384,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd0PFsCRA9TVsSAnZWagAAzJAP/RtyzT3vnQQ5O6TN0Tvm\ntg40ShRFqxxWSSPh2hJmlFBLjWumr4cMTBe2rtVwRq8xFsf/dIWV85edR65y\ny1CW3CQCATKDbSmrcNdsK9tiWXdeLJNh5an9AcvV/PrK54Hy1pQASHnkXNG+\nGBmrNrl3J1XtznNFpyVCuYUPfpCQlKaGpgteYwHvBiwCW9bVWQjdiUhMfx8t\nT+TwluagytyFOnmvbNLMVKevMgr7sorQoXa3FzmR551ZDEyLeWnxSwlrVoUB\n9L8Ia4IOXvOLDH8vKykB8OrVTKNN/vP1d3/SL8J8EOgHuoPOolH2X6LKuySP\n55X82uhrZxkAiEa4QgKOqHTwu8Vqc2s6ZLFZYdW5oQKTWLOTH3fgGFlYsxOg\nqAjISmpW/r0GBHi19n8ObpXCTMJ9NilrqGpPSgBH5xeODR1WUg+uHFViulNq\nDyqTzETocdqNThsX8qlT88czfdyB1EhHx+0EeI45trkeSz5Ooh+Rk/Nc94lN\n6+FG4HZVkFxVoT8u1BGVS5jZHUVH+WM+JP3ZuotmwhC5LfrUJMjt3foJ5/Ad\n39eArHJ0xqjY32FAE7vjh6z4FDsdBa0kXgS03Kv8h8sJPSr5+Y3sf+c6SNfE\nDzWEhB/ypZrlV+Kpt7kdEBbnyqsJB/8RhEpiK/T/5G6KYNJjyhnyCGfIMt8Y\nWAmZ\r\n=ezMt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"bd783440a25a2c579fbb506b92d90bf4fb7e0289","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.3+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.0.0","@aofl/register-callback":"^3.0.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.0.0_1573974380193_0.2536547231551618","host":"s3://npm-registry-packages"}},"3.1.0":{"name":"@aofl/store","version":"3.1.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.1.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"a30c47dad47578f20f320a4270d070afa2e9833f","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.1.0.tgz","fileCount":21,"integrity":"sha512-3yLuoHK2PhEGfhFbZi9flQJ/K5dw+ZLKZ9W0bopHkQP+S0XFcAt0/353MSTBAkna3PKyQSMPns8YmyQJ9sJJQA==","signatures":[{"sig":"MEQCIFqz0EZOmcmA/ZKcYERdG+ibpTIVGXTuQRKuqu6s5VHHAiA04h0GEALfxZIGnQ0ZUfSp6H26ZkvXGnoLQZdAAD5cLw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67360,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd11XhCRA9TVsSAnZWagAAXJoQAIoEBR0j066AwyYOKdlG\nAl1raaaYFzAZYiA0t7TPgtJBUBkGD4+gYYkkKJWRYSzJUl3WsNjV4ok/gpc3\nKUM4V1Hx8LQnjkwd77vaxTuVK+7+wmyEk1JPXKRpAtD+fr3yoZMVZaCc33Yl\nk0XOxAFUE4zSyHCgeCaHTV0ukWfM/S1NpIhsCL2XMaY5gDIIofzNu540prXg\nocSwTLDgtpK8EEOghthzK3U+KzsvjaTbXMzCIV5goWL2Zsds6xK15hpMS1J6\ncDqR6TL9fS5gtRnGYhfq0WHOd1KlZgSaQ9K2WHUPRXIA09kG4ILePoGvq1+p\nbiGipztUW0mdM/bwDnsbtP2nqRfI/USBARaB+015jtouBuyViCwtJVkmsZvO\nBlbhMARgd0o1mQfZBQ0FO9nz0uBRQAy/U9ulhRJO2qOZwckyE99Fg+YT3EMN\n+/4HhyusR+Lx+m6bcdAp/7+EiqWoCN40mQAfklIHAAQOPEcpGaOYs3km3rLY\n5aLP/3Z8+/MmJNcoK7DPcdjTf0DxN3Bji87RK8gsssxEd/ArEv2bhbLDnnE6\nHzHzxhRQXtXbPLP8hWRxOd5YVeRV2Iur1lM7t5qU0VWCLHUvWaE0JwsjPxvZ\n9dhUQ9G23Dp8z7+7zRNY5KzmuEpets+jNkksfL9ltywwn1LF5vfRjVgcbDzw\neu64\r\n=yqUa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"cb7c610ce117e6fe41168dcb3e2758d12900b277","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.1.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.1.0","@aofl/register-callback":"^3.1.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.1.0_1574393312898_0.0696674580943093","host":"s3://npm-registry-packages"}},"3.2.0":{"name":"@aofl/store","version":"3.2.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.2.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"e2b552ee8a572ad2b57cc09372477487d857eb4c","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.2.0.tgz","fileCount":21,"integrity":"sha512-p/4WctF7VTQhDAOJFNneCPMhQuEHeVN7WrBxkrb3ED91teUjqOPPJ4J+Z6dgX3tm2c62ZMAd+iNMWLyu3SK52g==","signatures":[{"sig":"MEQCICOSKSCsRo5dgAVbSGY4MW7mjYhqGW6wXwHBQLShgkV8AiAndLn11QcijrxKbz5BcXkX3e7GdF9eirWuIvQP1Kgypw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67360,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd2jKpCRA9TVsSAnZWagAAX7UQAJ21bGDbfcBM5Ui3mNBQ\nf6tI0NBpQap+0Ksm6H6aRUSnctnlNl84Ja+NYTYl7ILf4PviIA7uUKWNa5L7\ni54KqAACNkiMMAMTXkTWVPMi7LPaW1acZk+l3Gy0mQtgG1vSEgxe9wwJo07U\nKIa5+IAkmhEJillsvWboWlfFjOwzyidmplwWEZEhLov4caHsp2uEIQSWTI2H\nu8d2bdo+IDiWXFl/78/jg68gHObmFgy0kiGnTbhJXPR7XJK8Ir2A/jhuf4H0\nZVkYQrAjmDQl+ewfhiCPzfR1hMYfXIyfZrCzJIHVFnLC55kWPM+Y4G+OCIP4\n4o+xe82gDsbRL4QaWyH6K5oACGhA4IyhMqB8EVKdsNQjmXrqtTO566u24HdK\n5yQM75Igr54tI2BcVnX+HUmlqS8wsfQCDEsf9xaWLCwto2diUPPHR264aUWJ\nPTKrKBQLDiX/Gc6T94eG5azVyhJDVipUecEMdfwJ70rZ59HkcWeG2FU4deGA\nObsIuVhW738KDHK8WTBZPePf1t7peHCEu7CW0kMgThR+7YduYNOLPvQwRFhi\nY7sG0c7oqZ4D8mXCbO5LOs3avCFsjfvrmyZe+N81Ui0uK5O6S0fKYp5co2f6\neE86rSxKH37KLn3fGuy/TVWHdI9eOAnAieubHkNZFyiss6CxuzCQXcG5RVkL\nnQIM\r\n=ZA6A\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"8275111725390a8f797467a12e045c905a78623b","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.2.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.2.0","@aofl/register-callback":"^3.2.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.2.0_1574580905061_0.09938202894785197","host":"s3://npm-registry-packages"}},"3.2.1":{"name":"@aofl/store","version":"3.2.1","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.2.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"3bc88b9bf8bf41c5bd81658a8db3370880254bb5","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.2.1.tgz","fileCount":21,"integrity":"sha512-kSDIARbBE7GLAaYfmFbJaFD6KRpsiGov11KdFFBSU3hQXVqUfe10vQTpdlBD+SDDYFvO2MDcSNbRyaFXF6gkdg==","signatures":[{"sig":"MEQCIH/OwhAD+ZbLRGDaUw1XrEXuT8N/jDXNqu/WRfCVvbu0AiBAuBHugQYoWnPnUU5hUMCF46hgmWYlPSIXLFqIFDzsLg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67360,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd2jlwCRA9TVsSAnZWagAAb5kP/RjGfJAEY4Bbc1HWfDYh\ndpbofBGiOBwhlAroxMDw4HsYc4aeqIDB3dN6CWAPkRfRHZdlrFm8712xUFWA\n0kJI1hAfkLaP8tgQg60hvAWgq44sSRK/Unjq+0HjgRsRpXB3h5HQylsyO7Lj\ny1ABo90l9f5FSfLIDlBihQMapiBOvwmsfuF9IHvEFbHk5qUeKgAjGDyzu39W\n8DwnzUgaBWX2/wIhuUPJtvFXv+yVQOAZcVtZD48yLpH95++WmXdemCo1WiUF\nAL9X+VS1CI8f7Um/V847kumGklenP61We1zZlnHohQv0NTEaa1868vda9miG\nFdRjkwKkFg0sIpiCP4NF21Q7pAYA9E3LWamHX8IydSx/P5SDLLb5TeLQSMPW\n2jc/h2BdBRx12elhDo8IaWxtUr22WTJDK/FF0Pw2PHfukefyH7joFNl+BA5q\nonSORyh8qIdWPbcIC2OiHaTTdjDW6ua8+Q0dyHoKYs+bwNrNMV6Dc4Y7k2lL\nirCvi5TMDboZU46wrLxno4XRfQBd5PhcDz7EA+PS4kl37Yl36iFrtsLWG7qh\ncQYWaYgJzXUKhYpyS4RxgXmZT5u/cT1WUSlzEwnMHLYgHBxq0t/zDTPeGE/V\ndhFVKYz69RTZLsTi3DhqFbrKDt5X31zotm8XiyqEc8idv9lioRa+oY8EAKnv\nS3t0\r\n=l+UO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"a3a91753b98e4423d9fa5bc05d8cc8f8754fd040","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.2.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.2.1","@aofl/register-callback":"^3.2.1"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.2.1_1574582639667_0.010463064716387693","host":"s3://npm-registry-packages"}},"3.2.2-alpha.2":{"name":"@aofl/store","version":"3.2.2-alpha.2","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.2.2-alpha.2","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"677e6f4b5469349e4b64c3a3cee4b22649878764","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.2.2-alpha.2.tgz","fileCount":20,"integrity":"sha512-jf9Dly54qiHNNdpfuBpOUbjLMnuZQIe0KRP5HYYcqSr3qfTcOp96C552sz5dG+d1NEhhhzGi2fLapJPS/McKwA==","signatures":[{"sig":"MEQCIDFSyzdEiyvkjLR8xM88lXBcDa0frT4HKwOi+zoS5hN2AiAzTkr5JhfEtpc2uOnKapELNbwP+RQW5w8QIQSvmcrLTQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":66278,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeHiQ7CRA9TVsSAnZWagAAN3IP/idhIceUbORx5IdOoD/3\nBZoHGsECMdKxRBsGaizH8fzJVsv95T6etk3G4CLMO5W2qSXtOYuff/tjBKM9\npNuwtz8sBA1uPm9A6Fpr+SlqYTrWR/Vk8iHPo/8ya/MquIWGahzCSB7cJ2IY\nJu6SOpB0EITgqUeVBAxLFUXOCl9y7Tkdt0fcI6RTkYTZCrQR62KEX8JoMcVx\n6FasYFVKNnZNCpHfS23Fcsw8GnGchFSfEJkNJnwhRNtU/2RUL0Z0h2FKbHpv\njkVkSbURcy3Y58sEbl3bQoEFa99z6Th+7QVpHiRmRYIQ8KjIPBNLMgJTQ7bh\nPwlmdPELfPlOLtmKq3FkUOsL+Z8XDErbq+0OUtf1RMFBqhUaUXKCOW7P7srH\nndhpOtfiAq9roCXHdKk1ox3Mhm7j8NTwN/gHavnD8/B9BTYxOTIeHlIzle4l\n03WtJSQq58LjWdvRKJStdf8K3T1RRzCS2+7sSfLsOPAUFQdjY/OH1a4d7INZ\nEUWZqSJ/Bn+BXcnRVSGU3VHYzpcz3RAYOOl8hbJLWvXCEuWB8NSlhFnycvn7\nE5Va7y0D/PFgiBG1Uu524M8MEd4lz8SG4kn8s7xaOogYWhLWjJHOn4eNMkZ/\nRKRBzgbFGbh8LUbNM9p4VHvoW2DyUmQYfVLIjU2TmKy5sGfWb67Z9eyAUjqB\nyCd5\r\n=wt/Z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.2.2-alpha.2","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.2.2-alpha.2","@aofl/register-callback":"^3.2.2-alpha.2"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.2.2-alpha.2_1579033659094_0.07799187233469129","host":"s3://npm-registry-packages"}},"3.2.2-alpha.3":{"name":"@aofl/store","version":"3.2.2-alpha.3","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.2.2-alpha.3","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d7b55273536020ff7c533c4a1cc5d14f1eefe925","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.2.2-alpha.3.tgz","fileCount":20,"integrity":"sha512-BHIiCfISBrAjZ161DHuMsotsPFNQ87fFKntvg7C8ywDoztB/0EXBEPmvhoSTogTC+aNd9zd2JR6E34/5YTzyGA==","signatures":[{"sig":"MEQCIFtDwIlmc0UPQgGquyNur6ReE/b6izE9y2vt8+yVDp9vAiBSpmY6DdBq02w+CV99a60WEZ+m8Cow0lMW7PZ70HRp1A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":66278,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeHi7cCRA9TVsSAnZWagAAzK4P/jTbLEfz4FbDQGg4kwXH\nuNJB/LjS5y3CgoFUDwkvg+FUF8j2hx0aVeonti2QLYLPgdVVsFh0AzfPEpMt\nS2c5nh5/gbOwGM+mTOsEzG6PN5DrlK2f9o1cf9izktrIGezwZdY+3DLNsNv8\n5EBepg86UTxGiv0524wmC+/szR9G/8yGKUM7nsWYiegV8F7h90/WucSYRDDI\nXvkJHgRxtYo0lIsPW0htEhZgeGdIuTv9zEGmBWIo1GAl1EfpDnQK6SOq1HEu\nFB3rsKRW5e5dLhRgr7Tdm4Tm9FtUTJjJjAt9rDhq06PzZ4TczWcOKLLxY11/\n+PVt/t6zdlkcm38qq99Fel/kuyVkMKtI41RxQ0bTwFYPWlXHGvo3VW4I2hW1\n5jVYdp6FONBQNLLyAIWsb0Yd4TCKbq8EMYIHfWqPXSLysSV7sMxw08gwNsPo\nyUKTrBjRA7eswDIVPogyFVs9QMs9Ych5e3HscZJ9i+Eb7gUDwc0D0AZknsN2\n1yMoenqNmHZoGf6h9BN9v2j3OQ6KTpu2FeiDQhvHs38S0DZS0mm9QGsoqUU+\nC/QENF1LZMv1vegPuzeNwWvuQS8NCjkomycEr3h/oK3aKOTBgq0HSNkXEFhL\nfnSqkC2832bpNOpiZ2w8F3u82L9yoYXVUG/mOVAhKzcfIvfTAiSPYe8eUo2R\njYbx\r\n=mb2U\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.2.2-alpha.3","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.2.2-alpha.3","@aofl/register-callback":"^3.2.2-alpha.3"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.2.2-alpha.3_1579036380376_0.2151296187939824","host":"s3://npm-registry-packages"}},"3.3.0":{"name":"@aofl/store","version":"3.3.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.3.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"7b7aadd2e79bc7d95932e8558e1ea07b924efd48","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.3.0.tgz","fileCount":20,"integrity":"sha512-Gp7YtTrObTV8oMz7peLyNng6bQN2ybbqU095tj8PW+TriRUHoxCL6LDoQmyyN4h272hQF17EnoplykrHhzeAgA==","signatures":[{"sig":"MEQCIBGSrFIA7TAM425le6279RXq0EvsG7Mg2smbJUXrT0waAiBHIEo0tkwh7oB50i5szgnusHgXvZfI26FOXvaxC8wHow==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":66246,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeKNtECRA9TVsSAnZWagAA1YgP/RUaEoM/yJ7h7IvqsEde\nEeuoDoQy4dB8mkhr37Xhf3gFfauXyjb7jiI25ZV7SZIUj/oXnPdNspEyf0sE\n3lRRLuhb6+486/cnpgLawCjucnhO3EY1qHUCk16iVSNpYuAuCoI5Gh16H922\n5xVe5k3COasW2c9BHWLmBQZg7bffg1wLTDNfAkfhLzVnquivgbm4Z4PZQe03\nk11D1GLGpXlV+650O7FRFPKc31wa5xdURegk6nOmDgFaRG4rMiwhUVH59sSn\nSiur5pb215ENwjsGabNKPPg2R8HpS+WyB46CBtjwfsX9lHd5NAxQm2Rul3rC\nUs/wseI8HTg4mUZ4RUHnCIfo/zYUSUZ/zPAyCLqmfMdRti+DHByhqwZuEneZ\n0eBiV3y0Rirgx9topxkXld3OF2BvxAl5pDAaV9SPDfjrJCk/quH6OhXiHSyV\n6SW4R9x3cccfeTrhKfDwfllVd2Oj/YfwsKlIbkv9xW49UWSSRkXYhTbqzWMK\n98Pr4qvMt0dlxowBAraAAP59QSdPysPSXb2TJCeyZ2EV+fA+lkk9jE67PaEb\nJQSwihpV2/xrZ6C2AxVjCE89XrHUnnRPPfagt+ct7WKNXcpPYRuJhTA84w3Q\nJwfZkvM5SjQnuVUKkNgGjsmrYDNjysuzohJyMnPNaaks8F+ciJ8ITwTjzyUr\nOWa+\r\n=H1nz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.3.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.3.0","@aofl/register-callback":"^3.3.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.3.0_1579735876368_0.3646009629831326","host":"s3://npm-registry-packages"}},"3.5.0-beta.2":{"name":"@aofl/store","version":"3.5.0-beta.2","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.2","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"47d52860360eb504384e43647c20e94df44926b9","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.2.tgz","fileCount":17,"integrity":"sha512-OZPOxQyirq6djB/va1WhPUhhhKwS5z0prvOjTDTZa3QpIyaMRaIk58uY/H9L56f6/j3zLsz5DlgeMPTdIQ1gCw==","signatures":[{"sig":"MEUCIQDYertvs6Vng/vc2wcHzxaF0qrGCPdA2srkQ8EvcDT4aQIgQF1yJq6ZwoV1aWmdL3hPx8VQg9UhuXqkcHkaPZ/XYLk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":64137,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUb7MCRA9TVsSAnZWagAAqUgP/3He9CNsUTaA8ucCM1nG\nK59fjCgmXl+2AQfC0nPEQkQ/R4eNZaYol/K6r7CVNS5Q+5JFCJrU6icDB9kc\nD38PgW5fhHFHNpkQ9Jq4LXIoFP73E5G+59Jkh8QTwS1H4GuIwnIkhfr3MAQ5\nWYvPgYGOe6L5rmBJ0xx1wrIqVJuzCn1EXizpkvAP473T80dXdE+hRVrF4fzQ\nViaoNW+P524a156V9mHmie3M7LttsNDIzmBcVW48EYMTE/EnWabmxlpD5lga\na7quNo1PDC+mFudwYefuIWOiWDjNqHoZbqykeLRlT7bzafkzXSc67DRF/++P\nG9kJ7dgHT0QwgfXCIPOw0yyZ+RAa9JJMtCpJCdqLJ1VX+HCxP/+IjYtioE+p\nF+urQGG7imdiynqeNdDGHQu25AYyBbm3/iyDT8eKbST1U6QBvFFoFL56NdKD\nh2oO7GOyN6PwwQjL7V8OVYnMFJewwnRB6bjT5/Oxer8fOnCgKbbZpHZ7RNXV\nzhFrYSiKHziYJe/R6Q+wR2MzjTp3MyYRft7W5g+K81MnSDC2JMpOa+kVUaKr\n7rnCqGVN6ubfyO+9nFnvBeJJfyliUWVF6pN77U003sYKkIZR95S3FQuk8y4d\n1/+kkEV4T6/2q3X5o6UK3vFOFzWJlQk3IHAFij1hW2fePFiQV7bR10sl+n6/\nVYS9\r\n=1R1M\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.2","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.2","@aofl/register-callback":"^3.5.0-beta.2"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.2_1582415564473_0.8380652324765543","host":"s3://npm-registry-packages"}},"3.5.0-beta.3":{"name":"@aofl/store","version":"3.5.0-beta.3","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.3","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"cff9107c0aa05ee1287d01db07fab0e7010caacd","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.3.tgz","fileCount":17,"integrity":"sha512-RkiGfLNUH5kxE9i4s/t/LGqz3wyLN4YnO6wW5L+y513nYEt0+ISyAGE3w1cGZaehZnYoahcpipTrvQOXPpkfaA==","signatures":[{"sig":"MEUCIGxGK3Y4k8/n34QyIc9j1foEDGRdLgGBxfEgccgF7zzeAiEA2IZ/byELkGbCsGTjtHgFD84tokoTeUaJONg2VvZT6c0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":64137,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUcI+CRA9TVsSAnZWagAAnxkP/R1s8s2EJlKnYzurcbia\ngTeIhquROKW5kAz2qSX5w1eRyJ7TwEKqwLvj64KAjOxnsNPO1+Xg5xSk1+eQ\niwbzUwhG5sCkMo20+EiE2JjjQeI7OJANXX41VUhNhnCR975hrrt+fWr4+9lp\nofnTAWov6s5dyPNiTTucjt6fF4KwxdsgWfHxjF1DifTY/tnRPcYZZsXzheV9\ndk4aqv7nm7VVAdkMLq+omSz0WA7X+/dE0X1EHQWVQPFRGP+DDpw7rZrEmFY5\nXMmXmt9gqZxoHi404SYkygNDyxA7URdOaG3RQWmQQIeGan8zz9aKrfP6hIVh\nTZWg8XBcvi71Qv3iEVMXXu3kS30q1lSAF+SPpDiWct04AghwRRyl5xQs878I\nKECsJzV75zttd5bUWLGNQfENPdXuq86CKk78ybiNhq+b+wBGY9MzGW5LoAko\nxR29iUiJ0a9K8gXyRtugvXdpaVjYTSoGlJr0XS31SIuKPslUO8MAOWVb+ABx\nA8HVtF+PO3CeF5RgAv1+WZhHR/oKDbROCYbiWwnlkpyR9jYZ7od7ISZYMwnC\n/eDsrCHU632fQfsLAW0JTkbSECth7XZdCMsd2YzPjOl0Vgf2UyrjC3gtFfDE\nB0Xlh6Lb0zzxG55ytTJhtQuoU1Uf1DjXmQff0COZbdHaFGjg4UWA144K6fwz\nuiH9\r\n=TJuh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.3","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.3","@aofl/register-callback":"^3.5.0-beta.3"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.3_1582416445882_0.6188764358114058","host":"s3://npm-registry-packages"}},"3.5.0-beta.4":{"name":"@aofl/store","version":"3.5.0-beta.4","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.4","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"0da8ba9ebe6e0943d214260a3bd1f23687df9eb5","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.4.tgz","fileCount":17,"integrity":"sha512-4AldtaETT4Mn8C1+AQ54R7hB4q2+W0EpwhLlFPVHE+XzHxvUxnbC8jcTmkR5/MfL7kG6ZoarAPcqNkQur4zFXw==","signatures":[{"sig":"MEUCIQCRvcu45OFF2iB2SkCLTTVElbnWtXh3WEylAv3QddOnhwIgH+P0BfQsnLOUaDDvSx4rPlw5ujevJfzNs1bAE7dbVww=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":64137,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUdwLCRA9TVsSAnZWagAAQ38P/ixMr9oUNpa7o9DnEV1W\n2OxeTeQhCGQpuH9dcJhznJTvgE0bfvnNMLjIBK3uhAlY4TgX77NuRdQxeeYM\nOANjqJDti8Ao3q6h8wFQW/OKkgzQt1m2bTCOb3/NnVb8fT0nWqPw00khfkYd\nkXNZwP1I/0DFv484X3eGSeDGMYNFgeM/irXtvsOGUl8q4Glie2R0cxSU/7G6\n0pemq1oUJw7hfXjW611hS3jQ6ACPkKqI1vIsMSKmyf5pFkE4XAzFtLo7EiYv\nlKy1rX1vZfl5Ehphhmi6ovMhv2roNlEz10EfVA2y1hCcEtg33swidZrCGM1G\nNrBMftHpdpkHGpxOLj1qGHwquXVR/Xs0VUOHFk/ZXSmpoay/GCcVbnmrn/i1\nYCfO3Gq9abkX8zunNu6aoTbjdTOzRQiNqRByXn7Gihlp7Ihvuj/wiVXgYyOn\nhCggUTzHGvNe/tjMJx0bWwrROegThJ+uwyTR1Th1fZ/lWgwTDE5gKTjfDWUl\nKcOaoCj58CF1i2DQckBtJrALhz5oOjtXC9Cj1WZWkQCb2D2pS/xrsUt4jJOJ\noGDe9oheT5EFvxtGn2xtqPbcxvB3AYissyuBrGHJGzUt+eEHLKxVfJGGhbet\nhtVlx09TZcWSx6ynfVRPdwYgKaJNS1i3dpFIZqKVwlsRRwhNl3Nuv0mDEmBb\nZDVH\r\n=e+eo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.4","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.4","@aofl/register-callback":"^3.5.0-beta.4"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.4_1582423050759_0.5674364049981802","host":"s3://npm-registry-packages"}},"3.5.0-beta.5":{"name":"@aofl/store","version":"3.5.0-beta.5","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.5","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"41d9b8b3dbe295c4fd3215d8eabbe8e726215447","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.5.tgz","fileCount":17,"integrity":"sha512-8xbp8XQSSNaJJEiSva1BwwYBOMRm0KcP+eqn+sMa10qShmgqHoy881VjbB4xM11Nu1b+cERqmEmb6lbyRwhuMQ==","signatures":[{"sig":"MEUCIH+iy8W5QflJm529xBhQV2i981WXWrCYrWNdVzQ39D3yAiEAoDb4miuPehkr+Y0Px+b+VT5SSsMq3oqegj4orgZdX0k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":64137,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUe0RCRA9TVsSAnZWagAAPVsP/2iFCsGYfopF1pvAjowc\nmx8pwQ/H4wfgi72zja4el4W0Iw6UCMZnpGXCQoI8oqjdTz3Z2uIOMny/72rI\nxAavlX/JX55m/JJ161KNrrJriyKP5nGkV5y7Hs+LPKcFdGzp+A+GLm3EZR65\n2UrR4J+FMKWjDJ1mH9NkHsM8OEgK3b6EwggkDFMb9GFoXxLGmuYTRwpIVSvi\nEO69VUBlmNlhUqeCQ/JerKw0l4wyjlW27C/SPGms/TWbKQ9haZu4jmnlglO6\nXPnSuzW/ltVZWwYq1UFjthp1la1meaFCp+/ZpJgIw/CyInDe719DuxpGg8iD\nZWqDkiqI++7YKE9VhVfgkH0Vaup7085RpwD9SpQIQ3KsIk/3e17EADXQDocq\n9M/CJOQGCBLncrTwoKRsav1AAr/FMEwaJCCoI3P9v4PJ12nrQ8CrXmZ6PxjT\naUv1qEBgFGCp27WJCxKCNrdL+KGITMlITi+WwfTVIA98g3DW3jFNCkK2qYrs\nU2t2sil+mFq0KWwybEOOWhS3Nr9m16nuG93elOnqz4nirBefcJx7B9RIHxrH\n8+/MHGICct05qN8sx5Lmjy4iD3928Z7JkihTNCIR+07OJN2gwWrkO7/5s8FQ\nrdzJcBTYEb/Jjiq8heH6cVy/Pf0H2XTfY/K05x4LPzr4+XHQJM5oFwQ5bI98\nXksT\r\n=KPQV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.5","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.5","@aofl/register-callback":"^3.5.0-beta.5"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.5_1582427408639_0.09170652333859053","host":"s3://npm-registry-packages"}},"3.5.0-beta.6":{"name":"@aofl/store","version":"3.5.0-beta.6","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.6","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"1161c572decec7058ff3d691f7a56281199ffac3","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.6.tgz","fileCount":17,"integrity":"sha512-ZE4P7UqfR7Xnse9NZf45qCTI08i6DTew22EJdVqwbsEnk79sb2x+riMb9354286SSoUEcZC3ByT7e8qbd/GX5A==","signatures":[{"sig":"MEUCIE85f2e+T4VLYePskoLD8g2+eCx7k3VUdvKnQMV+kgzlAiEA8/xZU+GpwQTt4pXuK2F7KPIWtPc7ZPyypOwsjsQWVlo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":64137,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUe7dCRA9TVsSAnZWagAAMQ0P/jB4ZONq9GudZysw1PeY\ndUYBNcqVRdwamOB16FXWtkk/GIoM8lkqcZvlrtwhUNbsKJLraGKsOn+iByPb\n7TYP/hGDRiDZcNqJcjoqylxtWMqYokEmudY/GVG+kj9GKusSFQ9EfMAck4K5\nhNbiVCP85S+g2kp2n7dKYRi2LVAWDxW2DUQ6MrmVj84MJnaOsxu4rHyFJ+Ib\nSh2EEdD4Fv20AjmtaMYQnPMSE5h0Ix5Tkzj6IsSFyhgmAeDwm+tk2I+cjYu/\nEKpgVIuHxCk/scvlMSCMNtxVjcE7QSCvHdjc1FEjP9/aqLvmlQw6EJ7WDVVV\nrxARueOQQ2b3w+NrKqoouaERHSky+JVaTz8oWm9UMwuy0Utb3kix+iS1tnIJ\nzR869psNAeFYqMXxbNmY+zjVk0HgL/PhNdVWfqfs5iQZsVNp99fO2+hgt3wI\nc7dcJcwy1CFAsrsqYBBDnXUgX+k9SLq+2jHp1PRkcF1W5GLyi7vUkuhhsShR\nfg5l/9NgbXzziBsgRnFl4d5vOD0x+ECOWfbTHMRgnfXA1frYjTvFiDk3o2Wy\n7jyeu7EGYd4zO4JtzJAZ2Rrs1bJoHrmmIOfX+xFG1HzOTNDWUb3DWr0IhnRo\nvi/rvmvW0/TRtHVM2CgAomi5ris7svsN/Mz+Q//TCaOM9zCRJeY5RbDYJdYv\ntjaB\r\n=0plj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.6","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.6","@aofl/register-callback":"^3.5.0-beta.6"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.6_1582427869110_0.8448602194036676","host":"s3://npm-registry-packages"}},"3.5.0-beta.7":{"name":"@aofl/store","version":"3.5.0-beta.7","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.7","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5d9bb1928d316293ef231d02757eee477fad3475","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.7.tgz","fileCount":17,"integrity":"sha512-YqwuDVJLrfZ5H2FHdBRz7xGERmto8xXGbTHVimG0BwACOIl1Sys03bFjcohNoqDxtdE59TbhafG9NXosm4xc1A==","signatures":[{"sig":"MEQCIEj3AYBsYuTafyyslwnsRgFy9r8qlt50tleaua2Gdrr8AiAbQQsH/Iq/aQJs1/Q9f4irTQq06UfT52uIvDmL8KszxQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":64137,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUgggCRA9TVsSAnZWagAA0YkP/Rn9YBnjQPU5gr23o02K\nyRU4SplFG60LFZ6xXsZ2hjrAg7cca829AH+8tjmP01cYIkN7/agdNe6cKJVv\nQh3657MpNY4Q+WBA0es+qd3HefQQ+cQilnXAvUTonJHcPJa6Yh9Xi3kN60Jg\nkrixIfQqoJBBkMMNKMVGbYaijrTvYKfFummluGMf3hLXL5oOyfEJtRzQlS4b\nSUqFb4RM7+sQ/tIh1wUuHgNS9I7xsQz340wXL/AVSL0DkYOLSIAHQFUo04Kz\nyPOL7jHITNtM0BYnYnjkTONpftM7bMJtJAgtjLZJyLBjamBdLDAYR5PseXy9\n+XsKKOYkf+5zIivJIbsAWfkZTEKQJuMRCfHYMV8J/Pz9sPaJ2Ihvv9lJ4qof\nU6MEd6ZZjCeZQdiZCBxRi/vm7/kotAK0w6VTowqyjSZJNeIgScZI2Z3NCPn0\nSsW6FFJBJw3TBhdfKPooL7C1RBEhcWub+5A37t2iDo5avm56iVoduI7zaS2G\nNM54EVBPNu+qObz+1SXE95qBTdAjLybwOiJVZtHQafiiwpfywPkdn96MGb/g\n//7m61w1isN6FxfDg2I0sU2wOuyyJQgPQlgXBU3pICelvNi1U4BFkk2/0OeN\noVvpRxXgLiMl0HjZqgEcwyFRjHr7IgCecZVL+kih0HMlnu6rbf4CXYAvuq8h\nzXZ+\r\n=SPbB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.7","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.7","@aofl/register-callback":"^3.5.0-beta.7"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.7_1582434336113_0.8999773900843462","host":"s3://npm-registry-packages"}},"3.5.0-beta.8":{"name":"@aofl/store","version":"3.5.0-beta.8","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.8","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"e8f83cf5c02cd0296679a802801bfa06927f2571","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.8.tgz","fileCount":17,"integrity":"sha512-HzNcViBYVf5wTapkvavNlm9Vtjv+wz0hogG1p+6LflOJ8rmpL05W9rSt1G4lPptMpPaIK8zq8nx0sKWveRjdvA==","signatures":[{"sig":"MEQCIGUsv46rRsCETzqyVdTEvXgU7RYgbit1MFALPIZWo42pAiBaTF7IBD7epJAgK7oQUjiDAOClcAg/N0KRlL4f9VSG1g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":64137,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUgjgCRA9TVsSAnZWagAAXR0P/0u68TTUhtKI/UQXk2sD\n8CAfROHWTspFGVXnssqP3C0N/3brtal+8GgAVdOLfZwl642cLX9WSYshZQB7\nXD07D/qCuTcnDY0GSp4DahAOT2vv/xMXkRDKCe3qY1LOy++uh4RgybiY5sFo\n7z7qNyGvUGrX1ci3rO/RfTvv5enFWHWoVk68bjD2CE+OdkFGNLHoxMcYbpBl\nFLnSUAtvDkHXUq8C/ph3906ov0VgS2zYymfWUPAu7gmi4Tzl0rZdbZ4wooMq\n+3uvvhTZJz/fx5VX9endBRm+rn7rJBDNH5wa0eG4sw9Mr2Hgdiojb9G78pt4\nwFpcjmMXe3dPggE+3ERZI5AtvdNQXtOGqNZw97/SMBIQZkTezI3SVLycxU9q\neIAxTOe5KIT8p2GuUw25exw+xQRRJ/0vklaqAuc6WkhNT1FbQ6rXMhULYO4W\nruTmTp6EGp+UGZkQOJc0JA1Sip0CT/FM6gUaGpks6UpFFXt+XrqbOc5rUi8d\n5NVl8abz1IQzGkoxMcLDSew/tC9gFWJ1F9YtxwXuPBah0aDuNF9Re+spx21j\nsZZLahLKCo2u3bKm6Upxr3WH+IUEMoFCJlJmZMNl3t1rEoQi1pCxBKmXkCq9\n8YXUNlYOUcuPWX4a5wXzy6nZuQMCEdLYJ+DuvYgtw9tssL8Y5V7FMyxFgnDB\nhmS5\r\n=YopO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.8","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.8","@aofl/register-callback":"^3.5.0-beta.8"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.8_1582434527805_0.4534680244079903","host":"s3://npm-registry-packages"}},"3.5.0-beta.9":{"name":"@aofl/store","version":"3.5.0-beta.9","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.9","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"4657e44eb463b08de63bc7d3d517ce0b7e917d1f","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.9.tgz","fileCount":17,"integrity":"sha512-S9RcuSNR9f2JSN38sz54aFKHDdz9Z80Wx+u+QR4pBjZA6yzkBe6sYwJpJyMEr+On0KPQQk54WhKwRXJXK8CxLQ==","signatures":[{"sig":"MEUCIHpNR+Q0MA8UvARYsTgONac7t32Xd8Sv7TfqzHMy+sefAiEAtvjl3PHLDWz0u1rr+Lfx/WUMeZ+yYvkbfd7NfVL7UP4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":61048,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUg6XCRA9TVsSAnZWagAADPUP/0sYn/jvYVLflEUP5uSu\nmUABKVJidygPJ01puCcZunXXKdlUfuIyy8g42aBt9YwkA9KRxPNGS//2BR00\njenfnpvjFbIhwLODrw/Umnj4TBQ3L1UEhP2cjPa96iXDBo6xEXDXbX/EQWRq\nB5/A8a7k581DdeuHnZ75fetiPrA/yWYsqNHX+NmSOzZ03wKZqdfUZ+p2LkO7\nZq01w/ajH30U4H1NdsJfadUzKmcmOwyAbalo0ady2vPrfa4Xeyd4gP0NuNXl\nLrTXR6YOY0gpWjt3Gv8AiLNpufn25DDJ9kYEv6N6eh/H7n4d6P0dkzKEoluI\nKW5qJQVgM3cHRmfxtYoU4m0jYs9KXBXvjQHoXgZKqSZdD5w3tZgknOoOocbM\n1AtO1dG04W5WfkaOJZ8ddjFq+XQ10EUxYTpO3x8xR61d/FlD7zMJbxRtlIIx\ntikKJtVRUnDYtVg3JGKZymek1VIdsujBxU7Ai+X4gN6IK0QUVcGnq+CE4Em3\nxriRJQiWOrfQ4NrGnCYeSA2EOtXOc7Xiwfh2z1H6U8ErkWyAVRVFEcQ3K5WX\nv/qNzggFKToWiinYHamuzbE9jfuJevX6yXjWwMHJ2tsPMgIX4aQCXLrT8ZB9\nLp1NhHJ5TWpFJzbff3hP5XCWz2SlNq/1ehPizX444IeADdyeg/A9fNmh2+yu\nRi1P\r\n=lXiP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.9","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.9","@aofl/register-callback":"^3.5.0-beta.9"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.9_1582435990949_0.3895431586540654","host":"s3://npm-registry-packages"}},"3.5.0-beta.10":{"name":"@aofl/store","version":"3.5.0-beta.10","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.10","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ee21495c7fcbeb3e004f16e54efd4971efba8dce","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.10.tgz","fileCount":17,"integrity":"sha512-MZkkHegqP/47dIo0wEkmpX7U3oeNbV97J5XBrRzCUI+slQBrqCs0TAjBwnHCj1IoOwvH4E/pFaTbFXweg+fmXw==","signatures":[{"sig":"MEUCIQCbpq3cuRt/M0y55PTmwW1OadVqtSXIfHGqg4QDM7w2fAIgU4sQQjb4QON3cQGSPmY3yRrf56QIjg9K8ii2eYjox6w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUhKoCRA9TVsSAnZWagAA6d8P/RrdqE4aMj2lyEmJiAcG\nqpp54e486kMQoA2+h1Oj3JpT6sqR75jfEHegqiTNlIE2UpWC1+0mTsHacEvq\ne6l5oWokyxGNkdnWpEKvFCb8Xn2N3zrBiuq+MuyNCvxraQQtW4WxcEOuHTbU\nV6RL55VpSQKQSGZaCKZB5xmo61W6fZ5S2b3MiEw4EofDGrn3bwUfhrh1c1Cr\n7GK+QpsxvEYvUUS38AalBfRbk7+QlglF8t0OXpAb/gVhi8LTxaQCh5BEX5Mf\nTWwJjrjrK58NQYboyVpFAFetUeQswK6EPKxa9zURvOL3v49FF8xFeCNHv4nN\nqasE5z5s5mG393o9mkBqYNH9qO1wdHUilqu0o7lSi1HygF6mXnLiVE7rsYMc\nTG8GuOGlYTH2NiTP6VZbHcQT9zh3kJ+atLFMB5b1ZuD5s5Y/ZdGhLZCNZsL1\nRSp9lz45Wu4Cs9o4WEpJRo3shIb+tmruoLtwrVthK0bDg6Pd3kFoQMMY2qUp\nzn+r4Qsnmek/WBy8QljfNNzfkyCifpCtC0kJDQqcsWkN2cdp1a3DWnPVAlmr\nMMAWzxXc1Dewr5gMB2Khox8OQb72rV+98icgSejAkxofcZdLX0oVlOhdPiCe\nhTM0K65a/GWHcb+K4p0ezKqdd9JZQcdQ7MQ1ObU3SIldpTh5bCXx5bN/TNiJ\ntzK7\r\n=Bc8w\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.10","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.10","@aofl/register-callback":"^3.5.0-beta.10"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.10_1582437031570_0.2198316915446883","host":"s3://npm-registry-packages"}},"3.5.0-beta.11":{"name":"@aofl/store","version":"3.5.0-beta.11","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.11","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fe382ab1737a039726c6387edb667aa0d0d7252d","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.11.tgz","fileCount":17,"integrity":"sha512-CBcq6IIPHcCme2LAW2YSoY6/L6prGNxcp4qVMKFv24loC5WWY3jXUNBWA7qfZ9nN4/LTSoFI0ySBCEDgDtvUiQ==","signatures":[{"sig":"MEUCICzUuxk/ch6vkYDEfmF8WCx9f5IknTS0YGO95R+ceOE0AiEA9NplCWkO8lkOVGXY37y/vl5iyuLOsKagDxDdZpqu36I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUiuvCRA9TVsSAnZWagAAelEP/ikEydXF2L+QAXX34PrH\nshcMl/oWZQbuYYvMRbqBaB2V0cGCcmMxg7eYUm0231i2vboTgb2tCY00W7q+\nJfF4PSiXEVjWeaDl9qfZRsiO3OZMiH/Rh12dGXd9fDOcmT58lanHqJe9ZlcY\nSQ3X74UBD0DGEVYnbVDgRF10b7P6OC2CxwAzyurYJp2TAkO3ylb7VRY7ARz6\nEcxdnKzB0h3WCUZWSVycGsnNCBr62WqiwqPEIw4wIHghjaDHHzra9VJklOgT\nYuiMwgBKaM2ZAqk/xcgAmbnlpMErPJ6Ydnj2zDLabR2kA+H2Bkl2hQSiuczR\nBVlwb7l+TxbLyV4UNyOKoMWOkWaP02NNFo0yHJ0vCN8QlaxeadZ1f1+dR/Ah\nREF873pIhHLFawTjuEyLOxW0NbclxqAg8l7uYK6qJ07z+rTRaExK4oaLEIAc\nuwyj4944xxbrlcyJQtG06NUMlsxMjRkc3rKU1qGriTziCC3HKIP1YWeAIucS\nRLnJCR7y+i6ZfHH8ILZc7EC8jPkiWX5A+LJD2pvBCx5Pa7O10hQU6dACxzxF\n1Ukr2aMNYKJ+UCmDMidMBkaOqFmRuhbZc2vWD3gszuMH+O8vGaMv5De5ymi2\nxBTzt0zHM/E9kpLv2A1DhuaCyWVNXF3FOdrklyTxo+JkVz+MP38W6wQiUQ96\n40iA\r\n=nmoa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.11","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.11","@aofl/register-callback":"^3.5.0-beta.11"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.11_1582443438628_0.6415617112974539","host":"s3://npm-registry-packages"}},"3.5.0-beta.12":{"name":"@aofl/store","version":"3.5.0-beta.12","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.12","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"288718e4f9f2b3bc796380b80589712d1d099274","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.12.tgz","fileCount":17,"integrity":"sha512-G0XFJnCRc7Wv/tw5cSSZObhpWPeGC8rlxw9w1JxPmmRRnuFRtCgpfs6tH8bj2u7+h4ILJcbfofiII1MDlK8wIw==","signatures":[{"sig":"MEUCIGezCoLhDWok7xma3KEPeKsdmFCwo/4ok7tHxCU0zNcAAiEA7X2B8bzsII1/FMaEA+24x0NzaoTGNdo53cQt3Hsf40Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUj8eCRA9TVsSAnZWagAAieYP+wQNcN89QAVquvCbr/6E\nkOpYbYpRXoJa3iyDEa/S5T6FHkJxzuefY7f4AdDEqVMtE50/G/V6katEbkSl\n3Th9shHYgjrMsLpwKyX/2dRBROtUlCdknpB+dSReKG21tgOB3AmVZjKAQ1Xr\nqioJHU1pjne6iy8dFQRMpmmayLP2VV2Pmjb9pS5CPNkUiyuLuWZhMOPiJ8R/\nRhUBagaSJL+HdK8Pa9G/JDNC4BpDORPYZewRMO37HTqGzViA+OnDTBA06gO1\nB2evlLe2i8JvUxjYku8imEqUoU31UrkrAE2SsTsdJ6FiF1QKS0BJ0xhm1agl\nk9gnSPVcZNjMpD6OB1EvkrtgU7Uhl1HcQYJzU0Y4dKKttQ3xWnEvzjDPxlks\nuwmT/f+mzlKQ4pvS7EP5ppzVu9woHLN3qJmOOwe050dNkNaJheMyrkUT+Grc\np5I4Wnp9Rqm7ZSGspN5iIIvoUj2O5XKct3Vmg5/aOJc7C6qWTTx1r0N/BI7l\nV3Bi0cT32ADqZ7q9gRBfWGUkPLibxH/3mw9Ud4e+PKKtIbQlf77EyxwclYwz\neKQy8HYd2ifQExBjvQrPU5V46ua2vZVfCZDeUQGmmNAt345oJ92xhKzzJlgv\n2dW6q0Sf2uBw4MpbpUwXg75IC1jBvEVEBkjwqef5HjCfmW9IS/Qg1YfBq9hk\nHA1y\r\n=tTlV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.12","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.12","@aofl/register-callback":"^3.5.0-beta.12"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.12_1582448413804_0.8600104214548674","host":"s3://npm-registry-packages"}},"3.5.0-beta.13":{"name":"@aofl/store","version":"3.5.0-beta.13","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.13","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c2e103dc3e089ed0e83ecb2a08732f9d7732f958","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.13.tgz","fileCount":17,"integrity":"sha512-lz4+K/AfOUIPkO49SBmKl9ElXToEI8OlBhUmUsa1hQyuPZDgxRBhpaFEX7IhCug8oAnuUr2e3zMVMz9uyzRfHA==","signatures":[{"sig":"MEUCIQDdM8PST5L/G+O/PSUvRH9/ZRYetkBICRmp9Bj5ZrJ0zgIgevkwixcntaL7PaXGkjMVjaANEPrIG+/p8514IJjAkQU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUj+VCRA9TVsSAnZWagAADOgP/3Ow2LAslvnf+19aJpn1\nzlsJfmXntAPCSky2WthuDMyoIwEgxk64ceuYaYXPxzIxpxDgTg+KJr2mzc1p\nTv2eYkmmSQ/7HRGPglb2B7E5jksxLcJMTV/LwkQSEDhARKKF5KJCNVOekelU\nfmYZdUSXHvn8W5ILauGjQjfR9kdyFc3w6EQ/vg7KavZ7UO9ac/uAluhC05nC\nZiIi4d7yWNfz3ydjdj1O6hYPRyZa3HkuYwUsDK+gEyvakcnP09h3nSkcffOa\niFs+Z8vPogwXgcT51fOebvaz0H5spEyxkNhsMvwPnE6dCOGTw5oYqPobh0wI\nqCRJn3aWukynRDReI3OkF+/Nf7BD0WvwY5UnKcVhzgS5YOwZPtNW7EOeAt94\nnSIpOdI0QzHBrJpGGO8xEMztcrXXHmxDQ0zC02wFyB+fRc2B3Z3JxJbUMnZy\nILYTXQmbbqdmDJldsXlTSJqaHh1oDMZ+QPsrdDO2RagAcuns6o9Bgo1YlvaM\nNucA78ULUWvxDV+CARgE78QlJTZ0UoEG40UwdtRd4qK5toKa3VOHwYTTaNzF\nTnJu6+IkyAKaA+i1Xn8BwRQHVq6oiZhrXxJWSL3SPFHboYl55Vm+oZW5blbe\n5LejugsIiro/LriwfHsg5wrPpMs/Jtnze1h+OEofrjc4VAsw1Sh1TR+PqmbL\nuwwr\r\n=iYjt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.13","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.13","@aofl/register-callback":"^3.5.0-beta.13"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.13_1582448533002_0.8272257936071556","host":"s3://npm-registry-packages"}},"3.5.0-beta.14":{"name":"@aofl/store","version":"3.5.0-beta.14","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.14","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"92022eacac68b0f6394ed1059429c61ee6251dc0","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.14.tgz","fileCount":17,"integrity":"sha512-BSIo1i0PDQbybhkOM5DuJE2PYspwOtVvORbcewhepQEON2jCrVcLq9Qkfstsr16PKDu8DQHGobBNFZPmSz81hQ==","signatures":[{"sig":"MEYCIQCNmklbWoGKPqU8Ft6h93Cer8mFTm1vgDF49Tx00oYYhwIhAOJiee+h9jrBZ7e33EzG3k0j0WIgCuwNvSEauZ0zBDm7","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUk0xCRA9TVsSAnZWagAApaIP/iBRKt4w0OwbE8RkDGU5\nA2UPCtxwigmdTVLmCnA+x+ka3dd6K6VfSInzaACmQTcdX6lp7o3QkOIcTzCh\nbWLlBqwmQC9uVVrNfVO0TU0+hfDJ6LWiKhjAJ0dSNny+2D8DTDGlY8LUyCci\nM1LufJXnG60jl9udSyy2zM9tP12/x4XdQVjYvnJf7SOj5qV+e36Do/JQvfQX\nofqtik1ZkQq/mEWT1RStgKJMQMDupkSkHWSybCjZCZyz4P7zMRNkGKoMn84t\nEU1RA3jBdg4YvQQCtjpNBYKmBfB7f24amoIA/6+3IIrvw4esHwN2G4vUs1gT\nbMqUVAj8FuvHW/+ooU0IuNYenqW3vXo5m2LMt0DWaL9xA+CApgPOuY75Xnor\ns+JShqL2+cWlDfsK3OEbRcgG+YucGLEfl2McYsRbgFkIigqkIv9IQAn0Iz7m\nu148HUIk+QQDXXuV5bTH9SM0bCW0IKZ8YbLyWBBWmcrMe1j+Wu1TX53FX2Fv\ncf4TkTwvlpnNGojv6zdOJauB681Ca9x1vxtmaYaszxKxh6FDwmmY/r0W1pl5\nUGk+kLvf7wJF0ngMj1QA1xNis1+a4hDmDI9+Sw0T83Oa7+XTD7QFd6fYXyfV\nax1xkazmj4PfQsUznS3NSWgJtct2iHfiTUBd9lrfFaR8+0k5m9LtlrVdVzqW\nkHpy\r\n=DA+R\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.14","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.14","@aofl/register-callback":"^3.5.0-beta.14"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.14_1582452016541_0.9689420276002729","host":"s3://npm-registry-packages"}},"3.5.0-beta.15":{"name":"@aofl/store","version":"3.5.0-beta.15","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.15","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"0b5994d0a67993a1f0546647a288922d5e86b43d","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.15.tgz","fileCount":17,"integrity":"sha512-o/+YOwiu6SkJ2ynGCiAZfHZ4Dh3Nc1F5J/Z3zwUnNqPhei3RtSRhtTd2fQB3GWc7BIohDoZFT6R53DPXFHw+7Q==","signatures":[{"sig":"MEUCIQCEy2LnNVTl0rdGYn0FdpY0vqPQXqfNz3JqjWeM7x/fOwIgENH/DHdLKbcYQ1BFD8zyklkNomtXXZmpyaSPGKKtY6o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUma/CRA9TVsSAnZWagAA7pAP/1vKf1RMS5BM4ZrHxWmd\nFpv0hjWoS0r6BR28nNyhosVIoLWY0VfhmSJKvcGreGYnkeCwG8Jxd/BeI8wa\nJxxNcqlIPOudDJjvoJ26Mrdcwh4LJxMykWf3ETIMsx4SIzbL48UOuoYrK7+p\n5wgIuYF/mgEpZlL3YHeKolr7uLMqye3uroPhfzJmPTtrg8TgdDHQkat5YBea\nlWBMS9HTb1zOLckMDDLe4oWdo+R1Yr0EeKpYQ+cyJVq5P95JVi0OsLfm7+qe\nKpdNpm93Ga+y6QCwctdhLuKi/SajbFrMpCNfDbl82LP1bbsbl6hoHMAaB9l0\nQIdX7H7hdRsH8KSXHhMokWvSSM6YxPxpZpbLQy9qhQBLf2PCTFIpkETw6aYW\nT9gl9ykIxalUOJDwxZGQJ+jaeKSge7MRHX0TCd1LPUFhttRjW0HXm8HBKk04\nVDWyfd1L8wyGRyEhNf0HwrUCB0uuJPxw3YrTHsACDwM5q094K13JvnQELABl\nVl+hJFadA+yKnFXp3/K9SRDXFMKXE7KpESmhhx/2rgyUldGN+STCHIgpwLKu\nv0gkapx57eXnFBSDJS9OFDYZB/BUBRis2IkWMjrS101YAWdC9yDhr+RI7LFh\nu1NsFPkg7JywOpqwozQAAifTM9x1E1Ju/ifIhlhyut1O0KUBwUq9cvg1m2cJ\n1CEk\r\n=kgOk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.15","@aofl/register-callback":"^3.5.0-beta.15"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.15_1582458559355_0.8668366380062493","host":"s3://npm-registry-packages"}},"3.5.0-beta.16":{"name":"@aofl/store","version":"3.5.0-beta.16","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.16","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"032563e2eb71d771a855f8ac0a07a40de3d12246","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.16.tgz","fileCount":17,"integrity":"sha512-yJ98sbQMLks6TgvictLimG8lrRP7x1QUZ2OBo0kIlnnAAnKga4dH8mU+IgxSevaO95gwENUbO0I6F6jtxcLmJg==","signatures":[{"sig":"MEUCIQCHgqHTZpcnFEB0Hc5jUNk73RtQNgOPR9hKKpUWR+F96gIgEx+zVX92DPIFTXH8apurhC7tHIrCbYubvn/G9c7SNZc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUmjxCRA9TVsSAnZWagAAODEP/0TSqdK9kL8CyRHPyNwv\nve8i0kAvFNwAJdgzYdITr7uLJSbBjZ2kZxrch0X2LGGbXpV5Or2eYPauvc5G\nwI4NyaPG3Obl3w2VZndBA0reZyDZysANJMo7jNvE+fmAXApKgoriy8mEYJL3\n1NzE4ByDoP9AfkuwPxJ/oXcKIk1wPrWbODSCB4qRYNWiHLXtAxvyHK19HrNu\nq7uvEF8ob9Z7l5qrVk4LMNFDEVztrGCqSIiH6dcLeon/AzYKcDVNBXS8XcxH\n3NPeAWerPvb6J7ZIUnHwjkUf/ba+YDD6970tyAj/ZBJGsHe9cri8K6ZlsVxC\nfogfBcyfqs0rqBsdjnRbCec44ab1GMsykrF0M9sPLtlcz2xL9AG5Q3YPL68u\np53qwgTz4aHAfOm6CDGuul6H24SHDFLOPK/cs/JeB8PdZuAjLFmYXyUmh/wf\nuGgNI1n/pDqwr0p4mzDlgrufwtPF4wRmcYEC0PZuC1SNErzvUq4dOh2B/MOz\n+CZPk8se+os1nJ9iERb9wu7cwG/o0Vg2alviyrm78yWYfITcRWG8WS14wkU8\nEvVpCM+oh2B6QxAMCxnX6BXU4EX1y+6AifUlJBZVvPsBA6RKVROgPnfHAB58\nqEXQ8bb2xHTeFEgk+yOs6oBFV+nMZHgkozQzK/D9sV/OJ3Q+XeIcuEF3ZX45\nC0yL\r\n=4m1j\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.16","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.16","@aofl/register-callback":"^3.5.0-beta.16"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.16_1582459121187_0.8486039190080756","host":"s3://npm-registry-packages"}},"3.5.0-beta.17":{"name":"@aofl/store","version":"3.5.0-beta.17","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.17","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"a34d71b70391a88f6bee931db4ca52f7b6e099e2","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.17.tgz","fileCount":17,"integrity":"sha512-pobgyvylgqx6fgyfz/vb30RBlY8rp2SNIGyazGys+AsfeeAsyJO6XAv7ilIAHhySAXxNiaYeL2ZLI1ZoFW2kHw==","signatures":[{"sig":"MEUCIGae5rtIEkiCgV1xBMimgSi4j/aZpodXcjVzLAsJf0iKAiEAx/WXbhoyyM1qjPAnxi5S6vdSQybUHl52L3ElyYCfIs8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUmypCRA9TVsSAnZWagAATEQP/2Uoz9st3ZYMWe//FK6T\nJI4AKLgudHwdXhAO4l4qscJ26LDRzNIN12KtP0pr1N6w2f+PspJLAIpGcIPT\nhe6N4rUoBvM6mM0Lrm1d0DkfiPuXHfW79Zgtcp5vDz6kKNHV8l6C9FvNZOnY\nT3NfcO4AXdpM+aEixtc3HR4lWfyRGnLKhAjJr4a6++VbkWJPoIlqQ5Zj4/YK\nPxqENb6qNPZY6Anxw0HMlgB+tAAcv+FA0lK5f/OCrsnCa4AW2LvKzAZSvnYQ\ntXNKmPUMNCT8zVJdyzuSTVBylR8CUOXK8DGQ7dnjbWnqTvO+4mCoZNGH7sPr\ntioNwzXc2r4DMlCATjGwp39Rh3b3wTMnuhQo5mFftH0um90EgQhEDvDsfVj8\nmL3I1wsZadHdR/6Pvan9Njlr5bHrlqpoL+QWEnWLjTa3c/96wURIZUn/5mxK\nQ+iVkMVKaO1cmcVRV+lderHf6nYfA07B5hdnnpCA+BacW2rpjv5WgZm+0YEE\nnJfgNLn6PMIhsowez1PIrSJn2eOO42WGoxGXHIp5joZrhQrxABKqldWxTtee\nUaqY7H8/oBowv59+7I2juRMDnD/ugisGz56TCEp3C7Ko+WhLbnhI/Emrm2e3\nBSJAvaOn8Qy8JHlDdQ6glepE0lf94Qfuqd37Wp6IkMExSE4S5C1ONS2SvFaJ\nKRFY\r\n=9U4O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.17","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.17","@aofl/register-callback":"^3.5.0-beta.17"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.17_1582460072686_0.3686327458587919","host":"s3://npm-registry-packages"}},"3.5.0-beta.18":{"name":"@aofl/store","version":"3.5.0-beta.18","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.18","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"4db2ddadf27121656a37b01c7fa2fc8b138d95ee","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.18.tgz","fileCount":17,"integrity":"sha512-hJWjw0gBDzu3P5384Gd39sbCPjlCevEU/GhjsEXD0IuIMvvjfQNZUD0OGu50Mh7rT+0kSco2p/Zf1I8aJ+W4XQ==","signatures":[{"sig":"MEYCIQCZqO0O1kWZkWVhmSJecQ1V1aIyigCeMxK/gU9RY5i4PgIhAITbTXY9+W6KoLBAGGQiQ/o1MDrU+aWR3lzc+secCRRu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeVJuoCRA9TVsSAnZWagAAeiQP/1utA9P9emkrQ7BBUGwA\nIiLBK57RtXLJT52tXS1wbMeP/xOBAkigGrLyeszxGOzCz8qcwYZQzDWeVy46\nRfr3r0SBGBrtXpyzXJTpEQzuZ9YEWtp0XyHvyjY91xdZyXlMf/LuldAavVLp\n5g6mwBIxCDVi/tyX0ZZ1NGnmNmuKqbogv/PuZFB4I9pTc606j+Rq4gMkuhIO\n83MzaaBw38inSgSdpxqcCYg1WdBh8U2vV0KJEW42BfDSM1wIFB+a4SuHDkTX\nPCMwTxE+Ktmj+HNhjKyHJTSjU2D7+zn8eSoSyVLEFfx066qh47ic1C2PyTL/\nM+PjAb75r6LBjgXL6A4cWVyA6QHsec/xpChsyXzn2AEVLTtCIqn9Ag/aHROK\nuqFRVgnvoyWpSwSYsWznIn/Ji6Q1NI72o295D/y8nihJYIxAz8UpP4OkAtSM\nAXmS++RG6IWdggM3h3q9ir9hccDxG6T3onztgsjuwYRjCUepfHdj24k15LmQ\n61wL6psLVMpKcWIgoDIEQa6vRxWzGZwbauhgnLdfxz37VybNVb4ydVy5XhhD\n23OjfTvhWXp8l8WR7n/A0cP5HW7QauXVNcXmqHujO9zgXjyE6UU9mirB6LtP\nXzGZeNqfPRzvGXcYpBzIYKBnn3uUyq6MUOzUK5y2Z/hJpf44Tw+btbQlL9V1\nNh8p\r\n=aRmE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.18","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.18","@aofl/register-callback":"^3.5.0-beta.18"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.18_1582603176542_0.13298264791731773","host":"s3://npm-registry-packages"}},"3.5.0-beta.19":{"name":"@aofl/store","version":"3.5.0-beta.19","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.19","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d77cf4cb7a224ba217e29428223e31f2f747793d","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.19.tgz","fileCount":17,"integrity":"sha512-xNNtK5KF/sZ1K3z+cEkH4Ifd5lfsuylIOz6H4q+y4D7jmhlEuKylGlYOKMOWqkKxS4x+Jidkm1jmvQeR7FCSLg==","signatures":[{"sig":"MEQCIGzQOHe4xA5Q06Z7UBsq4onwmdq1bDQ20YXP02aKjM+LAiBQAUZH8qVwjxzO/FazC1wLN6rUuZdgrIAxXmpAjrnuUg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeVbRbCRA9TVsSAnZWagAAfM4P/2+HagINKcIlBPBm4rx8\nY2WwvQqXiEc5IPsqQD0VCOEVtF+8GqPA4oW9ERv3wu1odEUOH7RiNDDPDXIX\ncQ1q7Rwnr8x8iwOBjuZk8hcQL3sRcNJsxG7LhyPYUZmbLs/gwb2sO7WERwcn\nwnlfXTxGDNUvMgb7BBnwZ+XbGtwwVpL6et7+3gY/iIaap1pJc7LXg4p/j8Y+\nTQI6qtV18CqRmV5hUzHIZzGzy8YKHuwVjVRAZGIBGIortgBpNUcnWl/m/PZq\nq1E0zHjh6tDCZSY/XC/TlPuPN1zLLSUgUkiOAoJdIUaZYUv8o6Y377cOSF+f\neSQ5iFUSxl1aBYinuSspkUiBlEIR8vSqcg3Nt6LgIcqAfDMvqTHpFYEcwpcX\n5LEg7cVTbdGGPNppn1CW8F9S9vt2j/rVxrXEHerOXy++SYWYUBkF9UmvNVxx\nrnI5/h9cqwEBNUaX+58mVsDyZjvg7edzssTOWv51f/RRF0R/nol/eQ7t36kn\nSHnBullZv/VdZsSOd0mnpMfVUF5sl+QqjepCAwzP9U+MNFbXrIZSXAWbMYO9\ntiaQB+dm181cTW/7nhCFFeT+tNL4GyuVdrVU/EC+0rKFIs7Mw2Ghz/0z3y2A\nONBtCl5FX9LgxP2YPRhX2L64UCVrit71dZwWLE0/+VpZry/GzkrNVxWlIrYg\nlj02\r\n=ORnf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.19","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.19","@aofl/register-callback":"^3.5.0-beta.19"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.19_1582675034726_0.7821721071886387","host":"s3://npm-registry-packages"}},"3.5.0-beta.20":{"name":"@aofl/store","version":"3.5.0-beta.20","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.20","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"1378775fcd7e668f9f07408c7a1325e569a0a1c6","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.20.tgz","fileCount":17,"integrity":"sha512-tQdEz8D4hKQRrq/AkLcoXUuqFAcEQr/FJAdWjj1xaLcEFSLNfJD0zBC0BFvxmrmOjpU/DQv1j7q2L4ACs7EUBQ==","signatures":[{"sig":"MEUCIHtALnnxwdavffoS79TiaZVuuQ9GrtXqjC4SPq/vQ7rIAiEAw8C6knGNkENJnc3DVZEggZpNxlf98wkPo/wXdYkXTjc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXZVECRA9TVsSAnZWagAAAUYP/3ZQVL8Yw7gz14V2BHkC\nF7ZjneAIPN34GKaZwqy3UYHB7DjaE/503mT1k9gDVwXitRwCXTOp1NnWj5gV\n+ufGr8dverqXyZAh1wlCTLBk9wWVRQoy6+huvYKiyjVjoTkM9Xd8wJw3GM9d\nqPFCtaQdZreyFVIL+SZ8uirfgZpCYHMnLB/z866jqtn33PmEmwfWh6iSyUFs\npRef+jGpRPhf/lepz6kAvXt3kNnzjekvxQI7mMVGgAiKti9zL/j7/+X7AmSl\nZRemlDJ83tLmWWWZ6t8EdI54KN+VVpAfYhRARkkmeUwUFC6NcvruhP7ptH5p\nkdvO8ueNXzSqBlGijxUUDhPrC1fWogf4iHh4xm9wJPZfhm7vCrVD23PDuHQw\nI9D1IWGhcEqBgfcimDBWlz5IRlX/iPLUbodfIxN39IUb2YZGWj4kkIcAqXtW\nrn5qBv2sUHZex7y3kqwLevXSupyJ3Ze1XpUasoq5fB9a5MefidhiRqjZL9kB\npvFRXmmC3f4RulWWhXChjzkWDVXr2l1TnCOGVEwEL1HcehP9GWXDd/kffdw+\naWXmlkZUJ6YHoHQD9suq+0QfBnLQKgsCC+pELglIfEgbgV38Lde4JFazsRc/\nujklRMb/uOTUopcSomnPXcG79eN3wbU0WMILBykYmWmjNd75wgoGxKPHfwO0\nu6j6\r\n=pUHi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.20","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.20","@aofl/register-callback":"^3.5.0-beta.20"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.20_1583191364032_0.37376540247787826","host":"s3://npm-registry-packages"}},"3.5.0-beta.21":{"name":"@aofl/store","version":"3.5.0-beta.21","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.21","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d28d487d3922250e30d106991c17ccfd62390e24","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.21.tgz","fileCount":17,"integrity":"sha512-Ge/rEhaqt9GOs66AQhLpnyaq2xmax+IRA6t5sg8qU33KOI6JEBpR1b7wJaHDBxZtuk8U7sbRPbQBw3uWwMVYLg==","signatures":[{"sig":"MEYCIQDWZBWcXQLQoeeW2blmO0Gj4jF9i6GWCzD1cdX5nN4qeAIhAKeDA7mLp6nVNIVEMBAZfwyH9ukpDXrPnWhudVI5D1BN","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXZZLCRA9TVsSAnZWagAAOK4P/AygxjXDLE3FvGr4OLDq\nBB97WG5b3Njwhh109NswuY0gE4eXXPqlZlaTs8zsyHZOH09W+JiiH8WuXoUW\nD9Uh1IJaKy3O9V9lx6cJW6+N28WVxXsTsb73xC+TFkewQ+VNuYAm1S+ln9wo\nvXcbJVcRYZkqie0e+MgjJ9XAGCj9JsFuCkxdWvZgXpMtMgmoYnwQxoiZYkCD\nE6Zi9qnrzS+wz9/6RPr7Hxld3BhurY9gQyBy/S+NDc3PUBWjWeLhpWv4OTYb\nHH4GJv/9qmf9OGze00XJ2o1+q3AHSxU7OJ2AZb15+bQBSwoPoYe7mfACop/6\ndNU6eAgXDVd9GbMdzDPoBiszTlUVN08YR2EWDOU9qiYQZ/6SAXcRjilt87Mb\nbLbueN1YAx+CUWymJCRZ23UxjpNIRJLwoxKEcBC9enEC9MLeNqGci4CZHwaF\nWYnwUgj5rF7Vi6TuwM+OnoQ9MzzkviP09flyUI797mSk3ZMDJ+GhClDbP56h\nb9eSCWZapR4HBdKwdD7jCw36kDz7VPnvHCSmkRK6ODHCEv4yoZ50ambG/tlk\nT8x+K3nOLiUowDtk+rHOfX3dJIYPlKz5RUxPodbS0rFO8KazDiXeBrhv/HkN\nOaYKyyhsohVTRl7egSyzw+Ee8bQ5BWj87DbfahfPlluX0mNiamGCcvnBA7KF\n7f1h\r\n=3qNk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.21","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.21","@aofl/register-callback":"^3.5.0-beta.21"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.21_1583191627251_0.5117032587579715","host":"s3://npm-registry-packages"}},"3.5.0-beta.22":{"name":"@aofl/store","version":"3.5.0-beta.22","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0-beta.22","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"85db7b09c65612524836ddba56b7422147273eed","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0-beta.22.tgz","fileCount":17,"integrity":"sha512-EYryDvBGnsVb6h/o5vT8Z42ykRJN4wlv80YJK9WVpCzWjsfhArCUjNiF9Jt3LqJsOOFbk2X3nbzVlKybBQ7Iqg==","signatures":[{"sig":"MEUCIHm2Ewen+JFd+2oHYp3BGgU8iOOrjlbUQhnngbLrWx18AiEA5K3Mo2rAoKR3wjl/OIws2Ie/oKDjapYniT5ZcfdIFUE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXZndCRA9TVsSAnZWagAAk+kP/17HQyxcs9OCQgFpUw0k\npd1aMHb38e9xUF48IQlTqwoDH+p37+cxv/bJSdEYN1J/At413VKdEr2VAGk7\nuqRMvdFxMaLZReC/Lh93xKrWft9s2f7K2iLYXP4UHGvNWKh44YBd8bR9Ih7r\nHudZC5yfXGk9HTzuBtwZTwMawOUDSGy66m8P7UctenzXeSg4L14UUIQfC2jK\ntAyTUtcdlp6WJXyCB8M1d/lKELqBdFuacIFyC5RBgLGy5Yfqc7UCQ61rIqk9\n1euk4rGsZ7ZzQMpUE54yR2VRxfG1uMWgUyyjsuf8BhR6AIgcTFEbPa6XxpaP\nBXqvwpabz3o5CjrX6p3bGotBbxTeidZNnlT2CJ1f6wOecMZs4gtJkzuvDC0y\nxpL1E+ikWvOXeA8PaOypWQvC3AsnsH3QffRiw2ZXZOdNYAAyd/FSe8gJspEu\nm3AA0lA/lvrh6Cg54M9p5u6n8E+S0oi/VjgbUBtVe8nVAkUK36Z/F0l8vvMp\nn/iI8a2AQS4u+ft0WmVnSoYyp5G5dGoMyxZRlQhBDtM6j/7xkYd73jmjb3kx\ncbdNaFmNEq4H91QGHXPuzb0pUtDK+/+JxN1YEkRw1MZ4CgUd2Qeei0iwUd71\noNXgvIa2kJwmw54djrExny51tBzyKZfmoX6Fh5ZKEdHdT9L0azPwtai6dc0R\nOrTM\r\n=dX/Y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.22","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0-beta.22","@aofl/register-callback":"^3.5.0-beta.22"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0-beta.22_1583192541347_0.41548194445690556","host":"s3://npm-registry-packages"}},"3.5.0":{"name":"@aofl/store","version":"3.5.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.5.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5604b46b9ebfbe95509b15e9c0f4566f15037c2e","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.5.0.tgz","fileCount":17,"integrity":"sha512-39d5yJHPK5CNuzpmxJC0MHT7J0iG5ZE+IN1klhwTXaW2e4UqkxwVIjdLwK6t17pVJ5PK3CXKiuI5fBIwDio9Qg==","signatures":[{"sig":"MEQCIGsUD5lFRjG/IuCpYq6nAGhw7mPxoevtOKv1rLNqeeytAiA5WIuAh9Jil7OxOOfSTy1CH/N7kL6n06xO1iQL7p37Qw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87118,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXZ69CRA9TVsSAnZWagAACeMQAI98dL1IaFGJMi67LKnB\nT5LwTUVxoedI0yF/0quzRv89RUU180y2Ovo62fFUdvluWxDud4CO/SuiSF0Z\nnHJXrPWlMBMg8SRpXXxwzPSkg3KI9U8+rZMujlknEcEX2k1uW5pAVlDWdxbX\n1C94joq5JD2vuaL9tk/XZD85upX8Knd0uRfnlAgzFKTc3Qh68IG3rHY+gt5j\n6inJCjuSeVdy/m9fYN/xOA7eNdfi0bbqDAEdBs+gUccVagcEhYTws5KY1Ei4\nRnLHR3BVLHZKP4DVP00WLFD9mmvG+bEz06JRZl9O2uaqzNNJ8eO8OoAmng9q\nREOt4HuXk+w8r13J0nkwljx8lLlFJPdBXTJUH9SvEbQaPjfH4uRqy/cWQRTp\n+EXM3jekLQX10gvgNbWXwWq/iK03VV1EguzeYHfbBymTboNfpRAlFp8P8Ju1\n2lyL9YiXilEhnxyW65korSiyOtd9pX6xPikgCDwhC0ymdGDCXGdaVKj00DM3\nkiemLyrZbLT/hlTRs5Q+HpjRuyvnnVsj+uLSzZqftPR6FNh/sdvCSm31nsHz\nOa4CIXm4cUn+ceMeX0evlZbu9RdN43W3M7t/C+CnJ+o7nM8eKP911Hi/IlVl\ncK3Cld2uxXaiGTHqPTf80GzC7+ugjb1RSMQS3ZgpqCaYavgAxLcRMk1ot4AX\n3CUo\r\n=cDbh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.5.0","@aofl/register-callback":"^3.5.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.5.0_1583193789246_0.33318345514126024","host":"s3://npm-registry-packages"}},"3.6.1":{"name":"@aofl/store","version":"3.6.1","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.6.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ad5f3f78d101d6b1545e56ebc2e99b39322d8ab9","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.6.1.tgz","fileCount":17,"integrity":"sha512-B8hCX4xKkh5T6AHOqzI43xnr/QeGSdmdmbbrylVfwPIuTbanpUCNqv9xtvvxcXLC941Nnh+/VmbLuYvroPYnng==","signatures":[{"sig":"MEQCIEkaic2AY81gBujxR3oN1QQaMzY6epGyKNNJd/GllVnhAiA01MyxFdlhmjWxORvHskkzmyGsPRsG3/hbBwjKhR8O+A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86306,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZ9+xCRA9TVsSAnZWagAANFsP/0SD9GCFoAsvkT9GkW+x\nfHLnsDkcuMtv7KBMcfHUg/tyaSUEdX5OLzgA6ayQQ6w3WuwmbAXdqRSInosm\noEBoVL8DSbHUz+HHwHXjvVS3ktYEtDMzEvvaXunNGAAVe6mvRHdmQbipcz9W\nHjANh4a42ln8Ce4mdiubT44AiItKzdov9nbYIq1WXbWMArLHhpFWLs9jLsNu\nqPjdKl1OCXEhR96G+2Px3Dm2P7Dub5sejrRbNavs6bCgxEunw14O4tzXuoDf\nTmd/9FTM8143eyrB8fY5L31wHZ365E1icrnlMnMksMFIfKyiVDI7nz0O3awL\nXI3dnR8t1ZXrBEbo+L1kyR1Hz8YomjW7dWnNb++AkV9YdpRkpt9dEr0QDvJZ\nc8W2Ysz2UnO5N3nsN5sQtU/iV3CMxS8ta0yOWfzoEc3w7FZUpG8KMDNX8wOD\nWzv5deEq3W0Yh79WnAqr5KRe5ICJkYgTL+IMwhvNel7/1j6QG99wZxYhUqa6\n/dpOvRXLVQZvY6n5e3/hWiVMJ5WdQKABvaS+TExR1PnbSRk7qgfyLA41AqF0\nBq7jX8D9MCvPsxCkru/WzUT0XG3hXAU9bV4ejxEIvyOnRvxBlAALpjPXYX42\n0pnqGCoW5AHmJ2j7U2H/2B+S1lLvA97mKullp+ePav5FG4aEjnuGtHvCFhY0\nNge2\r\n=/fuB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.6.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.6.1","@aofl/register-callback":"^3.6.1"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.6.1_1583865777434_0.32916014492085344","host":"s3://npm-registry-packages"}},"3.8.0":{"name":"@aofl/store","version":"3.8.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.8.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"b360d76000195843f0150961af8fefb23d12f821","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.8.0.tgz","fileCount":17,"integrity":"sha512-GC/wyIL1eSaLqXqZtnFv5bMo4CN2+Xe9lXYsHWQTQAaKfHmx0pi44l0EopC4hxhEhO6J8032+VV2U4vqyQxUDg==","signatures":[{"sig":"MEQCIA7pNh/gP0u+iMk2eH2uS23shD9z/TFIVeLO7BWjErkaAiAxeGp9nQo+/DD0kqTALRuf0TPHL6weG+03v6wqLBpkMA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86306,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeuvbCCRA9TVsSAnZWagAA0VIP/j409sH6SmJftfFgdfN8\nUshiGQJSVaPAjmql/l0CTSkRSBtr2v1iH0tRy+mXu8SBoUjCaoLfv5LOp3gL\nUQmJiuZCQhTRt8EPH1bPBCcR+lg3V5NPBGLyGlyln2YFdh3dIZxy8E4Yrox4\nYXQMKsxQ26fmBkvTHUwgJwPzZLqabr8tx3g8b2HOrUky3vKATWD5+Yk6cudW\nXXYM4Gfgd0i8A7r3VPdeQXJ/4rqxemy1pnNwJb3n0Q3CFeztKA8HmGOyVCLK\nkv56jB/bdchXncK79eH1aPr3GbHOWd/cVGbmdh4zJF/IEt8yrJSRy05Ijkjx\nSl1gNy5tmdZl81/G3azUOtbwf72Eqip5KE3gG9qL38eb+av5vwpdTFL8p4zl\nHbqOvqb5nh0MxpnzSgJZu+fjVdQQUi/cQ4H1vjFQaCxqwWvL/Vvj5ZLAou+q\nFwabC12XeqOSNtGYNzv1ZPhKcv1XqJB6QTXOc2JgINN8cwgeFaUf8aICgt8H\nlU0K7DqHA7jmn2qYTuA+W7k5EwxiRabV6Sonq3yCWcXxYuj2ILI9jodUfOG2\ndvr22YhREAY+5jz9hIwjv0pFLxOFebvSpM57TKU4rPefnVyYzRTMe1Y2gWia\ndghJ8hIXZIYMczYBmWre6aEd/8H7MGzLwonnSOp7lzzlqdSYYzSM7R1Kd/9I\nJZEd\r\n=+kYF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.5","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.8.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.8.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.8.0","@aofl/register-callback":"^3.8.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.8.0_1589311170197_0.8327851936010338","host":"s3://npm-registry-packages"}},"3.9.0-alpha.0":{"name":"@aofl/store","version":"3.9.0-alpha.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.9.0-alpha.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"e9e555692bdff7dacd36f1b6711b37764a0ce70a","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.9.0-alpha.0.tgz","fileCount":17,"integrity":"sha512-tvbzHMTnYOGTZg5LC+H4tP5gNi1aveUWaqSK5X9XL1psY7DArBauJXJFHFX5Kg4s8rJdJ1C6xOhUa541KiuQFg==","signatures":[{"sig":"MEUCIHm8Oj25HRZe41KmtOLE5QXiGLByaKpZ2beWlqcTqIkPAiEA7F/zKeG37uo9HXUL5jnaqfY6v64Lb9m/tyfLcIuau6k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86338,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeuvk2CRA9TVsSAnZWagAAiEUP/1xt1JCwJrOb3hvHtwTf\nI7dtl8oHxE8FHX/AJ/HqLG4mbdB8QJ6xOxRqfwRXqbTe/4WcWIs0sxsixSPR\nqXhy9k2/VTzvScnWPbsHWOdwmm90FSwBp3pqfD/f4qhr0f45x5wBlQvL/EcT\nna/Q+PmZFnmHBzwccxqRf2+XAdHvo9R8E4nuWHvw3tPoh/tub1dBeOECWtlD\nH75oiM7H0rP1o9VCLwWc4kUdAilEeHBnp83VP5A78zkQ49UIZDpzwCWMYo8C\n+UCYfNvOLM5qr9o0LhRzrIoMTAFIWWOtluVaisE3oVQXgP04N4RGL4MdDYXS\ntGYmJ/rcFZu44a0QRzpiV9KmLyWAuQsizjDkExifg7yV9Vh6O8KOstgPJa65\nDYYe5nHG2YTdu1a+VStFcq4BXWwP5U3M5nLNQdK2pvJp3v56FNriDnH3OXYG\nq39vI7sSQoz0O16ODYt9cFTrBvZmlYkLmRwbE18Z5xjsDf/dUE5fcWP1Jv/4\njhJgmWcHuyi7hWCn7pOlxqxmmhOdBQR+FkWtRzxIXNJUqybGfYoCUZ/XgOCy\nJWxroIDCgpGrL2u9ZQPyhNxRhOYTNrKjNC3rr5NoQCSTaT9Dp82S54JI69Fp\nC6R7deFv8wEAzV557NUAillMCMs1omt82ZqqPGFO0u/rnnic6/2V63XonEfI\n7geh\r\n=DvIG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.5","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.8.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.9.0-alpha.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.9.0-alpha.0","@aofl/register-callback":"^3.9.0-alpha.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.9.0-alpha.0_1589311798419_0.41917839539983515","host":"s3://npm-registry-packages"}},"3.8.1":{"name":"@aofl/store","version":"3.8.1","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.8.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"94e99e664ab320d929e4ea1a252206ec146c093c","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.8.1.tgz","fileCount":17,"integrity":"sha512-tFfu/5JGlv4wRg95qlDRrPB377tDe+FW1dCKjhHE3Tw/RXRaJ5GAhciwpQTp0N1skFbOnDFMov5WhnWfh8P3pg==","signatures":[{"sig":"MEQCIFwsnuD5bG8hRyHil4L8Q55LwK4H/z/VqjSMMfMTaS7zAiAdv6HcXI8H0uUYK/aet1rDwu/6nWJGupJYVU6fSJSiMA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86306,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeuvu8CRA9TVsSAnZWagAAF5YP/iwIeiCM0T+wTvOSlKdh\nboyGpfE+5Ff9Pyp/1vb0TzkXCS0uHhugKaYyxieu1M8KPaZlrCOxEzYUE5d0\nZxAtn6E9H6lIjZ4tuGNJZmhyAD8qz+pVWdJDaihWaX1waEteOBtrmBuqlfMu\nApr/I5tRfCLoSLVO5U1APnyfgbX0omGYdKF+d87jCwbBwkcEgNvcKhoZe1qe\nFvP/paQDkFKtVjzJNN1NrY3wuLF9A7vHUqPt/2iQM6AwWhmmx/LIEwBnYEjC\n0C4n8VeraD4xtJsbbTn3ez6tr0w2CXErw+7HSWx0pAnx4bbG5UzG2i7JqQIq\nIjM7fcJIZQRxSJ13HpQMq5aW/26LVf5C7bse2r3g4exSWibqMiLwQMMhiawi\nBNZgH0pVYbbJibQAECcJYE7zX59KjynIsY9On5289j06gAav2D9P0QufWtbL\neXz37pmLiu/8n1fTXdPWEgToi/h+EQtEEpqzzdZc4Qoi4d99VkCC1BvyUOGo\n6xfBYNP/v1/hWJfvv0lu4jzBl3YlZjybhNEHp8h4Vmgug+moK94GAZudmxDS\nFTLCA+34gMem9yB3LedcaHhOBajvi/fWqC6LEVoTus3CaRCrp07QLOKohAMZ\neRn8DJxLmiyzMF+j5Meb0KTVuL8JycmyA/kpXZVP97GZOIRwMnEfmL/BgNdt\nNP6F\r\n=TqER\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.5","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.8.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.8.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.8.1","@aofl/register-callback":"^3.8.1"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.8.1_1589312444393_0.8635690553305684","host":"s3://npm-registry-packages"}},"3.9.0":{"name":"@aofl/store","version":"3.9.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.9.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"74ba187c89ec18c4ffd25bbe8852c364ef1af1a9","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.9.0.tgz","fileCount":17,"integrity":"sha512-IbiA371oxFz7HBslvCZiskvnpRkTi2UR1NA+cByM263EQXrOL07on/U3AT0CK7Hxt0TuAGRNzMPYsTKU4NI4mQ==","signatures":[{"sig":"MEYCIQCrpfC/3PgRVnxOEnrCTp14KmI2AIO2LBPMRPqGsWfBOAIhAN0Cn8RQpaA4s160Y6otzXZlWkopXf4fSMoaB6hmCFU1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86306,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJevtg0CRA9TVsSAnZWagAA4D8P/3jBTyJMAajVvSN6Qm0G\nqVEPumplXQ/54wx6yMAMe2Zo2zAinq2/8hP6BqOxNUeMfcZQ3gfS7wDa/Eie\nU/qfTcm05FBOIEKVIzz3fib88H8Rv/9Au0fwRZZ/POSrQaY1hHZpsaQLtLRo\nKgZKNTs+X1xMxYR23kCjMYw9A7PH6iQYm/mB+rdlOex7gu8aa971WJ254kNt\nqMU5wBiQLVZ9u6VKxNfNClBgd2RQAaDPwQCXuAGCoCvOkL02X8wpIGsLgIec\niXVSBQdDAsAQnT8SvqC17mxLxW6tsatnGqrXEzWJhtHFaHlqq6ywIyFuDCe7\nSir4xxxkKgCQLmU1DdikFhh9YSV0jmx4XzcPaCKIw6y/MA2aF3x2De7/lL56\nRkTozG4pTfNiygWG7FHacIkxBpIQCl2F3ICbmgqj1nElPtq5N344ooTLKxWJ\nCAJynxmOXWP3R0fMkokuXegLtd4VQK9DYO6y/+DZ1s3z5ksH/2HVKETHC2Er\nesaIagMsJkvV/TVF3UodjjV//syZ/+YHKqqeRx11/MDmVEl8TgpocXKxXY18\nZGkrvzeo84TdDd1fl/O/pcih6Rbufk6d3McSK5JxmZg+cE0MKU+fHOs0cpNu\nWRvfGeXWpGlUqGlE9WjnNlKOGSRJwYq0hIH/lOqQaU00Du4L5fRXlkUzNOC2\nFVwU\r\n=7Hd3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.5","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.8.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.9.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.9.0","@aofl/register-callback":"^3.9.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.9.0_1589565491562_0.18452190490780884","host":"s3://npm-registry-packages"}},"3.10.0":{"name":"@aofl/store","version":"3.10.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.10.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d2d689307743d421ab23c1cc81bf87cc097312d2","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.10.0.tgz","fileCount":17,"integrity":"sha512-Mn46EqFpFzmCAGwk45HIP3s0d+87G8ikIn6hYM2AN6PB98wHcQHLDN/7zO4zxGtjgXq5rzG7k0ZH7PwL2fsbOQ==","signatures":[{"sig":"MEQCIHCsoDrhcT2wzkaz8yL6UzCCfKWYY7NAjibQRQ915EbJAiAYdkVN7NqIH6hdAFp02Lm4jbH4WpRkf3l0t6N+v2vWlA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86310,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJevwZzCRA9TVsSAnZWagAAFHwP/RU9Pl5uyUkMqUu0Rec9\nlMRn665Hf/1oJPZNowRN6hSxZrShGIJxUD5XK0s2uLN1Oqr5veW4kNOSSBPQ\nVelDgxJCrhCcUogCjMX11d9MVNpad7+GRy8gZp9CBvX/6a8RoLk5gCGYN7Hx\nnPKTuyJpAJ9VOP+bQlTLuLf4vyci7eyM76aTxyw+QpL6efB9KKUPVbrca/NA\nbw20+n/A1F5LJ/VbWvI6bueQFrCtJkgZFtbWemxkB8fKFETVVFNyLvewgynz\n0WgnKLhh7qw4fbhZxIKalIer9c1Vp0ki9+APx99JDYVSKV2bp12+5UmCzXEF\ni5vxyBbHMeRiWepLL7z8pn0XSsnZ07Ix+NHjXNHAPrT91VdX7llgsI7nyRV+\nIk5hNF/IYHLOaVWy0FOk9OBblkQ9DyvAZHcD2LFX20PO0ja2Tr/IHbDcAjZU\nWjzwQ+fzEUVtTeFxg6FdxfBZii3GpW3v61iF4kQllJGJtRmctOA8XwT7fFPQ\nAU141fKFcRnsrc+bKGp3btMMQ1pYakyDVAv8r2Jyga6jSiCF6NgWCs2syFbm\nhSwoFhKRz/s8AixooRXALLQEiazT3KA/aIjodAnrySwTBsZcMCVEoXVB7cBx\nm5oaTbAVtOhhcVnSsW7cKqfgWiV9UXy4vTLYezIaDEBXVIznalC7KdXrmaHv\n45EI\r\n=DaiP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.5","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.8.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.10.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.10.0","@aofl/register-callback":"^3.10.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.10.0_1589577331035_0.1212568118047972","host":"s3://npm-registry-packages"}},"3.12.0":{"name":"@aofl/store","version":"3.12.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.12.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9f2b048e6656fe65e5e3c87719a15bc624ec71c7","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.12.0.tgz","fileCount":17,"integrity":"sha512-h4HY9JlCCuepK+CBcG8pqnpbxhohKcma9rech/INkYj+JEQAYYetbiG8n3jQn4DIC7GZVwqKt/9p75o6CHrECg==","signatures":[{"sig":"MEQCIFfEfdzIAXvKru5T1TsNyW9XLTqpuFYa1DCTQtlJeTxlAiAOdjCwEcW6mOcjrMFqNOfCA2gwDFwHPXPvEc8Qk9gMyA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86310,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgB3LtCRA9TVsSAnZWagAAF6oP+QFbZEpmYMT6A/tMmoc8\nwvTeARTjGdkjfQnWkLGXZel8ynia3B0pAM90GTJ/2qalGY6RUJS55t/OHE3H\n/PGz7vcPK7XyhAiS0wvcHD4u/J5WiodPRWcQa1kzzOaYxod2cSgzMa9EClyu\nlHDhNruLe3SgHx6mkQNG05UteOitCoEygfCE/ElgGgHvhoagbsCZIO3YqqH2\nZ2sQUSSNQjjbSbfG4JFVsu98Xl5RGNJ6mKerpUrlqSPzJDzWu9xdoJHBnJQe\nFcAHOYwZQrwK3hpCS7YTLsGrKHICmc+YlQt5+OYwRZza686oRhG2HVgSguk+\n1u4gSPd+bPiTrJzY8IFwPylcYDjb+bgs0adjCuoyIWiWPM/IRjDT9y1IBXBU\nxNJtAEFjv4Mal3Hb7w4I+cV53cMfQ4UY3z3L4N14VuHYujXHic5ZcZhjOTo7\n/ytFQzpG9YbbcrY5p/WhbKJ3Gl0aSgQKgbD5yxreTP3WTnFSabqi7qO9ERJ+\nQKR36Z4IL2l24FUYYKKivaXwIIG8ZHczsdJkFZwXHDyRr31kSdsShdOV7AJQ\nra39/oBxabU6raiaMpZOtLgiHfopzRlpg5t+xoBg4N7fd6Ds0TcsWdjb4F0g\nFjZqXEYiKf1GlrMwaScZVoLWL9UX6M9gE3xiHtSo2PdwhKtnTuk46hgXKJN+\n8BV+\r\n=QWIW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.4","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.16.3","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.12.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.12.0","@aofl/register-callback":"^3.12.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.12.0_1611100908630_0.4025152345496419","host":"s3://npm-registry-packages"}},"3.12.1":{"name":"@aofl/store","version":"3.12.1","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.12.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"bfbd71d0d4b7afb5d8a9436bbf6c928cadd6f97c","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.12.1.tgz","fileCount":17,"integrity":"sha512-d1pUFhbiDFgCbzc4JlH5rNJ6IZncdilBEWHVl+pEnMuXlE9iuhDUbgHsVhM/Ufzcg8oNfvuy8yJdGulVPVXmhQ==","signatures":[{"sig":"MEUCIQCDBAjUtPB+lF0wSmM46Vj7UrkRD6MG3GB+6W663EYSJgIgfxD/znmluQmruES6Fhf/wgT1zN3eM6EpRJI7mCXoCBg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":86310,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgB3V9CRA9TVsSAnZWagAAXQAP/2KVEFOH/6kBS0IQUl9u\nFlFl95KvVMdK1rNMPgQTeVdo/DoZjhNTexMFT6mSZW5NiEKGRAyQgjqvfq0J\nNOHm+NmjvBV7r8stjS2VedWUUsotz4rx9HFQetQwyIA8KdbGuqX/3iADvYQj\n7B8jxtPbJqwEp7UWZeemwttkKxsgU1Ay4JzY5F02CpRs5hqHLcm7Ic/vyQoi\nbvGhQ1o+mrlg+DK1xpOgfG0939zbLzdh8DF+a9DB2/GQYw3jkKqm6mXjnVBv\nwe9UJeLc62l5s/x7ywGCTjAdME+qdXS58s2UNC8GhCQV0RNUxpBFqTr7xe0f\n0ExuE1w9uVQVAVKrpeRfed5eyoxZ79RzMt4G0wylswaI17hS7INXIAZD0LsS\nxC323Brl9VmrL4igTVbwpMgB51DXZXWvEZLxMo07kBqxfXmwr0N1NWiz7t3V\nam6cQExkkv0/gb9bLOLjxnRIAehOCp3RrIoyB4y35fptRzOqTXZqVnq0Fpth\nZCblppPc+3413HDRlVuBF1jjEUl2yCZK6ew2RuewajdLTCE/H4E6Y3dapONj\nYUX3EoWwKhw00Sc+apAyVMKC8i178uMZPPxm67dPilRFuKMEEfX/9/J5n8JY\nlch+cdBD4Neej+kTgwC1kBAc5BOR8c+vhqRl0hO/UT0TM9l1xrWnpd+yx919\n/7Ag\r\n=h7Nh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.4","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.16.3","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.12.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.12.1","@aofl/register-callback":"^3.12.1"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.12.1_1611101565322_0.33885327588585157","host":"s3://npm-registry-packages"}},"4.0.0-alpha.9":{"name":"@aofl/store","version":"4.0.0-alpha.9","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.9","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9196f89393bf5beb82269110492e15e23526eeaa","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.9.tgz","fileCount":17,"integrity":"sha512-7cclPeQh86jhMc3w9Ss4IdyALYoWl+6457eZjHJhkm2RznORuu5REFw4WKZkOPAx9ZommlWyN3zjAZ6UyQnuow==","signatures":[{"sig":"MEYCIQDKfDTUfP/qB2e1vkWfPQVmGKaWBUYWIoqtXjhnZ631zgIhALAdYTkv/Tu+L8L0DkQuLG0M91YQUTJwNP0aAMg+swdc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":81170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGgDYCRA9TVsSAnZWagAAWioP/3yklVDShUnM+P0CoPHP\nMH3hxU2UWvQ6Mc/sWzCXjclpI0KMjR2UmE/gCcrMhHytkY6WPMBxWqU71X1X\nDLNwOiL5woPVJxQYrebpI7DgCrjHh1i7rnQJQImEihZG8OG1B1H5NWMdCNMU\nM3+2GY6rapMT1Y+nIbpAWgKNJNT596GLRKyoXV/HuUnF9gyX8piYP45R+PLt\nyYWc6AHyKBfzE3ngMbVT1fw/vFivtPsuiXBdIZEV3C7RxHRuyEHTtOgOowqg\nOuRa0fy/y98okiQH9kpCEGMvxpjdbYsiDv5j1y3C64zCUPVfA7V2hhzXMjWA\nFFsLm+5dX2m+sdxHqCqmNie7pSMr5W8BmwYXVmJ3VMForFhoIGLI4iPXIwLN\nodDWDE0oRUR+YWGVUU5+4k1RtkvLDsKng2soov0KO9l2KsqqququQ+0XolZc\n/r1hAg3fZ8hsX4Ehac7IJNNdsCIj9mLgJvGgHunlS7sdq40TDAE1pqWkg7BS\nI5GDzWNmKg6s2zmPiFQnDjlN7R7T0xKKYAdObMdLAlnljWhDjbjiGxkfbg4m\nyNqE8D5N86z431ekGwbP6pSkXHFZyTVNPO/pgjPiinc8CURdAhIYRCUWhMm0\n6WDvdySxap/oBRyg8QKImgRXmuj7vRpK3LgbENTfQN0RXC8lpX+cNI2Cjdaj\nBz5H\r\n=Ke0g\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx @aofl/cli build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx @aofl/cli build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.5.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.15.4","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.9","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 5.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.9_1612316888334_0.10733878371470618","host":"s3://npm-registry-packages"}},"4.0.0-alpha.10":{"name":"@aofl/store","version":"4.0.0-alpha.10","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.10","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"41ee0d945be42abdebf66e5e202e1d11bc2dbbdc","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.10.tgz","fileCount":17,"integrity":"sha512-HA9fDT4yicsUTPWop3yYMJCD8kGYYjbVp2oydBCT4eTJopAipja/st58EieD+Qd+lGf8nyzwSDE95XTKyD9rYw==","signatures":[{"sig":"MEYCIQCqTQaAgX0QMyNaGeswOSEZLGK9lXZbH64wIZslXsAsGQIhAL6mCyf0PgtTKT+/1P0xBocBHovbC1SvQgpacU1Dz4aJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":81156,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGgK9CRA9TVsSAnZWagAAWi0P/3zFIIrfwy+5jiU7uP01\nMR3mohg5PQdI9nG2bit5rCT2pqV2S+aimSF0AvmFcoYIjI1GDBmQvHRAu9k5\nSjX+Xstv+7ZAE95yINgHtPgDrZURQI2clE8TtOBaKsefGbqKX/8WMHZ3N6h0\nBxWps+lflDHqF8q7Dyqg5CakPuWMj9S/wr5UqbXg8FWJBe3ucT22bPZGLnBE\nF0v52UJaX/PU1z9H+d5CBGrAKshCJh/tpMyC3JM5p2vSs0E1H0NRj52i/CnZ\nDky37/k+rp8muxoZXg/Ofh3PR0rSavWeQBuUwFLvUadE7PJR8WTWFkmVwtuG\ngLoOAsUWZb/JHfjWEStek8Cnl+DRdDODx/SOf13UE7r4T/YtCSH1SAOya+8c\nFJuQ9sts1Wm6s4fY8hi4/PsSSWfGIKLd2HmW+dmwfYn20IrAkJS7y7TsNYdc\nrVzdlLKkdEzc9dXklUuUrx6pve8ZwwSGcrOnonsjoyyB1IYkxuFXw6oigEPM\nF8L7MpcQV4vcjrpRXg2yjnDDgv/mamhf6HVLOfUsScCLbXow1Hn+mrnsrHkD\nJcnnJKHecCRlSwuNwo9iIdOxI1f+i7460SVhqe89z2eRzdowfGSPGtKt/IVl\nljWJEgelTyyEmguMAomDD6lR4gQBu3Wl3MIpEY90ltgmGX+SAeQm84fjo9V2\nmUqz\r\n=LSbh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx @aofl/cli build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx @aofl/cli build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.5.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.15.4","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.10","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.10","@aofl/register-callback":"^4.0.0-alpha.10"},"peerDependencies":{"@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.10_1612317373103_0.3709019472195225","host":"s3://npm-registry-packages"}},"4.0.0-alpha.11":{"name":"@aofl/store","version":"4.0.0-alpha.11","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.11","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c4fae5ee53f953af048b2fe8ebfcc67e2a28d2aa","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.11.tgz","fileCount":17,"integrity":"sha512-bqzhABbW73VIx3vyKlLBkzcKsqD1elnPGuglg8tfpR832OortaROigKpdoAPgkkka2lF5RZ5giUJVYCVM5Reew==","signatures":[{"sig":"MEYCIQCGZ3DyKefuWPxZact1PF2wR+AMix79ogZ6pVntiJDpGgIhAObFmqHegL6qxKSv4Lztt0H4cqw0nXJSlVSqGghqOqak","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":81156,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGglTCRA9TVsSAnZWagAAcpkQAJlC8raTa3aiqosvCTt9\nFtHD5F3/qydHJYzeN+Z1LAdL2YjPv2VNskvF1ukJTrMs+IvdlwLMTf98hoj0\nhm4qDCS4tbYJC/OcINcyhjvrF43BgQ3jsiyyNMP1LN5Kiy2kvg9Ftxn8ATr8\nLh/7q0MfagewrNHIVfVVb9Hq4avfdLdzs7hvbO7MtgESMTumcDikQlfs9EGQ\no7vvWfnrnp22bK9ftIssmz0m4hfSaXRuArLT29wuun3XCjihshu9mq7MaOvD\nRTysCQ+BDFwouFEe/DfS+EKUq6xXk72ogSvdl/OtLQg19QQVRLyEWbbgHija\ngDkRBobBJiwiwXDbUXyMbXC0nZnt6iw+iyYMXRu1BvBx12YewqHKgGQThYEi\nkOFKXy5PEjDdqBjmYYS/Qfna5KtZRd6P5CpcxXK61pN59HVQaplRlUzM00WL\n7UDyq9xPQM2KGXAKJpBZeHBk9jZ7jcOb5VhFPwgJFo5vYx3nQyDmvG4QkIGm\nsPnMkoNlXjnYWIIOkQRmDQnKbIVMa1ccahgmROasI9XLvZU/a8P9J8YVTivq\nugECv0eG6tmCAu0Yb+wKpemHn0DM9COLzagWiTG6TsPPIhEEdTgb/4Y4raMr\n+iMVnxlzk9p2oNqbeqMOOYRVaJuEtAnJIicaOCG0sj034WKctL9C1EpwViqu\npB6R\r\n=G1ag\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx @aofl/cli build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx @aofl/cli build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.5.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.15.4","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.11","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.11","@aofl/register-callback":"^4.0.0-alpha.11"},"peerDependencies":{"@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.11_1612319059158_0.6377557863058128","host":"s3://npm-registry-packages"}},"3.13.0":{"name":"@aofl/store","version":"3.13.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.13.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"6875d52b0917d01f555d2222b7aade678102bc8c","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.13.0.tgz","fileCount":17,"integrity":"sha512-Aux3cnDRL3NHkWPi1zvk0Xr5NaOs9iMyMyir4y1ZC1s1rOP0Bj3O9gTqyByYlMoqbrtE3+bQFfFOhxGUDnj0Dw==","signatures":[{"sig":"MEUCIQCFPrDIrP6iFQO/a3xyJt8u17fXu+1ReUXdXX5r43b26QIgYjHQlQwlLr53czk9qn7Zy6jByGLBxa0q2s+PH5dO6Ms=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":84807,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgODYmCRA9TVsSAnZWagAAlL4P/2tVpL7Sya3xNOWh2for\nvTaEuqzr00mxD1tJm//uG1X+M7aIGTJ2pkXIVfCZWSEa8g4olpfuJ7raIlHM\nuYZGN927bhqMhitSStJTSa5xJVq2OBQjhz+5wrzBMlWnrbLCh+epVvDm7q0s\nueWvOkDIho+XSasIKeuciYJnvT07YiETM4oSk00+VtYplH0K4LQsMzZL9HMs\na9UEHxcqr9+YDfAO+gwo67xKdCdG2PTscU0ox+VNsscVL5l2ltH0erA6VyPs\nd7qvdzjD7N6LdSJmtZTr4B22/0he2k2PX+sFksB/s95MwfU5imiF4d5MpWfj\nE0D0JeI1e9qPNApkf4vj7C5VsOy5SfTqFBNjpu7F8bmaQwI1AemardW0InrR\naOWdwmIyNwEtCSf6tdT/UcwfRSe96p7RlBHxYgMB5N8DFXVMdSpfH3BHm5pT\nLUzjcENyEnHjgexJTAikoLMCtp//RUsCIGnrxXtPuHhqeEtR76/UuOYkOLsk\nbGNLgmTBG9Dm+k10yKO1H0Chc7l0CHC20hTATqGHtAHJ9J52B7Jk0yrOkIHl\nIOwpGaXwwfniRpDqUuwDhqoEcprkuWJzGhfzPEtEV4POREW5wAgFK0MnzJAr\nvOf89CFiq+ZYdUs0jvNmXCYJs8pOq+vat2HyjvUTIlAV0AhoFAiKYh4ABVAJ\nE335\r\n=k6LS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.11","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.13.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.13.0","@aofl/register-callback":"^3.13.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.13.0_1614296613460_0.2463127345753242","host":"s3://npm-registry-packages"}},"3.13.1":{"name":"@aofl/store","version":"3.13.1","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.13.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"dbf946aa4361513b25ddb53714353c5f6da07955","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.13.1.tgz","fileCount":17,"integrity":"sha512-Sg6Gqm6nq+x3M13gGzzMCApM6epoigsOfEV9+U9EWtq0IPWbtH8jJ7WNV+vHkCbBbXvyjApcYHyd5uwfHeXUQw==","signatures":[{"sig":"MEUCIQDzKujRlwwJ9w0khXoaqbCzu7BRlp7/GL0MVkKZsNpxNAIgCSTv7iISIeOntYxCNkZybPiiFOegHgcQ2NaZm534slk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":84807,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh11rHCRA9TVsSAnZWagAA8RsP/j9OOHW8GOIegEW1hOqc\n+zNAMrTz0Nrb3hbq2aiH7dNNTiuSqp1fgjfUenfkLcOQ8eHsflNh7piVLgYr\nL3CMCsOTBYKzWfoHRpafqbVnfDA/eQdtx/dWJdv94aQ59yCY2FxIPqmjaNgi\n2FOYMQ6IHmn2d+thaUW7SnLI+JGIxSSXKLC2CTJLmJ6/Gtr0giuwMfoxfAKo\nmSVsqDVrGhNDgUKnecwd5JlGbjtiRMuQPIcoXz1wmEOK86zzlgr0anTE9K2H\nUjsse8eegURxZ1vqTTCtUGsX23trB61gdaPRMKAIlkOjE4E2/pyHtMGxqG94\niOOZ8ID+2biYUoonS1MaVTHPXB9uPSzlQu4kkGBPEdYccgYApZ7XB/vKep50\ngPsEgjsJDUDLUMtOUz7FxPgF6pGmF4H/SpPu4l5ALWdw+4P7wu6/61706gis\nbtvYkIAaAbxyG/jb3e7J+SzwcW+FRkUSwokM/G0Dzh7fbYNr1vhaBJLc3s2M\nRycJIrd1zhPsj+rMfhADLiG3CTtnmwiXNJ59cT7hnOROK9mvFq05f4kj+anX\nk4ie9gFOLQhPE22TW740bzCNtxR0i0ixrNsYjMd9vDSqQG8841Me7OsIGtER\n8B9I9ihWDoPTYN7Qt4bOHlrYWimA87tkNzf5+IixZ5h8CnsRkX9wiNXR8lhH\ncw35\r\n=A8G9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.11","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.13.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.13.1","@aofl/register-callback":"^3.13.1"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.13.1_1623800926582_0.9870288589300886","host":"s3://npm-registry-packages"}},"4.0.0-alpha.13":{"name":"@aofl/store","version":"4.0.0-alpha.13","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.13","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"efc72119749ad9f7aaaa9cfaba029034d28d232c","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.13.tgz","fileCount":17,"integrity":"sha512-lPSi3Gslss8Se9E85/tjdgu3esSooEnZJ8DFNxa3l8P4U0RCVGNz8tvr3wqj4zFTkLVPGcML0d67hhMtwoaWqw==","signatures":[{"sig":"MEQCIGSmbfLj9nLKstBIW+6dpmtAqIKxPAiV7GsW44am1BYzAiAc6T3erwc8gPIgA12C5ugbIfLMSg+yeXG34WrOlN82AA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":79187},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.15","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.13","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.13","@aofl/register-callback":"^4.0.0-alpha.13"},"peerDependencies":{"@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.13_1632439930062_0.2702445715645161","host":"s3://npm-registry-packages"}},"4.0.0-alpha.15":{"name":"@aofl/store","version":"4.0.0-alpha.15","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.15","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"87d8c700da6a471107cdc69de975c2866f7ba524","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.15.tgz","fileCount":10,"integrity":"sha512-po1jK0bvZLHuf5kuSDW11tMx6fcvGQv5Ex/fhG7TfFveOb2HzcwHQlojUkDr78RiCmeRjpV/Wpspgs6tu/Lx8w==","signatures":[{"sig":"MEUCIQDOlfsYmwE16k9cey7M2hb0PGZ9bvLsnSKj5vBu9eTVfQIgKc9Yt4nUcTKTVc+O3kqEaJGjrx0exQbfs+7qdrUTMK8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53834},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"7b448cf64b30502883b3422662a9480ea25f2d60","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.15","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.15","@aofl/register-callback":"^4.0.0-alpha.15"},"peerDependencies":{"@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.15_1633539833549_0.2844202025370284","host":"s3://npm-registry-packages"}},"4.0.0-alpha.16":{"name":"@aofl/store","version":"4.0.0-alpha.16","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.16","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"6dcfef284f9baec58754a68f5a8af6eccf8dd494","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.16.tgz","fileCount":10,"integrity":"sha512-+YtdTIy6I6UYeKLRNHN0mCIMRz/fGBcg2N1KylX0i0IaD2IbGqLXdyqZkod53Sd1sEBqCgxx3ZNdxTp2afldiw==","signatures":[{"sig":"MEUCIQCuvFJad+fWoreIx9jnKIVjb0rx79v4wQD9WPm3HziSowIgTMkg+kvi4GTEeUYp5tSV+wMD4PeTAL/OEKQoh56/mTA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53831},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"7b448cf64b30502883b3422662a9480ea25f2d60","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.16","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.16","@aofl/register-callback":"^4.0.0-alpha.16"},"peerDependencies":{"@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.16_1633539908692_0.7255173189777013","host":"s3://npm-registry-packages"}},"4.0.0-alpha.17":{"name":"@aofl/store","version":"4.0.0-alpha.17","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.17","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"999c2a4e51e088aaf74b04e61a86b048de923abe","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.17.tgz","fileCount":10,"integrity":"sha512-6Bo7JeGnc9vJn3oHmMnCgjhcvP5RnNZ8ObWw1+Lnah9MXsNnJo9Yuergsdmp7arBTqrbne5RVhG4HlYKdnw4PA==","signatures":[{"sig":"MEUCIQDfoVuLuN+90cN2jJQOB1m19HUoYRKt/WLRLT8ofCiuTQIgNZuacGfBnjEfEsq2sNIo+d9I82RjuA2Xum5yOPkCVXo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53831},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"c7b3ad6feb17eaf3721a5528e86a31ddfb350ef3","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.17","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.17","@aofl/register-callback":"^4.0.0-alpha.17"},"peerDependencies":{"@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.17_1633546051326_0.8552508105604364","host":"s3://npm-registry-packages"}},"4.0.0-alpha.18":{"name":"@aofl/store","version":"4.0.0-alpha.18","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.18","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"bffdc52b00881f29f497d6068e9bf7b95261b974","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.18.tgz","fileCount":10,"integrity":"sha512-ft5TfvbXT8MabvVRVbgf0FyEMfiAO7fJ2mFvURLJhE/+OYN/6V8k7KoB1enTWpY9Zmi4ZRMg58eZ1NRyBqksFg==","signatures":[{"sig":"MEUCIDv99RFkaCPX/MPE4pguA30OmDKQIfQBX4EK0DcJC+b8AiEAwAAdC9AwKPCE0Nwbtx7JDLfW6w8E8NVLWdxOgcYnKyw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53831},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"3971875a8be8fc1e4ed7f6c737cc9aa1653e049b","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.18","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.18","@aofl/register-callback":"^4.0.0-alpha.18"},"peerDependencies":{"@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.18_1633563633518_0.6701017019878415","host":"s3://npm-registry-packages"}},"4.0.0-alpha.19":{"name":"@aofl/store","version":"4.0.0-alpha.19","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.19","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"341cb3827905f9e17fc7122bb5a8e12ac29d5699","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.19.tgz","fileCount":10,"integrity":"sha512-PgdCCRQ68kj3VtkdsNSzQH65pq7MYDiGV+bquipudqGTW/XZXp08Lmd8ALgWe1m0dHH0Y/lUhE8Poyk7MEJHnA==","signatures":[{"sig":"MEUCIQDaFpsN1lRflN6qpE2mKDU9tUEaUG/oLG8xvTNEE8moKAIgZhLMijKE8Ld8L67MYzd3hTVWk3qwrpVK9gGc7DsbXko=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53831},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"79369e766cd4fe78098059b93d1cbd7bb5dd8830","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.19","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.19","@aofl/register-callback":"^4.0.0-alpha.19"},"peerDependencies":{"@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.19_1633564049411_0.8384680337738681","host":"s3://npm-registry-packages"}},"4.0.0-alpha.20":{"name":"@aofl/store","version":"4.0.0-alpha.20","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.20","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5432a6f1e8972d352b330afb5c6990a96faa2c11","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.20.tgz","fileCount":10,"integrity":"sha512-0fbLhDPwbnYZ93AAT6wA6DTD6gEtcVSLPsWnB8cAEN3vqgaE3ABNCENX6aDuLUEirJ4lJopoO9GI51SjuB79qw==","signatures":[{"sig":"MEUCIBoqrsaih8uZhBpWmigXVHFN9OGJkG3jarFHxFXjo8nlAiEA4KQ8OM2fVk/xhBut+/SJSI7U8Gq+d86/pjskUzllnBM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53831},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"398f195bda4d61023d6d7889598f5688c276f1bf","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.20","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.20","@aofl/register-callback":"^4.0.0-alpha.20"},"peerDependencies":{"@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.20_1633564496838_0.7101952984055593","host":"s3://npm-registry-packages"}},"4.0.0-alpha.21":{"name":"@aofl/store","version":"4.0.0-alpha.21","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.21","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"bea8be44cf6948b39334eb28c97c4b609a968148","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.21.tgz","fileCount":10,"integrity":"sha512-YSnCYGIcpuae6/65IY1WD69fWzUFZV3Tg8K1LCVjBSPKaUEbaPMlHteKxew+INlJbJ9c+c19vBFc51ss3v+kDg==","signatures":[{"sig":"MEYCIQDMPh7DJmlgIsjqWaXrypCZbSRUgMLVXdDp44SUdmJKrAIhALFNDYQsLo8uryKkngiXcRvrweD6c50lHzn5B9IYnpUC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53831},"main":"index.js","module":"index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","gitHead":"398f195bda4d61023d6d7889598f5688c276f1bf","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.21","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/object-utils":"^4.0.0-alpha.21","@aofl/register-callback":"^4.0.0-alpha.21"},"peerDependencies":{"@aofl/object-utils":"^4.0.0-alpha.9","@aofl/register-callback":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.21_1633712760480_0.06360246107384326","host":"s3://npm-registry-packages"}},"4.0.0-alpha.22":{"name":"@aofl/store","version":"4.0.0-alpha.22","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.22","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"e50b1a579c6501e5cf4627005f83e42f544142d8","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.22.tgz","fileCount":36,"integrity":"sha512-Tcr3BWmFO1/G6RCnJlZweigsbQyf92y1kfLO5j60154S75/nwJl380lYlJrxXOxvmp9RMmdarYu2xzu1r+U19Q==","signatures":[{"sig":"MEQCIFnWP4EdQPjkgngPIrU4Cq58tHvtR+JvZIJsjCtdNioMAiAHAeUdyXbH6YC7O1x2MLyhK3UeXbF6XqjXHN2cPsffng==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53546},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"289b7f60d1cd721d68cff783afc623c3f51cc2cf","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.22","@aofl/middleware":"^4.0.0-alpha.22","@aofl/object-utils":"^4.0.0-alpha.22"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.22_1633984776779_0.6599452632336789","host":"s3://npm-registry-packages"}},"4.0.0-alpha.23":{"name":"@aofl/store","version":"4.0.0-alpha.23","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.23","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fcd75a880d2ee329e1debaceb61c27f758725b22","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.23.tgz","fileCount":36,"integrity":"sha512-sGUEcibHJ2mLVo2mTG4b6gQmAXx3ygekORJWGpAvo/s78vldTy3MaVuQKEQJmaYpkbMFboj8zOLH+WYMitRlpw==","signatures":[{"sig":"MEYCIQDb7Z7zqxssDM9xewsVcv4iLAnc0ya71STYSFbyEbqplAIhAMZlxaBmnxrYVVRgJEpoKO42teRs9Dn1usajbc28fzQF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53546},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"a2829d023883e5cc51126ee549f70629ceae8e8d","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.23","@aofl/middleware":"^4.0.0-alpha.23","@aofl/object-utils":"^4.0.0-alpha.23"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.23_1633986454636_0.8667475524219221","host":"s3://npm-registry-packages"}},"4.0.0-alpha.24":{"name":"@aofl/store","version":"4.0.0-alpha.24","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.24","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9719c55384919e6269c051a04dc28a40bd7f4fd8","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.24.tgz","fileCount":36,"integrity":"sha512-/uQvw+G2zPHzW1In8YBtj21rZ0T2+EMkadW6Dl/4n1gf/KXj/NjI62zoBYmIJ16q5okgz9jZjUyINP/4nuqqXQ==","signatures":[{"sig":"MEYCIQC5nf4b9sByj2iUFcpgmMgxTQ3Ci5dsogNH0oA2aZ2jBgIhAOIQPnL21hpm2pR4WaYVT0t4uJcjCRkCVBYan3L13/jq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53546},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"a2829d023883e5cc51126ee549f70629ceae8e8d","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.24","@aofl/middleware":"^4.0.0-alpha.24","@aofl/object-utils":"^4.0.0-alpha.24"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.24_1633988826464_0.4306570742695639","host":"s3://npm-registry-packages"}},"4.0.0-alpha.25":{"name":"@aofl/store","version":"4.0.0-alpha.25","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.25","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"b92b16a5631839f0a44af3b8a76fbcfd13cbfdda","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.25.tgz","fileCount":36,"integrity":"sha512-OwKFbsgsfweSAFJoBudby6AsMKVbFng1VfLXQLeJ72ZpvyIEmQYcxdsPYSMAs82+upLVUrc3cVJCq2sU8+JAIw==","signatures":[{"sig":"MEUCIQC26V7ODusJgpQ1XUXhF1XCTFQWHNit8kuwmnRqLLr4WgIgENyP/L3ZJGC4PieJZwTMwieJTdqSg4fmEFVp6Pu61rY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53546},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"8e4d611be609be11acccb9135091aadd10134e8a","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.25","@aofl/middleware":"^4.0.0-alpha.25","@aofl/object-utils":"^4.0.0-alpha.25"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.25_1634001656942_0.1642589872589566","host":"s3://npm-registry-packages"}},"4.0.0-alpha.26":{"name":"@aofl/store","version":"4.0.0-alpha.26","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.26","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"049434c09ddcbda1a2250c35cc69fe544b080b22","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.26.tgz","fileCount":36,"integrity":"sha512-tGqXTBOWIeltkJv3CQ+6BioVhWn3pBJa/BbEaD3h/jZAAwtNxZzO/C6GNgKc4ilklAr4YaBTisBfBZnVA7AbbQ==","signatures":[{"sig":"MEYCIQCIVQYdP2Q+NHeOiD4Lu4Srvji0AfErnSzsZXRXQ48IzQIhAJFaEQP5IrHtudXL4MHyzWpXKVNC/YnrthKXdHB2CRnC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53546},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"bdd06521b3653befa1b4c07318cc120a700672b2","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.26","@aofl/middleware":"^4.0.0-alpha.26","@aofl/object-utils":"^4.0.0-alpha.26"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.26_1634002486719_0.4564716631550292","host":"s3://npm-registry-packages"}},"4.0.0-alpha.27":{"name":"@aofl/store","version":"4.0.0-alpha.27","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.27","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"e3fa56add8d75a6f8c305785e68e2a3bc6125ce1","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.27.tgz","fileCount":36,"integrity":"sha512-fW6RjWKfpMlfvHLZ7vIlawAwFg2qausPb6qHrf1c0RuwmAj40ZJEzsoBl+Q9S7L2qjEbiHvDKAsn7hnjDr9pDw==","signatures":[{"sig":"MEUCICXJUBVoTjIBY+ooir+H9r3eLCY9EpUa5+XIEV78gv9aAiEA3T/wUaMN/MXMXfirHChifYzWnDwuSbEpLjrcynwV1pk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53546},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"bc755f21b39459dc3a8b57ab25075a22313bc107","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.27","@aofl/middleware":"^4.0.0-alpha.27","@aofl/object-utils":"^4.0.0-alpha.27"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.27_1634152004855_0.12759599123662935","host":"s3://npm-registry-packages"}},"4.0.0-alpha.28":{"name":"@aofl/store","version":"4.0.0-alpha.28","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.28","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"7b9ee12943849b3a8566651006a47beb56f3db64","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.28.tgz","fileCount":36,"integrity":"sha512-lcvPdxJAsZcbw6snDMt+o/lYbXJ0KoeVL+n2duA0+MigZvVjIm+GKTcqqvJdw+7pWNOPy6iMBCRovvYiGpi/Kw==","signatures":[{"sig":"MEUCIQCXRYJcc8AUTQimDvDnSUR+A8l1xmU/gmVi4WSY1eu8PwIgc3JQnyH3zM3RPAuCdLwT3DQPBoyFxREcdOLpezT4STs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53546},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"7dceb248f691c3214f73ba1d048f26b2653bcac1","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.28","@aofl/middleware":"^4.0.0-alpha.28","@aofl/object-utils":"^4.0.0-alpha.28"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.28_1634163515425_0.20623996550698598","host":"s3://npm-registry-packages"}},"4.0.0-alpha.29":{"name":"@aofl/store","version":"4.0.0-alpha.29","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.29","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"1af337e4c9d0572eb5627f198fcda78af165de26","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.29.tgz","fileCount":36,"integrity":"sha512-n4+3VGviiq35pjYUVq3bLKnQdpwkQG7Dp01PQ4MeAQ3bokuBX012qt9dZB2po9G53b75V/m8uLOzClO79xtlbw==","signatures":[{"sig":"MEQCIDPQUIDdojlXG2bzMlE+wIfo3UXZLOs96hV7i0OgYno8AiB5zV8OyDTcvJf/hPoo+UDNlvjZXOOQp6S7QYPn1osWqw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53677},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.11","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.29","@aofl/middleware":"^4.0.0-alpha.29","@aofl/object-utils":"^4.0.0-alpha.29"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.29_1634319365653_0.19777186337113317","host":"s3://npm-registry-packages"}},"4.0.0-alpha.30":{"name":"@aofl/store","version":"4.0.0-alpha.30","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.30","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"dab0c6bec1a34cf9f820f3c670082c38b1af8b08","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.30.tgz","fileCount":36,"integrity":"sha512-MJjcza9u+JPpNGYGUqp69Qvkai/o4g3gEruZBcqMfoqNz0XMgkJIhy9X3UjFdamzomWwLdGAbm/R+c7+a4g83A==","signatures":[{"sig":"MEQCIGaMdqHZoCREgWyggH1fby42Z0iBWadjZZ4bTongnolIAiAK08QrVht5dqZhx7IITshsSg2Pppq88vZj2lX/YZ9LtQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":54487},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"13ed83fe4429533b22fd669328dd6c8829dffec0","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.30","@aofl/middleware":"^4.0.0-alpha.30","@aofl/object-utils":"^4.0.0-alpha.30"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.30_1634323872917_0.9140016959462822","host":"s3://npm-registry-packages"}},"4.0.0-alpha.31":{"name":"@aofl/store","version":"4.0.0-alpha.31","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.31","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"8b0947e86ddeee19cdc2e6eb8d4195bfe125cd5b","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.31.tgz","fileCount":36,"integrity":"sha512-y5m3i+4L9DWoDOcguKseCwwHy+MLP7PV4lyqqXvytn0CX1SvcWgATbM4046nvatYxZ06+g3qukrUT1O0OQHITQ==","signatures":[{"sig":"MEUCIFNHRZVWQaKNSKXmUHsgsX66VcLMKRphxDeT6hgdIWrDAiEA1KzkbCvpR2jDtsohpbh0yXh97vMZrWo+Vm2Kyj0vZq0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":54487},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"5bc1713dfbc60e5029713b6ad88a4a9fd46d3413","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.31","@aofl/middleware":"^4.0.0-alpha.31","@aofl/object-utils":"^4.0.0-alpha.31"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.31_1634324136846_0.09231554114834228","host":"s3://npm-registry-packages"}},"4.0.0-alpha.32":{"name":"@aofl/store","version":"4.0.0-alpha.32","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.32","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"0c4f7017f8762e0c08eb280acf20a291b830f608","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.32.tgz","fileCount":36,"integrity":"sha512-81rDDs3pMdRsAclgN9lFxdyA2eorvDviDtSwc9Uh8ET2b3OfYhq4+bCOXkCoACXWCVenRFt/VbDnoPzBYSm3UA==","signatures":[{"sig":"MEUCIQDsSROzpU67QLPr6EAZVHr0cL4z3rbXMiSaal2oGqrAZwIgBes1wHI09IMJnvdIuymXc5U9IjoN3BdlY2LSX0FLTQU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":54612},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"77786a7e5219aff408e59d051e8380ca1a63021d","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.32","@aofl/middleware":"^4.0.0-alpha.32","@aofl/object-utils":"^4.0.0-alpha.32"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.32_1634326799304_0.6979228819462084","host":"s3://npm-registry-packages"}},"4.0.0-alpha.33":{"name":"@aofl/store","version":"4.0.0-alpha.33","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.33","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2225e58458322382c4905c96307c6f6b046140bf","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.33.tgz","fileCount":36,"integrity":"sha512-c5ok/xoGuK5ZGQ4lbHULLI8P100M8A0gTIPfr62nXGElZpG19K01o0ofNtDUppNnjU1z+mZ27GP35YYL7yMwjQ==","signatures":[{"sig":"MEUCIQCCsp+4mwfBhmRKEfI03WgflAsn7c+d9KA01G7WVbdovgIgRDBqIWGVqQqqZRo+aeq4XDNiXvmLvlh6lQfD0rGu5K4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55333},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"41b432602965620ce989f21e02748f53f69f7ea5","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.33","@aofl/middleware":"^4.0.0-alpha.33","@aofl/object-utils":"^4.0.0-alpha.33"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.33_1634326999064_0.9216039131620801","host":"s3://npm-registry-packages"}},"4.0.0-alpha.34":{"name":"@aofl/store","version":"4.0.0-alpha.34","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.34","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9452cdcb505a87f768e929897b0b7a5927053784","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.34.tgz","fileCount":36,"integrity":"sha512-qOUjJ6681s0DlhTNlfRd4KUJby3nKOJ6rweR1lOS6ZrLuQpkKLiwpyWMXGkMmeN9+qKiXz+OIEYpXD//IIj7lA==","signatures":[{"sig":"MEYCIQCzEu1uLvD3DhZe3csw2dEcdFNo7cRl8Dheimo6bkQ6QgIhAKQf5zMONFaKGcOwW53NnvM/2JuYucuAeQPouzTZZ/zp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":54501},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"1b993e65b04444692f40eaecfc3dfbb29d50d98b","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.34","@aofl/middleware":"^4.0.0-alpha.34","@aofl/object-utils":"^4.0.0-alpha.34"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.34_1634327604568_0.30606806312397494","host":"s3://npm-registry-packages"}},"4.0.0-alpha.35":{"name":"@aofl/store","version":"4.0.0-alpha.35","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.35","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"694823723087dc8316b95d23ab7402fddda4e158","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.35.tgz","fileCount":36,"integrity":"sha512-utKmRuk7B0Ei+aNr8rvKiVwG3sI+yom6zd/zaa2SymD7aFOhcRx3iys8aNqBJ4svGnciOzoVPQoKMSeTiClIpg==","signatures":[{"sig":"MEUCIQC8JIf1LhFAeldSHlfOL3t+FQohgeKmYpbf40DqrjswJgIgR6w3C12v6NlWAkL642HBUxqxXMml8raaU7L35+xmYkY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":54505},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"5a6a7f303fc21acc73b55413f38f534ed4bfb714","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.35","@aofl/middleware":"^4.0.0-alpha.35","@aofl/object-utils":"^4.0.0-alpha.35"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.35_1634328027546_0.9009989086690848","host":"s3://npm-registry-packages"}},"4.0.0-alpha.36":{"name":"@aofl/store","version":"4.0.0-alpha.36","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.36","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"b0b657deac5d2f07ad49feeb07f09ba642119184","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.36.tgz","fileCount":36,"integrity":"sha512-72JTV0jxMUYXHldfLImOA8TQrkbg6qUyzmFmoxvpWmooXiYlwNi9Zcur3CORGCRvR2Y9gUKFfw1DUbUSfmzzIA==","signatures":[{"sig":"MEUCIFlDjlWJYgW0ulfciy829CZsupflz2TMV4lj88P6fIOQAiEA6cdSXTgOFzskIsrW4WvjHN6FhNSCRkNWVI1234esDUU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":54655},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"24aeaf86244b6f9f352b26d04fd9976f9430bfe7","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.36","@aofl/middleware":"^4.0.0-alpha.36","@aofl/object-utils":"^4.0.0-alpha.36"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.36_1634328239020_0.508760635472105","host":"s3://npm-registry-packages"}},"4.0.0-alpha.37":{"name":"@aofl/store","version":"4.0.0-alpha.37","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.37","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"135916e5a3d804383a06a2a8340428e8f1e741b4","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.37.tgz","fileCount":36,"integrity":"sha512-dcOGkCOqApnFpO3eJaEao9Hdn2h0U5WmOlVJwHugD9Fn8Tj6Nnf7ly+GAS7Qvpntq5QIGTldNAQngkfuVT21LA==","signatures":[{"sig":"MEUCIQCFZhNXOyEJCyyCkVyzlIRvC8I79MHi99WWg1OvupmZWQIgeJiY53b3q6osmSQ8zpNWO3+JJAbs3hUgcRGfZ6cl3zs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":54740},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"d5e9c5a7ef77e315b759fb5bee226aa3bd3aaffb","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.37","@aofl/middleware":"^4.0.0-alpha.37","@aofl/object-utils":"^4.0.0-alpha.37"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.37_1634328401939_0.15913289090548433","host":"s3://npm-registry-packages"}},"4.0.0-alpha.38":{"name":"@aofl/store","version":"4.0.0-alpha.38","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.38","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"b14b682553a1ac5d79e174b3aeb9f149866c67e7","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.38.tgz","fileCount":36,"integrity":"sha512-3pIG9ni0D0v/CS2lmywhIR9L8x66XnC5p+thAZzHn7m9p6yUjDEBxKp3Px6CLo9krHEaXSx9827HVYB5My7PKA==","signatures":[{"sig":"MEQCIEluJ4KoxL1XfWlYhSUzpKgBJjLa0kXu+mcUsWgKPk0OAiAqnkETgyG8kCCxMKogjmc7zhd/CI7SxzJla5dpWjVKBg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55321},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"91457836070b2b300b852a461787c56ec880a85d","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.38","@aofl/middleware":"^4.0.0-alpha.38","@aofl/object-utils":"^4.0.0-alpha.38"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.38_1634330780594_0.8980108635338195","host":"s3://npm-registry-packages"}},"4.0.0-alpha.39":{"name":"@aofl/store","version":"4.0.0-alpha.39","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.39","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"cb67a6d98bc00f18c398ce683acb298520313077","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.39.tgz","fileCount":36,"integrity":"sha512-Hh8wQen+Iw5KmfRIhxAqcwCwmK7NWgmoNJGhcsRE37vXn258A09SheG+FgxK6QwDk0D40WAMC1Ie2NtMFm50fw==","signatures":[{"sig":"MEUCIQDAZ5EciTrcxJWM8gLnYVi+JugI00az1AR6I9DkIHEdigIgbPPV0A9iY+cmUhG6xbuxZCJHKFbvmudIhQoIDbOVB2I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55717},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"f4c22e986eb7eb2e564e469dedb36c65858bf5cc","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.39","@aofl/middleware":"^4.0.0-alpha.39","@aofl/object-utils":"^4.0.0-alpha.39"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.39_1634332217690_0.5643494404499474","host":"s3://npm-registry-packages"}},"4.0.0-alpha.40":{"name":"@aofl/store","version":"4.0.0-alpha.40","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.40","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"6e9e3b0326714edd29f0fe9f5c41703c542a8062","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.40.tgz","fileCount":36,"integrity":"sha512-kYxgjFm/Qcl32pDPb69GPjKz4XVsSC3OronWMUhrprnUW8sm1ZI2a0LHlEMqOlFC1euSYp8VDLQ2cLirLu/3qg==","signatures":[{"sig":"MEUCIHaQxGXMGnTbqBr6FeiXOLPfB5WvFSnHkkx1iZ4VwaTMAiEA37Ia+K40tzyiArt1tjpbwW7PACstLNN8ZtQqtg0KpeE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55717},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"e93b1f585c2cd94383438abd74737a856ca68a77","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.40","@aofl/middleware":"^4.0.0-alpha.40","@aofl/object-utils":"^4.0.0-alpha.40"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.40_1634332811599_0.45175823409586213","host":"s3://npm-registry-packages"}},"4.0.0-alpha.41":{"name":"@aofl/store","version":"4.0.0-alpha.41","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.41","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"cad95cb9194101a3dd71c4a7ec20f7815fe61fa0","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.41.tgz","fileCount":36,"integrity":"sha512-3mJEtdcqCyROUs8R689JirGKtO000Ajv4v86b7jJmNOAyzlrZJUWedz7U2LNRX9IKOx+vfZM+tsTvSXLLg9dfA==","signatures":[{"sig":"MEUCIGYgCt3zRnS+dBtTpIjArPsJazkcexVReB99pWKyLYMTAiEA5oUm2XHYP7/N7XpleOW5G0+U8MKjRJqpj9iDVnRNKFA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55717},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"cbd55bfa3cf5e87bf7b5f27b3d9b6efb34e3ad85","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.41","@aofl/middleware":"^4.0.0-alpha.41","@aofl/object-utils":"^4.0.0-alpha.41"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.41_1634582077713_0.9119940618770046","host":"s3://npm-registry-packages"}},"4.0.0-alpha.42":{"name":"@aofl/store","version":"4.0.0-alpha.42","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.42","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ef3408675726afdc092189b84921fbd3de744423","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.42.tgz","fileCount":36,"integrity":"sha512-V3Dv1b+Hvc1auHEo3I9WHiu4CL+hGTmni8MwI6Arpmd4gNvh22GkBfo1rz4gWTNzgxdFVWmMt53i/2trNsV6Tw==","signatures":[{"sig":"MEUCIQCbVod0TVyY47EHqRFhC7xc0lGYzuz4DHsBtjpYaWAlDwIgR+yTmvYU07GWJTihkb8Dvk624JAnUTfGR1GbqFqdJBw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55717},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"f64d10ec558694ce4c2d4e8b0562d4167f8e28d5","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.42","@aofl/middleware":"^4.0.0-alpha.42","@aofl/object-utils":"^4.0.0-alpha.42"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.42_1634586045312_0.17834779027577574","host":"s3://npm-registry-packages"}},"4.0.0-alpha.43":{"name":"@aofl/store","version":"4.0.0-alpha.43","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.43","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"54f430c5c9cd6f7e54fc7f1707f653ebc88a12b7","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.43.tgz","fileCount":36,"integrity":"sha512-KwPneBLKhCTNMSjv7e15c/iI4oyaPHVr1W5QCmC/xJYjGt+2kLPPU2kx5jxoeSi5IUltLGuOazW0QyxmfRp5HQ==","signatures":[{"sig":"MEUCIQDfkNTQ6RfnxClaYbpi/YZKc6Bpm4uE0ZxKnZR6YcSU4AIgQJoVi59cfTBNMC3iwoOPdQGTK+XgzBfaEAY9/yMRDVI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55717},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"gitHead":"6763365b38cb5be764e669a3b568be9f1cc4cfed","scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.43","@aofl/middleware":"^4.0.0-alpha.43","@aofl/object-utils":"^4.0.0-alpha.43"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.43_1634586298593_0.18926860512246102","host":"s3://npm-registry-packages"}},"4.0.0-alpha.44":{"name":"@aofl/store","version":"4.0.0-alpha.44","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.44","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"a2377007a9e756d0a2e646f9e956cd7bf1da456f","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.44.tgz","fileCount":36,"integrity":"sha512-ta/FiUbHQ5GLNembeR7TsQd2vHSWuuRJKK+OnCP7OCsF2Ma7C/ySOgCxdj03EV2sUqc8TjPYS7pR2wfmgHjHyQ==","signatures":[{"sig":"MEUCIElPjTMbjAoic1oqaxuBCsdHDpmwY6tuTqmJr/bY3846AiEAzmlnAleE873Di8S9FUy3dz1pnwTu7mA6LSp4s02tVlU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55717},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.11","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.44","@aofl/middleware":"^4.0.0-alpha.44","@aofl/object-utils":"^4.0.0-alpha.44"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.44_1635874784070_0.7077580562454131","host":"s3://npm-registry-packages"}},"4.0.0-alpha.45":{"name":"@aofl/store","version":"4.0.0-alpha.45","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@4.0.0-alpha.45","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"13d3149e9412493c6e49391b9c9c333055e68ebd","tarball":"https://registry.npmjs.org/@aofl/store/-/store-4.0.0-alpha.45.tgz","fileCount":36,"integrity":"sha512-PX32wyrspjI2q0ud5Nk1ytBV7f+w7mZLSjFRkUwibDeophzwSOJDVOAyjiUQnXBWPChDJ50qjD0nv+PqiGNoxw==","signatures":[{"sig":"MEYCIQDo5+Mp0s3W796lEGxFiRJTTu2Wzq2YMcfmZLcLHbnZtAIhANpjmgGrNlEpffzquGt8e9Ud2Upjz/2J3BhnWO0uCDZr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55717},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","module":"lib/index.js","readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","browser":"dist/index.js","exports":{".":{"default":"./lib/index.js"}},"scripts":{"tsc":"cross-env NODE_ENV=production tsc -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1","build":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --config .aofl.cjs","clean":"rm -rf dist lib","build-ci":"npm run clean && npm run tsc && cross-env NODE_ENV=production aofl build --debug --config .aofl.cjs","build:dev":"npm run tsc && cross-env NODE_ENV=development aofl build --config .aofl.cjs","prepublishOnly":"npm run build-ci"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.11","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"cross-env":"^7.0.3","@aofl/element":"^4.0.0-alpha.45","@aofl/middleware":"^4.0.0-alpha.45","@aofl/object-utils":"^4.0.0-alpha.45"},"peerDependencies":{"@aofl/element":"^4.0.0-alpha.21","@aofl/middleware":"^4.0.0-alpha.9","@aofl/object-utils":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/store_4.0.0-alpha.45_1635876963898_0.6855813256491354","host":"s3://npm-registry-packages"}},"3.14.0":{"name":"@aofl/store","version":"3.14.0","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.14.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"6f3686533517ca3eb3add3f50e25737597737b77","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.14.0.tgz","fileCount":18,"integrity":"sha512-IwZi7zE4euCKYALsxL7OWFjXcleNt7xQEHnJd0Wf0iVg6GPpaPtgxm3ZLoVhDWWwCeD5Uy+kvdbKq26Q259HnQ==","signatures":[{"sig":"MEQCIBxku6duEvMHsKZod2CDq/yJCN+lzWHk0HN4h/H+N4ORAiA+dRHoxzHilbEqRXPAK8U6GwXqOXmotNOxDRkfY+g9Kw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":85945,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiM8/gACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoKrg/+PQKcYiumd6eA+9dUSOnFeXxtWtNd5SuhvIJM0XehOnyO/UFi\r\nP/OEW300Eg4Rh94r6SeyMoa3/Ng4b05CwM2ZppEANlojuWpssbkC4vk/msDd\r\nR+HQPRaxDV3rSSqb+TlmIEprgexrkgVj6wB5bqSriTx4QY680o1zOMTb0VAl\r\nwEZ/dCy5UkCImLKhtglUegA2PfFyriXcrBnEbRps0gB9WZispbHJAbpDNTNs\r\niJcxqQaCo2ILbs3XMZyrDMw8mm3eOy5z0spxE1o1PyOqT3zo4rUh/xOzfX+P\r\nYgnR1m1xnsKmKi+2JDuxSrTq6LbVa0RDDuNAMrdI7fJnJ2JhSDy93KQd12Jz\r\n6ZXjn54CKRE82uVWOWcCmQhfR5V3i3EVOKquplQQjROxmGqJC0/dVu7McT8m\r\nY+jTi1WlgJyiTZWoMikhCVBBekcgpiZLHTkmmUrEByuBx6AB5u27itag/bCB\r\n7P/md/kZi0kDPhJpd+tqzCJvw/g2U23w7jWO2ehxpxfYgC6gtAqZSiN86dzy\r\niCKmy7Xt7t1j0wN2cbTuQzN9JQl4MUYejRY+yO/bdHjPfrj3cpcoIkXK8B3u\r\nL8lFpBxaYwHiJXS2dMkE5YjJ+O90bI9fKyFd4Cb50nrFIWCjVsI2/YdJJ8vk\r\nVMprqA7kZFt/PMTGcYNLFl4fUWOpdIgMsSM=\r\n=GIoV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"01a200342c31c108d1ab1039ee4c972f2ee63fa9","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.20.1+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.14.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.14.0","@aofl/register-callback":"^3.14.0"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.14.0_1647562720066_0.4576102412789813","host":"s3://npm-registry-packages"}},"3.14.1":{"name":"@aofl/store","version":"3.14.1","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/store@3.14.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"70780136b55abd304484587675cca0e810f4a6cc","tarball":"https://registry.npmjs.org/@aofl/store/-/store-3.14.1.tgz","fileCount":18,"integrity":"sha512-xwP2Bx06BssoIBcTL3kcT11ygOh+8c8/lv5kvi9lIq+PY2pPDJZpB1jhPLMxaDGb8Ej0jdIKWlrDMywwJHSESw==","signatures":[{"sig":"MEUCIQDAemCZJqDNGLrBdPkz58i9hGw3a5OWH8fglepq3ZaYyAIgREmkpwnbG6Flli/Kh6EUUIvQkkP0Fuu8Y0HWBlcwyYw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":85945,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiM9bVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrrUA//UzYi96TSswdMp6h0gBXU+3b2c4cyB3th15qmq0ePoGKpGJB3\r\nTUK0YH9mpg/5fRBm1iDfRg25ZUVIVCj0YWWe75Gd0WDsaDCI55IUPOfnqolo\r\n/B4qogUuignrvz++RZhvkOinxnGe3Xe6GBKGRDDCi8bO7iW5toU448UWIBLq\r\nEOQ799k/MFIXP049cjL80DW6k20cqpAgIZJ0k3+nPRXIzx0NpROwkXaYWD6S\r\nxbWiqTjp/6KIP2OOyOfCWHBod/olIeXyFWGHF7/+VH8hpJox/aIeVK8F5QAT\r\ndqolt58y7jD0YzMMIONG8KLvLgKMTeVT9WmujO+vwY7qE6mNBTgzoJ+QTk+F\r\nWsDdgO50g3yQ1Z1WqUcAF/8YcunLiKAfLudBvM0ShfQj4nbXQ/rG2nNLLuY+\r\nBmEPAg5QmUdLs1Ckke5RuItlAiLznHwu7ATHULb0F5y6SgDxPxNL282Mpl66\r\nzprnZVRzQPVwhpEYl2SGUnkeFHbWmfh/1GtuqrtpxaSLw/uE6xuHJ5HCMkIA\r\nYWJFf9xyM/sLKUtdYGWEVk6ok1EiVeMOEZvro5Bin6E2Sr0P7tGL2tHpirLW\r\nlRT5/z6Nc/nLUKvJbWaTN26TRR7gcBG7aP7kiwABAUhbHweF4zcgBMvGT7j/\r\nlWVlmOfOAMoITTzbQG/mwSfkW5vNZavetZg=\r\n=ugx0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"65857163479f835ec51cc1e23ec01c45eab43008","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.20.1+x64 (darwin)","description":"Centralized state management for aofljs applications","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.14.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/object-utils":"^3.14.1","@aofl/register-callback":"^3.14.1"},"peerDependencies":{"@aofl/object-utils":">= 3.0.0-beta.1 < 4.0.0","@aofl/register-callback":">= 3.0.0-beta.1 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/store_3.14.1_1647564501077_0.2646712478864335","host":"s3://npm-registry-packages"}}},"time":{"created":"2018-01-26T00:54:13.703Z","modified":"2025-01-18T00:21:03.166Z","1.0.0":"2018-01-26T00:54:13.703Z","1.0.0-beta.1":"2018-02-01T01:11:07.115Z","1.0.0-beta.2":"2018-02-01T18:13:27.210Z","1.0.0-beta.3":"2018-02-01T18:20:27.657Z","1.0.0-beta.4":"2018-02-12T19:56:10.219Z","1.0.0-beta.5":"2018-02-16T00:11:58.215Z","1.0.0-beta.6":"2018-03-10T01:14:33.462Z","1.0.0-beta.7":"2018-03-10T01:21:25.101Z","1.0.0-beta.8":"2018-07-10T17:34:58.703Z","1.0.0-beta.20":"2018-07-25T00:20:15.521Z","1.0.0-beta.21":"2018-08-05T07:45:15.293Z","1.0.0-beta.22":"2018-08-10T19:31:13.543Z","1.0.0-beta.23":"2018-08-16T21:44:58.664Z","1.0.0-beta.24":"2018-08-22T22:36:15.298Z","1.0.0-beta.25":"2018-08-23T19:31:07.720Z","1.0.0-beta.26":"2018-08-27T18:26:28.650Z","1.0.0-beta.27":"2018-09-11T17:22:52.935Z","1.0.0-beta.28":"2018-09-28T00:34:55.870Z","1.0.1":"2018-09-29T23:06:03.459Z","1.1.0":"2018-10-17T22:31:42.789Z","1.1.1":"2018-10-29T19:44:07.846Z","1.1.2":"2018-10-29T19:44:27.541Z","1.2.0":"2018-11-06T20:52:07.125Z","1.2.1":"2018-11-18T21:12:51.376Z","1.2.3":"2018-11-21T00:15:44.207Z","1.3.0":"2018-12-06T21:03:16.160Z","1.4.0":"2018-12-28T02:43:01.746Z","1.4.1":"2019-01-07T18:33:28.604Z","2.0.0-alpha.4":"2019-02-01T22:53:23.064Z","2.0.0-alpha.5":"2019-02-26T23:15:31.479Z","2.0.0-alpha.16":"2019-04-25T19:57:50.800Z","2.0.0-alpha.17":"2019-04-26T18:36:02.357Z","2.0.0":"2019-04-30T19:31:56.763Z","2.1.0-alpha.10":"2019-08-20T01:28:25.392Z","3.0.0-0":"2019-09-17T05:22:07.789Z","3.0.0-alpha.0":"2019-09-17T05:24:10.766Z","3.0.0-alpha.5":"2019-09-20T06:32:49.620Z","3.0.0-alpha.9":"2019-09-26T20:58:31.805Z","3.0.0-alpha.11":"2019-09-27T06:49:33.594Z","3.0.0-beta.1":"2019-10-06T08:40:07.372Z","3.0.0-beta.6":"2019-10-08T04:49:50.705Z","3.0.0-beta.7":"2019-10-08T05:21:57.126Z","3.0.0-beta.8":"2019-10-08T05:48:23.595Z","3.0.0-beta.9":"2019-10-08T06:11:53.455Z","3.0.0-beta.11":"2019-10-08T09:43:05.234Z","3.0.0-beta.12":"2019-10-08T09:53:52.066Z","3.0.0-beta.13":"2019-10-09T04:13:34.889Z","3.0.0-beta.14":"2019-10-09T04:33:14.960Z","3.0.0-beta.15":"2019-10-09T04:50:54.603Z","3.0.0-beta.16":"2019-10-09T05:06:12.543Z","3.0.0-beta.17":"2019-10-09T05:25:13.793Z","3.0.0-beta.18":"2019-10-09T08:28:40.902Z","3.0.0-beta.19":"2019-10-10T07:55:09.525Z","3.0.0-beta.20":"2019-10-10T09:07:51.959Z","3.0.0-beta.21":"2019-10-10T09:32:09.630Z","3.0.0-beta.22":"2019-10-11T04:41:02.115Z","3.0.0-beta.23":"2019-10-11T05:40:08.516Z","3.0.0-beta.24":"2019-10-11T06:34:57.492Z","3.0.0-beta.25":"2019-10-11T07:34:56.674Z","3.0.0-beta.26":"2019-10-11T07:49:18.859Z","3.0.0-beta.27":"2019-10-11T07:54:11.027Z","3.0.0-beta.28":"2019-10-11T08:01:18.156Z","3.0.0-beta.30":"2019-10-11T22:58:54.005Z","3.0.0-beta.31":"2019-10-11T23:12:56.758Z","3.0.0-beta.32":"2019-10-14T01:10:43.257Z","3.0.0-beta.34":"2019-10-14T07:37:07.255Z","3.0.0-beta.35":"2019-10-18T06:59:23.472Z","3.0.0-beta.36":"2019-10-19T10:46:05.180Z","3.0.0-beta.37":"2019-10-24T06:08:05.156Z","3.0.0-beta.38":"2019-10-30T22:52:34.646Z","3.0.0-beta.39":"2019-10-31T01:08:03.766Z","3.0.0-alpha.12":"2019-11-02T01:11:51.010Z","3.0.0-beta.40":"2019-11-11T22:31:29.643Z","3.0.0-beta.41":"2019-11-12T04:55:47.822Z","3.0.0-beta.42":"2019-11-12T05:53:56.786Z","3.0.0-beta.46":"2019-11-14T21:58:26.572Z","3.0.0-beta.47":"2019-11-15T00:48:59.011Z","3.0.0-beta.48":"2019-11-16T23:36:10.692Z","3.0.0-beta.49":"2019-11-17T03:38:05.215Z","3.0.0":"2019-11-17T07:06:20.306Z","3.1.0":"2019-11-22T03:28:33.142Z","3.2.0":"2019-11-24T07:35:05.235Z","3.2.1":"2019-11-24T08:03:59.812Z","3.2.2-alpha.2":"2020-01-14T20:27:39.268Z","3.2.2-alpha.3":"2020-01-14T21:13:00.490Z","3.3.0":"2020-01-22T23:31:16.500Z","3.5.0-beta.2":"2020-02-22T23:52:44.630Z","3.5.0-beta.3":"2020-02-23T00:07:26.075Z","3.5.0-beta.4":"2020-02-23T01:57:30.878Z","3.5.0-beta.5":"2020-02-23T03:10:08.836Z","3.5.0-beta.6":"2020-02-23T03:17:49.343Z","3.5.0-beta.7":"2020-02-23T05:05:36.249Z","3.5.0-beta.8":"2020-02-23T05:08:47.932Z","3.5.0-beta.9":"2020-02-23T05:33:11.179Z","3.5.0-beta.10":"2020-02-23T05:50:31.913Z","3.5.0-beta.11":"2020-02-23T07:37:18.791Z","3.5.0-beta.12":"2020-02-23T09:00:13.915Z","3.5.0-beta.13":"2020-02-23T09:02:13.134Z","3.5.0-beta.14":"2020-02-23T10:00:16.727Z","3.5.0-beta.15":"2020-02-23T11:49:19.604Z","3.5.0-beta.16":"2020-02-23T11:58:41.345Z","3.5.0-beta.17":"2020-02-23T12:14:32.790Z","3.5.0-beta.18":"2020-02-25T03:59:36.657Z","3.5.0-beta.19":"2020-02-25T23:57:14.880Z","3.5.0-beta.20":"2020-03-02T23:22:44.132Z","3.5.0-beta.21":"2020-03-02T23:27:07.377Z","3.5.0-beta.22":"2020-03-02T23:42:21.480Z","3.5.0":"2020-03-03T00:03:09.368Z","3.6.1":"2020-03-10T18:42:57.680Z","3.8.0":"2020-05-12T19:19:30.338Z","3.9.0-alpha.0":"2020-05-12T19:29:58.593Z","3.8.1":"2020-05-12T19:40:44.500Z","3.9.0":"2020-05-15T17:58:11.713Z","3.10.0":"2020-05-15T21:15:31.245Z","3.12.0":"2021-01-20T00:01:48.771Z","3.12.1":"2021-01-20T00:12:45.673Z","4.0.0-alpha.9":"2021-02-03T01:48:08.532Z","4.0.0-alpha.10":"2021-02-03T01:56:13.258Z","4.0.0-alpha.11":"2021-02-03T02:24:19.332Z","3.13.0":"2021-02-25T23:43:33.615Z","3.13.1":"2021-06-15T23:48:46.770Z","4.0.0-alpha.13":"2021-09-23T23:32:10.253Z","4.0.0-alpha.15":"2021-10-06T17:03:53.724Z","4.0.0-alpha.16":"2021-10-06T17:05:08.904Z","4.0.0-alpha.17":"2021-10-06T18:47:31.448Z","4.0.0-alpha.18":"2021-10-06T23:40:33.674Z","4.0.0-alpha.19":"2021-10-06T23:47:29.545Z","4.0.0-alpha.20":"2021-10-06T23:54:56.967Z","4.0.0-alpha.21":"2021-10-08T17:06:00.836Z","4.0.0-alpha.22":"2021-10-11T20:39:36.926Z","4.0.0-alpha.23":"2021-10-11T21:07:34.841Z","4.0.0-alpha.24":"2021-10-11T21:47:06.638Z","4.0.0-alpha.25":"2021-10-12T01:20:57.079Z","4.0.0-alpha.26":"2021-10-12T01:34:46.892Z","4.0.0-alpha.27":"2021-10-13T19:06:45.019Z","4.0.0-alpha.28":"2021-10-13T22:18:35.636Z","4.0.0-alpha.29":"2021-10-15T17:36:05.791Z","4.0.0-alpha.30":"2021-10-15T18:51:13.046Z","4.0.0-alpha.31":"2021-10-15T18:55:37.046Z","4.0.0-alpha.32":"2021-10-15T19:39:59.467Z","4.0.0-alpha.33":"2021-10-15T19:43:19.205Z","4.0.0-alpha.34":"2021-10-15T19:53:24.697Z","4.0.0-alpha.35":"2021-10-15T20:00:27.721Z","4.0.0-alpha.36":"2021-10-15T20:03:59.160Z","4.0.0-alpha.37":"2021-10-15T20:06:42.096Z","4.0.0-alpha.38":"2021-10-15T20:46:20.773Z","4.0.0-alpha.39":"2021-10-15T21:10:17.857Z","4.0.0-alpha.40":"2021-10-15T21:20:11.749Z","4.0.0-alpha.41":"2021-10-18T18:34:37.914Z","4.0.0-alpha.42":"2021-10-18T19:40:45.497Z","4.0.0-alpha.43":"2021-10-18T19:44:58.760Z","4.0.0-alpha.44":"2021-11-02T17:39:44.244Z","4.0.0-alpha.45":"2021-11-02T18:16:04.075Z","3.14.0":"2022-03-18T00:18:40.202Z","3.14.1":"2022-03-18T00:48:21.211Z"},"bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","homepage":"https://github.com/AgeOfLearning/aofl#readme","keywords":["aofljs","@aofl/store","store","state","redux","flux","commit","mutation","decorator","state definition object","subscribe"],"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"description":"Centralized state management for aofljs applications","contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"maintainers":[{"email":"alexdinari@me.com","name":"alexdinari"},{"email":"lorenzo.battigelli@aofl.com","name":"lorenzo.battigelli"},{"email":"alex.dinari@aofl.com","name":"alex.dinari"},{"email":"it@aofl.com","name":"ageoflearning"},{"email":"jie.zhang@aofl.com","name":"jiezhangaofl"}],"readme":"# @aofl/store\n\n@aofl/store is a built on the same principles as redux and attempts to simplify some of Redux's concepts. It also incorporates ideas from other centralized state management implementations.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_store.html)\n\n---\n## Examples\n* https://codesandbox.io/s/github/AgeOfLearning/aofl/tree/v3.0.0/aofl-js-packages/store/examples/\n\n---\n## Installation\n```bash\nnpm i -S @aofl/store\n```\n\n---\n### Concepts\n\n#### State\nIn @aofl/store the state consists of a collection of sub-states. This allows us to add new sub-states at runtime which leads to constructing an efficient state object based on the applications current needs.\n\nThe state object must not be mutated directly. In fact, when debug mode is enabled, Object.freeze is called on every property of the state, attempting to mutate the state will throw an error.\n\n\n#### State Definition Object (SDO)\nA State Definition Object (SDO) is an object that defines the properties of a sub-state. SDOs must define a namespace, state properties and initial values, optionally mutation functions and decorators.\n\nHere's an example of an SDO configured with all the valid options.\n```javascript\nimport {Sdo, decorate, state, storeInstance} from '@aofl/store';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n\n  @state() id = 0;\n  @state() username = '';\n  @state() firstName = '';\n  @state() lastName = '';\n  @state() email = '';\n  @state() phone = 0;\n  @state() createdTimestamp = 0;\n  @state() products = [];\n\n  addProduct(product) {\n    this.products = [\n      ...this.products,\n      product\n    ];\n  }\n\n  @decorate('accounts.createdTimestamp')\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString('en-US');\n  }\n}\n\nconst accountsSdo = new AccountsSdo();\nstoreInstance.addState(accountsSdo);\n\nexport {accountsSdo};\n```\n\n##### namespace\nsub-states are keyed by namespace. Additionally mutations can only be invoked using the namespace and can only modify the sub-state attached to a namespace. The `Sdo` class abstracts away interacting with the store directly.\n\n```javascript\n// storeInstance.state\n{\n  accounts: { // namespace\n    id: 0,\n    username: '',\n    ...\n  }\n}\n```\n\n##### @state\nProperties decorated with `@state` are added to Store. Furthermore, the initialized values are used to reset store if necessary. These properties are created with specialized getter/setter functions. The getter proxies the values from `store.state.{namespace}.property`. This means directly committing a change to store will reflect in the sdo instance. The setter function commits the new value to store.\n\nIn addition to the state variables, additional methods can be implemented to apply more complex mutations. E.g. inserting into an array or updating nested properties of an object.\n\n\n##### @decorate\nDecorators are used to derive new information based on the state of the application. E.g. formatting timestamps to formatted date strings or calculating number of pages based on pagination data (limit per page and total results).\n\n`@decorate()` takes variadic arguments that map to properties in store. Hence, the paths used include namespace. This allows us to observe changes across multiple SDOs. Consider the case where the decorated value should update when user's preferred locale changes. A decorator can observe changes in UserSettingsSdo and update timestamps accordingly in other SDOs.\n\nDecorated properties are [memoized](https://en.wikipedia.org/wiki/Memoization) based on the arguments passed to @decorate. I.e. the values are computed when accessed and only recomputed when observed values change.\n\n\n```javascript\nimport {userSettingsSdo} from 'user-settings-sdo';\n\nclass AccountsSdo extends Sdo {\n  static namespace: 'accounts';\n  ...\n  @state() createdTimestamp = 0;\n  ...\n\n  @decorate('accounts.createdTimestamp', `${userSettingsSdo.namespace}.locale`)\n  get formattedCreated() {\n    return new Date(this.date).toLocaleDateString(userSettingsSdo.locale);\n  }\n}\n```\n\n\n#### `addState()`\nAdds a new Sdo to store.\n\n#### `commit()`\nTo change state `commit()` can be used. It accepts a namespace and a mutation objects as arguments.\n\n```javascript\nstoreInstance.commit('accounts', {\n  id: 1\n});\n```\n\n#### `subscribe()`\nYou can subscribe to store to receive updates. The subscribe function returns the unsubscribe function.\n\n```javascript\nconst unsubscribe = storeInstance.subscribe(() => {\n  const state = store.getState();\n  view.lastLoginDate = state.accounts.$formattedLastLogin;\n});\n\nview.onDestroy(() => {\n  unsubscribe();\n});\n```\n\n#### `flushState()`\nResets the state to the initial state of Sdos.\n\n```javascript\nstoreInstance.flushState();\n```\n\n## Usage with @aofl/element\n\n`@property` decorator exported from @aofl/element extends the @property decorator from lit-element and adds 2 new keys to the options `mapState` and `store`.\n\n`mapState` is a string path relative to the provided store's state property.\n`store` defaults to storeInstance exported from @aofl/store. It can be replaced with an instance of store or an sdo class.\n\n```javascript\nimport {AoflElement, property, customElement} from '@aofl/element';\nimport template from './template';\nimport styles from './styles';\nimport {previewSdo} from '../preview-sdo';\n\n@customElement('example-component)\nclass ExampleComponent extends AoflElement {\n  constructor() {\n    super();\n  }\n\n  static is = 'example-component';\n\n  @property({mapState: 'count', store: previewSdo})\n  count = 0;\n\n  @property({mapState: 'formattedDate', store: previewSdo})\n  formattedDate = '';\n\n  incrementCount() {\n    previewSdo.increment();\n  }\n\n  render() {\n    return super.render(template, [styles]);\n  }\n}\n\n```\n\n\n","readmeFilename":"README.md"}