{"_id":"@molecule/app-state","_rev":"8-2af9676e82f14c8eb1834637b9b344d6","name":"@molecule/app-state","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@molecule/app-state","version":"1.0.0","keywords":["molecule","state","store","state-management"],"license":"Apache-2.0","_id":"@molecule/app-state@1.0.0","maintainers":[{"name":"vialoh","email":"npm@vialoh.me"}],"homepage":"https://github.com/molecule-dev/molecule/tree/main/packages/app/core/state","bugs":{"url":"https://github.com/molecule-dev/molecule/issues"},"dist":{"shasum":"18a45388c02c4af510483fb067bdb2b82d8a40b3","tarball":"https://registry.npmjs.org/@molecule/app-state/-/app-state-1.0.0.tgz","fileCount":34,"integrity":"sha512-kmUEkBKQk7F7aKZ/FTvB0j3Hdy5yTgeFmAJSqQMexj0kqpXKkroqqunZDwQKuDXVqSANxKj/SHUPP0nhlSTkjg==","signatures":[{"sig":"MEQCIHGjyajgf/KSwAYmKtF+EI9wyKpKIdm1WRr4qPTzO8lYAiBZYlezMa8szKNFvtNb/0obDQB6CNu9PJfbPyW8pLXmOQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41099},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"92623e72a527ca467963169420f4cf07533e4699","scripts":{"test":"vitest run","build":"tsc","test:watch":"vitest"},"_npmUser":{"name":"vialoh","email":"npm@vialoh.me"},"repository":{"url":"git+https://github.com/molecule-dev/molecule.git","type":"git","directory":"packages/app/core/state"},"_npmVersion":"11.12.1","description":"Client state management interface for molecule.dev","directories":{},"_nodeVersion":"25.9.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.10","typescript":"6.0.3","@types/node":"26.1.2","@molecule/app-bond":"1.0.0","@molecule/app-logger":"1.0.0"},"peerDependencies":{"@molecule/app-bond":"^1.0.0","@molecule/app-logger":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/app-state_1.0.0_1785796143951_0.6363237040301728","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@molecule/app-state","version":"1.0.1","keywords":["molecule","state","store","state-management"],"license":"Apache-2.0","_id":"@molecule/app-state@1.0.1","maintainers":[{"name":"vialoh","email":"npm@vialoh.me"}],"homepage":"https://github.com/molecule-dev/molecule/tree/main/packages/app/core/state","bugs":{"url":"https://github.com/molecule-dev/molecule/issues"},"dist":{"shasum":"d40f5d9c3e1060af94e000ab44fb2583b868f78d","tarball":"https://registry.npmjs.org/@molecule/app-state/-/app-state-1.0.1.tgz","fileCount":35,"integrity":"sha512-ZdYRwEpglagnNEYSpHsxLStPvdQCPvhPgLSr5tTpwDMUp9BGlNrn7e110RZYn9zBqVqRgwWVh46rLltwW75HOQ==","signatures":[{"sig":"MEYCIQDbCQ+IA7K1Kx7hiU/XhgR+IgE9x01ncWCZPFQjM6ZQOwIhAP303f8rKTowCna2iHahk8gMvCvAZaINypqIGuXo9ayE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@molecule%2fapp-state@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":50856},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"8621216fd4c8c9abe863e4e4f41efd2bc866fb09","scripts":{"test":"vitest run","build":"tsc","test:watch":"vitest"},"_npmUser":{"name":"vialoh","email":"npm@vialoh.me"},"repository":{"url":"git+https://github.com/molecule-dev/molecule.git","type":"git","directory":"packages/app/core/state"},"_npmVersion":"12.0.2","description":"Client state management interface for molecule.dev","directories":{},"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.10","typescript":"6.0.3","@types/node":"26.1.2","@molecule/app-bond":"1.0.1","@molecule/app-logger":"1.0.1"},"peerDependencies":{"@molecule/app-bond":"^1.0.1","@molecule/app-logger":"^1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/app-state_1.0.1_1785828291262_0.7671435581506032","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@molecule/app-state","version":"1.0.2","keywords":["molecule","state","store","state-management"],"license":"Apache-2.0","_id":"@molecule/app-state@1.0.2","maintainers":[{"name":"vialoh","email":"npm@vialoh.me"}],"homepage":"https://www.molecule.dev/packages/app-state","bugs":{"url":"https://github.com/molecule-dev/molecule/issues"},"dist":{"shasum":"9ef84331b1440874a7566e6bfa614591a1888476","tarball":"https://registry.npmjs.org/@molecule/app-state/-/app-state-1.0.2.tgz","fileCount":35,"integrity":"sha512-H/ocLCOMqhkBQfXu9Xq4DMXjIZH3M2UgwAr0s7R5q6Bf7cjTMGCYjFfNWSPQl2HH8wfTSY16R+94QVv9tXzB2Q==","signatures":[{"sig":"MEQCIF3vqyssj2lhQpkQkThsWZGtd/TCXKwM0i/0aJ1itcAVAiBxn1neIqFKYkao68snOKWIYa85FN67hnw24EwkVWAp8w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCr3jPKIEN29dIf1ksW9T7wcVUd+ckHAanGfeTeEkU8dQIhAP6efNQ2qnYs7613s0yG1e92aIwrGJjvXtJ/BmMn8n9c","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@molecule%2fapp-state@1.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":50825},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"80c23a410fe0952f0800a99180ecf221de9923e6","scripts":{"test":"vitest run","build":"tsc","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d559aaa1-e872-476d-8d49-59bb461d73b7"}},"repository":{"url":"git+https://github.com/molecule-dev/molecule.git","type":"git","directory":"packages/app/core/state"},"_npmVersion":"12.0.2","description":"Client state management interface for molecule.dev","directories":{},"_nodeVersion":"22.23.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.11","typescript":"6.0.3","@types/node":"26.1.2","@molecule/app-bond":"1.0.2","@molecule/app-logger":"1.0.2"},"peerDependencies":{"@molecule/app-bond":"^1.0.1","@molecule/app-logger":"^1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/app-state_1.0.2_1789917173491_0.6782779171095998","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@molecule/app-state","version":"1.0.3","keywords":["molecule","state","store","state-management"],"license":"Apache-2.0","_id":"@molecule/app-state@1.0.3","maintainers":[{"name":"vialoh","email":"npm@vialoh.me"}],"homepage":"https://www.molecule.dev/packages/app-state","bugs":{"url":"https://github.com/molecule-dev/molecule/issues"},"dist":{"shasum":"3d7f614ed1114d0e90960b54dedf6e1782793326","tarball":"https://registry.npmjs.org/@molecule/app-state/-/app-state-1.0.3.tgz","fileCount":35,"integrity":"sha512-dUfFP+v47lAldcJZ3LnpTpw/ULXmdqAYsdAACXJLakMdwvqabhrLr9+TZ0Bh3sxwGKjrrLFyEzwWYJhpKAvdDQ==","signatures":[{"sig":"MEUCIQCiXPVP1dGfv7A9cV84QRXODBEiXEuHM8UW+Ncss4+RhwIgO7Xg5RR1rhPccfjNxt0tZ9noM8S3VasBWXHIcJ1QlPA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIGH6LMOU3g3GicoiujAJpXKEl+te4VxmSDZ+/oUy7ENBAiAMwPJk6Xb9WcJLM6kbWbszS5ALIg4sbBcj9RFdu+EGpw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@molecule%2fapp-state@1.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":60227},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"68efc299b2b74be119bfb21876c0ecce9fce041a","scripts":{"test":"vitest run","build":"tsc","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"d559aaa1-e872-476d-8d49-59bb461d73b7"}},"repository":{"url":"git+https://github.com/molecule-dev/molecule.git","type":"git","directory":"packages/app/core/state"},"_npmVersion":"12.2.0","description":"Client state management interface for molecule.dev","directories":{},"_nodeVersion":"22.23.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.11","typescript":"6.0.3","@types/node":"26.1.2","@molecule/app-bond":"1.0.2","@molecule/app-logger":"1.0.2"},"peerDependencies":{"@molecule/app-bond":"^1.0.1","@molecule/app-logger":"^1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/app-state_1.0.3_1792145372999_0.7095775252301011","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@molecule/app-state","version":"1.0.4","keywords":["molecule","state","store","state-management"],"license":"Apache-2.0","_id":"@molecule/app-state@1.0.4","maintainers":[{"name":"vialoh","email":"npm@vialoh.me"}],"homepage":"https://www.molecule.dev/packages/app-state","bugs":{"url":"https://github.com/molecule-dev/molecule/issues"},"dist":{"shasum":"8f84d1aa13a7dcb30fc36a33ccf8ba377053eff4","tarball":"https://registry.npmjs.org/@molecule/app-state/-/app-state-1.0.4.tgz","fileCount":35,"integrity":"sha512-DtP14CxdsPoJ/rVcrKj2HkgyrjFIkZZHLSe3tG83tpLAki7Nu1jGavWOrDDuK4qLCSZuipgv565LSunM7ygaFQ==","signatures":[{"sig":"MEYCIQDTi8hrtBZbj+CZUEylTbTLhJDE/g9uoQac4PP5dqg2jAIhAKrciMfZ637oFuzFML6/nr0oPSiq74rKCIsWc7uohydE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCkXfEt2jLTOKyh7s1cIAeoBB8QWYj3c2vWf0P9diNx4gIgR5dCEGM0GRWIV7Ne7KoT2SQq7jsZhuTLRXzplm78d5E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@molecule%2fapp-state@1.0.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":60227},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f67ed64e3c4227d6b4f01be400011d4c8c2a75ce","scripts":{"test":"vitest run","build":"tsc","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"d559aaa1-e872-476d-8d49-59bb461d73b7"}},"repository":{"url":"git+https://github.com/molecule-dev/molecule.git","type":"git","directory":"packages/app/core/state"},"_npmVersion":"12.2.1","description":"Client state management interface for molecule.dev","directories":{},"_nodeVersion":"22.23.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.12","typescript":"6.0.3","@types/node":"26.6.5","@molecule/app-bond":"1.0.3","@molecule/app-logger":"1.0.3"},"peerDependencies":{"@molecule/app-bond":"^1.0.1","@molecule/app-logger":"^1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/app-state_1.0.4_1792826746594_0.17381117784824074","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@molecule/app-state","version":"1.0.5","keywords":["molecule","state","store","state-management"],"license":"Apache-2.0","_id":"@molecule/app-state@1.0.5","maintainers":[{"name":"vialoh","email":"npm@vialoh.me"}],"homepage":"https://www.molecule.dev/packages/app-state","bugs":{"url":"https://github.com/molecule-dev/molecule/issues"},"dist":{"shasum":"86547cac7549b734aec4d31ef8a467068880b952","tarball":"https://registry.npmjs.org/@molecule/app-state/-/app-state-1.0.5.tgz","fileCount":35,"integrity":"sha512-0vQMHDrXaGx6xn1HR8BoZGEpVyxixDFOwQ40rUpiFj1h8751Wf/rJtaAgkz3n896FAsz0lJrp2xzfMoUkskXhg==","signatures":[{"sig":"MEYCIQDegt9QbpBQM8Uz/MtmJogfO6jbltIuKB2S0gUhg8np3AIhAIAn2mcBi7I3PJlyTifIkFuz4bQZEf69E8FpebmWwrmK","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIEQbCrddQk07mPPlk0GVpOi5Fd/lMbPWibFpbI95jlfHAiEA37ZTcIJ0baLIJ+d1Se6vj99h1I6yPFSnwqz/Ernn26Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@molecule%2fapp-state@1.0.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":60297},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"e65e3f174ceb27fda6175a5188a88349ff629919","scripts":{"test":"vitest run","build":"tsc","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"d559aaa1-e872-476d-8d49-59bb461d73b7"}},"repository":{"url":"git+https://github.com/molecule-dev/molecule.git","type":"git","directory":"packages/app/core/state"},"_npmVersion":"12.2.1","description":"Client state management interface for molecule.dev","directories":{},"_nodeVersion":"22.23.4","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.12","typescript":"6.0.3","@types/node":"26.6.5","@molecule/app-bond":"1.0.4","@molecule/app-logger":"1.0.3"},"peerDependencies":{"@molecule/app-bond":"^1.0.1","@molecule/app-logger":"^1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/app-state_1.0.5_1793014705919_0.292033640286113","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@molecule/app-state","version":"1.1.1","keywords":["molecule","state","store","state-management"],"license":"Apache-2.0","_id":"@molecule/app-state@1.1.1","maintainers":[{"name":"vialoh","email":"npm@vialoh.me"}],"homepage":"https://www.molecule.dev/packages/app-state","bugs":{"url":"https://github.com/molecule-dev/molecule/issues"},"dist":{"shasum":"1e4ffd0a810af14d23733eaf1cb848167b0325ef","tarball":"https://registry.npmjs.org/@molecule/app-state/-/app-state-1.1.1.tgz","fileCount":39,"integrity":"sha512-DfO+H9mKJWSnxL1jDDQIPy+RsmS6S1sHdmCSnhLfbxKuw5HLGPL2R0/parmvCYBG6iG7PLo66PPqLecQuj1+PQ==","signatures":[{"sig":"MEYCIQDGmptFkYrA4j+Mb5ytQ2tQCICSTPYbEw9IbE+pjAAmgwIhAPcFwvfsLQYgRj4zGA1yMqI4UcDPYnGUKwhWMTg0yeY/","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDPicanNC5Gfj6igBFuXmmXF/mx46If8NT68ssxKZ8lIAIhAJClQMLhX5TqAZbjU4uzF4z5Co03XH6QzcEqk03stjNd","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@molecule%2fapp-state@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":81946},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"3847a57284b4aac7f7b368a24febce9744ab8468","scripts":{"test":"vitest run","build":"tsc","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"d559aaa1-e872-476d-8d49-59bb461d73b7"}},"repository":{"url":"git+https://github.com/molecule-dev/molecule.git","type":"git","directory":"packages/app/core/state"},"_npmVersion":"12.2.1","description":"Client state management interface for molecule.dev","directories":{},"_nodeVersion":"22.23.4","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.12","typescript":"6.0.3","@types/node":"26.6.5","@molecule/app-bond":"1.0.5","@molecule/app-logger":"1.0.5"},"peerDependencies":{"@molecule/app-bond":"^1.0.1","@molecule/app-logger":"^1.0.1"},"_npmOperationalInternal":{"tmp":"tmp/app-state_1.1.1_1793752940591_0.5617445743414807","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"_id":"@molecule/app-state@1.2.0","bugs":{"url":"https://github.com/molecule-dev/molecule/issues"},"dist":{"shasum":"8f2800ffc5231aa3f0e6f8f2f2cf558fafdf397d","tarball":"https://registry.npmjs.org/@molecule/app-state/-/app-state-1.2.0.tgz","fileCount":39,"integrity":"sha512-87e7i799CW1Ur84S778NB/lCMYKxNnolUIHBPYRp19WaYXV85SEcoikpi6nTYBJp68ZBW/GD0ec2Kk4f/kWuyQ==","signatures":[{"sig":"MEUCIQDqXZLhAxD+Mgmxzbt9ePHpDKSMVTLaewP93k8gVUaUdQIgHS2tDwN1jD/w5nXRWdf35NIMYsEgT7g2lEGBSmbF/vc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIH3XP6gG1p8o1Yj/mUs6AupUgWMWK7sU1HEFu0gBOKgoAiEA/w4x5CpFL9swQrnYfF2sEEtn2DY2sUUENb0jn44+iZ4="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@molecule%2fapp-state@1.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":84697},"main":"dist/index.js","name":"@molecule/app-state","type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f7456685d8e9f2c2ded341da46582445a4d2693e","license":"Apache-2.0","scripts":{"test":"vitest run","build":"tsc","test:watch":"vitest"},"version":"1.2.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"d559aaa1-e872-476d-8d49-59bb461d73b7"}},"homepage":"https://www.molecule.dev/packages/app-state","keywords":["molecule","state","store","state-management"],"repository":{"url":"git+https://github.com/molecule-dev/molecule.git","type":"git","directory":"packages/app/core/state"},"_npmVersion":"12.2.2","description":"Client state management interface for molecule.dev","directories":{},"maintainers":[{"name":"vialoh","email":"npm@vialoh.me"}],"_nodeVersion":"22.23.4","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.12","typescript":"6.0.3","@types/node":"26.6.5","@molecule/app-bond":"1.0.5","@molecule/app-logger":"1.0.5"},"peerDependencies":{"@molecule/app-bond":"^1.0.1","@molecule/app-logger":"^1.0.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/app-state_1.2.0_1793875790217_0.37636296271153025"}}},"time":{"created":"2026-08-03T22:29:03.820Z","modified":"2026-11-05T10:49:50.608Z","1.0.0":"2026-08-03T22:29:04.089Z","1.0.1":"2026-08-04T07:24:51.385Z","1.0.2":"2026-09-20T15:12:53.580Z","1.0.3":"2026-10-16T10:09:33.083Z","1.0.4":"2026-10-24T07:25:46.690Z","1.0.5":"2026-10-26T11:38:26.005Z","1.1.1":"2026-11-04T00:42:20.696Z","1.2.0":"2026-11-05T10:49:50.286Z"},"bugs":{"url":"https://github.com/molecule-dev/molecule/issues"},"license":"Apache-2.0","homepage":"https://www.molecule.dev/packages/app-state","keywords":["molecule","state","store","state-management"],"repository":{"url":"git+https://github.com/molecule-dev/molecule.git","type":"git","directory":"packages/app/core/state"},"description":"Client state management interface for molecule.dev","maintainers":[{"name":"vialoh","email":"npm@vialoh.me"}],"readme":"<!--\nAUTO-GENERATED — DO NOT EDIT THIS FILE.\nGenerated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.\nEdits here are overwritten on the next commit (molecule's pre-commit hook regenerates).\nTo change this document, edit the module-level JSDoc in src/index.ts.\nGenerated: 2026-11-05T08:20:56.137Z\n-->\n\n# @molecule/app-state\n\nClient state management interface for molecule.dev.\n\nProvides a unified state management API that works across different\nstate management solutions (hooks, Zustand, Redux, Jotai, etc.).\n\n> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.\n> It is written to be read by coding agents as much as by people, and is generated from this\n> package's source — edit `src/index.ts` JSDoc, not this file.\n\n## Quick Start\n\n```ts\nimport { createStore, type Store } from '@molecule/app-state'\nimport { useStore } from '@molecule/app-react'\n\nconst initialState = { sidebarOpen: false }\n\n// Created on first use, NOT at module scope — see the remarks above.\nlet uiStore: Store<typeof initialState> | undefined\nconst getUiStore = (): Store<typeof initialState> => (uiStore ??= createStore({ initialState }))\n\nfunction Sidebar() {\n  const store = getUiStore()\n  const { sidebarOpen } = useStore(store) // subscribes to the store\n  const toggle = () => store.setState({ sidebarOpen: !sidebarOpen })\n}\n```\n\n## Type\n\n`core`\n\n## Installation\n\n```bash\nnpm install @molecule/app-state @molecule/app-bond @molecule/app-logger\n```\n\n## API\n\n### Interfaces\n\n#### `AsyncState`\n\nAsync state tuple.\n\n```typescript\ninterface AsyncState<T> {\n  /**\n   * Current data value.\n   */\n  data: T\n\n  /**\n   * Whether the state is loading.\n   */\n  loading: boolean\n\n  /**\n   * Error if any occurred.\n   */\n  error: Error | null\n}\n```\n\n#### `AsyncStateActions`\n\nAsync state actions.\n\n```typescript\ninterface AsyncStateActions<T> {\n  /**\n   * Sets the data value.\n   */\n  setData(data: T): void\n\n  /**\n   * Sets the loading state.\n   */\n  setLoading(loading: boolean): void\n\n  /**\n   * Sets an error.\n   */\n  setError(error: Error | null): void\n\n  /**\n   * Resets to initial state.\n   */\n  reset(): void\n\n  /**\n   * Executes an async operation, handling loading/error states.\n   */\n  execute<R>(fn: () => Promise<R>): Promise<R>\n}\n```\n\n#### `PersistStorage`\n\nSimple storage adapter interface for persist middleware.\nCompatible with `localStorage`, `sessionStorage`, and\n`@molecule/app-storage` providers.\n\n```typescript\ninterface PersistStorage {\n  getItem(key: string): string | null\n  setItem(key: string, value: string): void\n}\n```\n\n#### `OptimisticValueOptions`\n\nOptions for {@link createOptimisticValue}.\n\n```typescript\ninterface OptimisticValueOptions<T> {\n  /**\n   * The server's current value, for example `repository.starred` or\n   * `{ starred, stars }` from the record the page loaded.\n   */\n  value: T\n\n  /**\n   * Saves one change (for example `next ? post(...) : delete(...)`). Only one save runs at a time;\n   * the next one starts after it settles.\n   */\n  commit: OptimisticCommit<T>\n\n  /**\n   * Whether two values are the same change. Decides whether a save is needed and whether a new\n   * server value differs. Defaults to {@link shallowEqual}.\n   */\n  equals?: (a: T, b: T) => boolean\n\n  /**\n   * Called when the newest change fails and the value has gone back to the server's value.\n   * A thrown callback error is logged without replacing the save failure.\n   *\n   * @param error - The rejection from {@link OptimisticValueOptions.commit}.\n   * @param value - The server's value now shown again.\n   */\n  onError?: (error: unknown, value: T) => void\n}\n```\n\n#### `OptimisticValueState`\n\nWhat to render.\n\n```typescript\ninterface OptimisticValueState<T> {\n  /** The newest value the person chose, or the server's value when nothing is being saved. */\n  value: T\n\n  /** Whether a save is running or waiting to run. */\n  pending: boolean\n\n  /** The failure of the newest change, after the value went back; `null` otherwise. */\n  error: unknown\n}\n```\n\n#### `OptimisticValue`\n\nA value that the UI changes at once and saves in order.\n\n```typescript\ninterface OptimisticValue<T> {\n  /**\n   * The current state. The same object is returned until something changes, so it can be a\n   * `useSyncExternalStore` snapshot.\n   *\n   * @returns The current state.\n   */\n  getState(): OptimisticValueState<T>\n\n  /**\n   * Shows `next` at once and saves it. A change made while a save runs is never dropped: it is\n   * saved after that save settles, and only the newest change is saved.\n   *\n   * @param next - The value the person chose.\n   */\n  set(next: T): void\n\n  /**\n   * Like {@link OptimisticValue.set}, computed from the value shown now, so repeated taps build on\n   * each other (`update((on) => !on)`).\n   *\n   * @param change - Computes the next value from the value shown now.\n   */\n  update(change: (current: T) => T): void\n\n  /**\n   * Takes a newer server value, for example new props after the page refetched. While a save runs,\n   * the value shown does not change; the new value is kept as the server's value and is shown if\n   * the save fails.\n   *\n   * @param value - The server's value.\n   */\n  sync(value: T): void\n\n  /**\n   * Observes changes. Does not call the listener for the current state.\n   * Listener errors are logged and do not interrupt saves or other listeners.\n   *\n   * @param listener - Called with each new state.\n   * @returns Stops observing.\n   */\n  subscribe(listener: (state: OptimisticValueState<T>) => void): () => void\n\n  /**\n   * Resolves once nothing is being saved.\n   *\n   * @returns The state at that moment.\n   */\n  settled(): Promise<OptimisticValueState<T>>\n}\n```\n\n#### `StoreConfig`\n\nConfiguration for creating a store (initial state, optional name, and middleware chain).\n\n```typescript\ninterface StoreConfig<T> {\n  /**\n   * Initial state value.\n   */\n  initialState: T\n\n  /**\n   * Optional name for debugging.\n   */\n  name?: string\n\n  /**\n   * Optional middleware functions.\n   */\n  middleware?: StoreMiddleware<T>[]\n}\n```\n\n#### `Store`\n\nReactive state container with getState, setState, subscribe, and destroy.\n\nAll state management providers must implement this interface.\n\n```typescript\ninterface Store<T> {\n  /**\n   * Gets the current state.\n   */\n  getState(): T\n\n  /**\n   * Sets the state (partial or via updater function).\n   */\n  setState(partial: Partial<T> | ((state: T) => Partial<T>)): void\n\n  /**\n   * Subscribes to state changes.\n   * Returns an unsubscribe function.\n   */\n  subscribe(listener: StateListener<T>): () => void\n\n  /**\n   * Destroys the store and cleans up subscriptions.\n   */\n  destroy(): void\n}\n```\n\n#### `StateProvider`\n\nState provider interface that all state management bond packages\nmust implement. Provides the store creation factory.\n\n```typescript\ninterface StateProvider {\n  /**\n   * Creates a new store.\n   */\n  createStore<T>(config: StoreConfig<T>): Store<T>\n}\n```\n\n### Types\n\n#### `OptimisticCommit`\n\nSaves one change on the server.\n\n```typescript\ntype OptimisticCommit<T> = (\n  next: T,\n  previous: T,\n  confirm: (change: (current: T) => T) => void,\n) => Promise<T | void>\n```\n\n- `next` — The value to save.\n- `previous` — The value the server held before this change, as far as the client knows.\n- `confirm` — Records an acknowledged part of a multi-request save, without replacing the optimistic value. Pass an updater so unrelated refetched fields survive. If a later request fails, rollback and any queued save use this confirmed progress. Calls after this commit settles are ignored.\n\n**Returns:** The server's value after the change, or nothing to keep `next`. Reject when the save fails. After calling `confirm`, returning nothing keeps the confirmed progress instead.\n\n#### `StoreMiddleware`\n\nStore middleware function. Wraps the `set` function to intercept\nstate updates (e.g. for logging, persistence, or devtools).\n\n```typescript\ntype StoreMiddleware<T> = (set: SetState<T>, get: GetState<T>) => SetState<T>\n```\n\n- `set` — The original setState function to wrap.\n- `get` — A function returning the current state.\n\n#### `SetState`\n\nFunction to update store state with a partial object or updater function.\n\n```typescript\ntype SetState<T> = (partial: Partial<T> | ((state: T) => Partial<T>)) => void\n```\n\n#### `GetState`\n\nGet state function type.\n\n```typescript\ntype GetState<T> = () => T\n```\n\n#### `StateListener`\n\nCallback invoked whenever store state changes.\n\n```typescript\ntype StateListener<T> = (state: T, prevState: T) => void\n```\n\n- `state` — The new state after the update.\n- `prevState` — The state before the update.\n\n#### `Selector`\n\nSelector function that derives a value from store state.\n\n```typescript\ntype Selector<T, S> = (state: T) => S\n```\n\n- `state` — The full store state to select from.\n\n#### `EqualityFn`\n\nEquality comparator for selectors. When provided, prevents\nre-renders if the selected value is equal to the previous one.\n\n```typescript\ntype EqualityFn<T> = (a: T, b: T) => boolean\n```\n\n### Functions\n\n#### `createAsyncState(initialData)`\n\nCreates an async state container with loading/error tracking.\n\n```typescript\nfunction createAsyncState<T>(initialData: T): [AsyncState<T>, AsyncStateActions<T>]\n```\n\n- `initialData` — The initial data value.\n\n**Returns:** A tuple of `[state, actions]` for reading and updating the async state.\n\n#### `loggerMiddleware(name)`\n\nLogging middleware — logs previous and next state on every update.\n\n```typescript\nfunction loggerMiddleware<T>(name?: string): StoreMiddleware<T>\n```\n\n- `name` — Optional store name for log prefix (defaults to `'store'`).\n\n**Returns:** A store middleware that logs state transitions.\n\n#### `persistMiddleware(key, storage)`\n\nPersist middleware — saves state to storage on every update and\nrestores it on initialization.\n\nAccepts any object implementing `PersistStorage` (`getItem` + `setItem`).\nDefaults to in-memory storage.\n\n```typescript\nfunction persistMiddleware<T>(key: string, storage?: PersistStorage): StoreMiddleware<T>\n```\n\n- `key` — The storage key to persist state under.\n- `storage` — A `PersistStorage`-compatible object (defaults to in-memory).\n\n**Returns:** A store middleware that persists state to the given storage.\n\n#### `createOptimisticValue(options)`\n\nCreates a server-backed value that the UI changes at once and saves in order: a favorite,\nfollow, like or bookmark button, a rating, a quantity, a setting switch.\n\nA tap while a save runs is never ignored. Saves run one at a time, so the server receives the\nchanges in the order they were made, and when the person changes their mind several times\nduring one save, only the newest value is saved after it. When the newest change fails, the\nvalue goes back to the server's value and `error` is set; a failure that a newer change has\nalready replaced is not shown.\n\n```typescript\nfunction createOptimisticValue<T>(options: OptimisticValueOptions<T>): OptimisticValue<T>\n```\n\n- `options` — The server's current value and how to save a change.\n\n**Returns:** The value's controller.\n\n#### `setProvider(provider)`\n\nRegisters a state provider as the active singleton. Called by bond\npackages during application startup.\n\n```typescript\nfunction setProvider(provider: StateProvider): void\n```\n\n- `provider` — The state provider implementation to bond.\n\n#### `getProvider()`\n\nRetrieves the bonded state provider, throwing if none is configured.\n\n```typescript\nfunction getProvider(): StateProvider\n```\n\n**Returns:** The bonded state provider.\n\n#### `hasProvider()`\n\nChecks whether a state provider is currently bonded.\n\n```typescript\nfunction hasProvider(): boolean\n```\n\n**Returns:** `true` if a state provider is bonded.\n\n#### `createStore(config)`\n\nCreates a new reactive state store using the bonded provider.\n\n```typescript\nfunction createStore<T>(config: StoreConfig<T>): Store<T>\n```\n\n- `config` — Store configuration including initial state, actions, selectors, and middleware.\n\n**Returns:** A reactive store instance with `getState()`, `setState()`, and `subscribe()` methods.\n\n#### `createSimpleStateProvider()`\n\nCreates a vanilla JavaScript state provider that manages stores\nwith simple object spreading and listener-based subscriptions.\n\n```typescript\nfunction createSimpleStateProvider(): StateProvider\n```\n\n**Returns:** A `StateProvider` implementation.\n\n#### `combineStores(stores)`\n\nCombines multiple stores into a single composite store. Each key\nin `stores` becomes a top-level key in the combined state.\n\n```typescript\nfunction combineStores<T extends Record<string, unknown>>(stores: {\n  [K in keyof T]: Store<T[K]>\n}): Store<T>\n```\n\n- `stores` — A record mapping keys to individual stores.\n\n**Returns:** A composite `Store` that delegates to the individual stores.\n\n#### `shallowEqual(a, b)`\n\nPerforms a shallow equality comparison between two values.\nReturns `true` if both values have the same top-level keys\nwith identical values (using `Object.is`).\n\n```typescript\nfunction shallowEqual<T>(a: T, b: T): boolean\n```\n\n- `a` — First value to compare.\n- `b` — Second value to compare.\n\n**Returns:** `true` if the values are shallowly equal.\n\n#### `produce(state, recipe)`\n\nSimplified produce helper for immutable state updates.\nCreates a shallow copy, applies the recipe, and returns the result.\n\n```typescript\nfunction produce<T extends object>(state: T, recipe: (draft: T) => void): T\n```\n\n- `state` — The current state object.\n- `recipe` — A function that mutates the draft copy.\n\n**Returns:** A new state object with the recipe's mutations applied.\n\n### Constants\n\n#### `simpleProvider`\n\nPre-created default state provider instance.\n\n```typescript\nconst simpleProvider: StateProvider\n```\n\n## Available Providers\n\n| Provider | Package                       |\n| -------- | ----------------------------- |\n| Jotai    | `@molecule/app-state-jotai`   |\n| Redux    | `@molecule/app-state-redux`   |\n| Zustand  | `@molecule/app-state-zustand` |\n\n## Injection Notes\n\n### Requirements\n\nPeer dependencies:\n\n- `@molecule/app-bond` ^1.0.1\n- `@molecule/app-logger` ^1.0.1\n\n### Runtime Dependencies\n\n- `@molecule/app-bond`\n- `@molecule/app-logger`\n\nDefine stores with {@link createStore} and read them through the framework hook\n(`useStore(store)` in React / the Vue composable) — do NOT `import` zustand / redux /\njotai directly in a component; that couples you to one library and breaks the swap. For a\nlarge store, pass a selector via the hook's options so a component re-renders only when the\nslice it reads changes.\n\n- This is CLIENT/UI state — NOT the source of truth for server data. Fetch server data\n  through the HTTP client (`@molecule/app-http`) and keep the store for UI/session state.\n- **A server-backed value the person toggles or sets (favorite, follow, like, bookmark,\n  rating, quantity, a setting switch) uses {@link createOptimisticValue}** (React:\n  `useOptimisticValue` from `@molecule/app-react`). It shows each change at once, saves one\n  change at a time in order, saves a change made during a save right after it, and goes back to\n  the server value only when the newest change fails. Do not ignore taps while a request is\n  pending, and do not let a refetch replace the value while a save runs.\n  A commit containing multiple requests must call its third argument, `confirm`, after each\n  successful request: `confirm((current) => ({ ...current, [id]: saved }))`. Return nothing\n  after recording progress. A later rejection then rolls back only unsaved changes, and a\n  queued intent is compared with what the server actually accepted.\n- **{@link persistMiddleware} persists to storage — never persist a secret or auth token**\n  there (client storage is XSS-exfiltratable; the bearer token is memory-only — see\n  `@molecule/app-storage`). Persist only non-sensitive UI state, via the storage\n  ABSTRACTION, never raw `localStorage`.\n- **A state provider must be bonded before a store is created.** In a scaffolded app that\n  is automatic: `setupAllDefaultBonds()` (from `@molecule/app-bonds-default-react`, called\n  by `app/src/bonds/index.ts`'s `setupProviders()`) bonds the vanilla\n  `simpleProvider`, and the app's `<MoleculeProvider>` supplies the React context\n  `useStore()` reads. To use another provider, bond it instead (e.g.\n  `@molecule/app-state-zustand` with `setProvider()`) — `createStore()` call sites do not\n  change.\n- **Never create a store at module scope.** Module bodies run before\n  `setupProviders()`, so a top-level `createStore()` throws\n  `@molecule/app-state: No provider set` at import time: every page renders blank while\n  `tsc` passes. Create it lazily (a getter the component calls) or inside the component,\n  after the provider is set.\n","readmeFilename":"README.md"}