{"_id":"@reactive-cache/core","_rev":"44-8316f504a956fa32bfee9920d82d6424","name":"@reactive-cache/core","dist-tags":{"latest":"3.2.2"},"versions":{"2.7.0":{"name":"@reactive-cache/core","version":"2.7.0","keywords":["angular","rxjs","signal","cache","state-manager","state"],"author":{"name":"https://github.com/Jor-ban"},"license":"ISC","_id":"@reactive-cache/core@2.7.0","maintainers":[{"name":"jorban","email":"emandem1@ya.ru"}],"homepage":"https://github.com/Jor-ban/reactive-cache#readme","bugs":{"url":"https://github.com/Jor-ban/reactive-cache/issues"},"dist":{"shasum":"f3afcec50895f6019520a648fbc036eae9822f5e","tarball":"https://registry.npmjs.org/@reactive-cache/core/-/core-2.7.0.tgz","fileCount":14,"integrity":"sha512-Xq+/hKzkkBDm49D1/GEE5nmfjwPKgC41NUBMrooB+GY5nArpQZGQCy3kqfdALySZvuSVdxSDdGsCAQfwNwKqKw==","signatures":[{"sig":"MEUCIB3lhiSYMNpqvOzSUfwQ8SiE6Q3Bu/lXfJbTIq6tFUfzAiEA5YPjrnEcSZ/jYmeO3iD/Ip+9iUxRYNJyFEEwOnF6vkg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43700},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"d36c3870ea3206319732b5715a40565200322c08","private":false,"scripts":{"test":"npx tsc && tsx watch src/test.ts && echo 'all tests are complete!'","prepare":"npx tsc && rm -f ./dist/test.js"},"_npmUser":{"name":"jorban","actor":{"name":"jorban","type":"user","email":"emandem1@ya.ru"},"email":"emandem1@ya.ru"},"repository":{"url":"git+https://github.com/Jor-ban/reactive-cache.git","type":"git"},"_npmVersion":"10.9.2","description":"reactive cache for angular and rxjs or signal projects","directories":{},"_nodeVersion":"22.14.0","dependencies":{"rxjs":"^7.8.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","axios":"^1.7.9","ts-node":"^10.9.2","typescript":"^5.5.3","@reactive-cache/core":"^0.1.4"},"_npmOperationalInternal":{"tmp":"tmp/core_2.7.0_1751150741217_0.9602085103359042","host":"s3://npm-registry-packages-npm-production"}},"2.8.0":{"name":"@reactive-cache/core","version":"2.8.0","keywords":["angular","rxjs","signal","cache","state-manager","state"],"author":{"name":"https://github.com/Jor-ban"},"license":"ISC","_id":"@reactive-cache/core@2.8.0","maintainers":[{"name":"jorban","email":"emandem1@ya.ru"}],"homepage":"https://github.com/Jor-ban/reactive-cache#readme","bugs":{"url":"https://github.com/Jor-ban/reactive-cache/issues"},"dist":{"shasum":"1e84dfda78d290da34f4c1d46ea7a58012b4d8e9","tarball":"https://registry.npmjs.org/@reactive-cache/core/-/core-2.8.0.tgz","fileCount":14,"integrity":"sha512-OGNBMHs4afLNUoHpg99boKi3K3E6J2l3g7boDsP/ezICUmwUyf7DaF7wUkDKb4+iupdrJZPCMl6aImDTdoh0ZA==","signatures":[{"sig":"MEQCIB01DGOI6NYttavC1V48gHRZ5GrrnWXCjNx4J+yjQlNZAiAFeF8H+BZLuI9GW7m3mSUxoKrIgUtu30/IuHVOQubwyQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43745},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"d36c3870ea3206319732b5715a40565200322c08","scripts":{"test":"npx tsc && tsx watch src/test.ts && echo 'all tests are complete!'","prepare":"npx tsc && rm -f ./dist/test.js"},"_npmUser":{"name":"jorban","actor":{"name":"jorban","type":"user","email":"emandem1@ya.ru"},"email":"emandem1@ya.ru"},"repository":{"url":"git+https://github.com/Jor-ban/reactive-cache.git","type":"git"},"_npmVersion":"10.9.2","description":"reactive cache for angular and rxjs or signal projects","directories":{},"_nodeVersion":"22.14.0","dependencies":{"rxjs":"^7.8.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","axios":"^1.7.9","ts-node":"^10.9.2","typescript":"^5.5.3","@reactive-cache/core":"^0.1.4"},"_npmOperationalInternal":{"tmp":"tmp/core_2.8.0_1751226189167_0.7940243217226206","host":"s3://npm-registry-packages-npm-production"}},"2.9.0":{"name":"@reactive-cache/core","version":"2.9.0","keywords":["angular","rxjs","signal","cache","state-manager","state"],"author":{"name":"https://github.com/Jor-ban"},"license":"ISC","_id":"@reactive-cache/core@2.9.0","maintainers":[{"name":"jorban","email":"emandem1@ya.ru"}],"homepage":"https://github.com/Jor-ban/reactive-cache#readme","bugs":{"url":"https://github.com/Jor-ban/reactive-cache/issues"},"dist":{"shasum":"2bfab1e6d245373b239c4e38481c8aa11a471964","tarball":"https://registry.npmjs.org/@reactive-cache/core/-/core-2.9.0.tgz","fileCount":14,"integrity":"sha512-e2q1ZYq2cZJNjeA8agzEmQFkGm8kpeQFiCl+ZH48YjCnD8g3Q9teSxGPzMMJDDG4rsuIjSQyMq9eI8CYo//wSw==","signatures":[{"sig":"MEUCIGW4UeSm6HLym7VahhJHM4d6fZcseiAZhXZop8kS6By9AiEA7m/7zpTOrq2SVH5+J2BkR7P/zoVz5GziZsOg66Pm4yA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43951},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"d36c3870ea3206319732b5715a40565200322c08","scripts":{"test":"npx tsc && tsx watch src/test.ts && echo 'all tests are complete!'","prepare":"npx tsc && rm -f ./dist/test.js"},"_npmUser":{"name":"jorban","actor":{"name":"jorban","type":"user","email":"emandem1@ya.ru"},"email":"emandem1@ya.ru"},"repository":{"url":"git+https://github.com/Jor-ban/reactive-cache.git","type":"git"},"_npmVersion":"10.9.2","description":"reactive cache for angular and rxjs or signal projects","directories":{},"_nodeVersion":"22.14.0","dependencies":{"rxjs":"^7.8.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","axios":"^1.7.9","ts-node":"^10.9.2","typescript":"^5.5.3","@reactive-cache/core":"^0.1.4"},"_npmOperationalInternal":{"tmp":"tmp/core_2.9.0_1751406966308_0.7632372414474005","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@reactive-cache/core","version":"3.0.0","keywords":["angular","rxjs","signal","cache","state-manager","state"],"author":{"name":"https://github.com/Jor-ban"},"license":"ISC","_id":"@reactive-cache/core@3.0.0","maintainers":[{"name":"jorban","email":"emandem1@ya.ru"}],"homepage":"https://github.com/Jor-ban/reactive-cache#readme","bugs":{"url":"https://github.com/Jor-ban/reactive-cache/issues"},"dist":{"shasum":"cfa78995a2f9779006249317b8811be3048e324a","tarball":"https://registry.npmjs.org/@reactive-cache/core/-/core-3.0.0.tgz","fileCount":10,"integrity":"sha512-zAOXallwhlpDKIX5Cr08MANDAI9+ikSwqcsm2j+LWA/1xzZ8jYEB9LNGJ4hhJV/kdZ2cqH31xqTn3j2dtXFLmg==","signatures":[{"sig":"MEUCIQCY/m61vnhf9uXD1m3vISb+eHp7iIfV4wIQ9diw7W1wsgIgVi5/XSNocVBn/twftp1V0u5SYNiB5b4e34bECcA44kc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43660},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"d36c3870ea3206319732b5715a40565200322c08","scripts":{"test":"npx tsc && tsx watch src/test.ts && echo 'all tests are complete!'","prepare":"npx tsc && rm -f ./dist/test.js","manual-test":"npx tsc && tsx watch src/manualTest.ts"},"_npmUser":{"name":"jorban","email":"emandem1@ya.ru"},"repository":{"url":"git+https://github.com/Jor-ban/reactive-cache.git","type":"git"},"_npmVersion":"11.7.0","description":"reactive cache for angular and rxjs or signal projects","directories":{},"_nodeVersion":"22.21.1","dependencies":{"rxjs":"^7.8.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","axios":"^1.7.9","ts-node":"^10.9.2","typescript":"^5.5.3","@reactive-cache/core":"^0.1.4"},"_npmOperationalInternal":{"tmp":"tmp/core_3.0.0_1768981565158_0.5899734034769917","host":"s3://npm-registry-packages-npm-production"}},"3.1.0":{"name":"@reactive-cache/core","version":"3.1.0","keywords":["angular","rxjs","signal","cache","state-manager","state"],"author":{"name":"https://github.com/Jor-ban"},"license":"ISC","_id":"@reactive-cache/core@3.1.0","maintainers":[{"name":"jorban","email":"emandem1@ya.ru"}],"homepage":"https://github.com/Jor-ban/reactive-cache#readme","bugs":{"url":"https://github.com/Jor-ban/reactive-cache/issues"},"dist":{"shasum":"1cfdc86410d45f7591a420b5e19ab1ae7ff925e4","tarball":"https://registry.npmjs.org/@reactive-cache/core/-/core-3.1.0.tgz","fileCount":6,"integrity":"sha512-xo69CO3g4sZJLme8C0ou55lPIhW5rhWv0hK0VZSRmUxSpS2+373CmEfgqwRPBunxsgGXEN9/EjZOLuX20PHIDw==","signatures":[{"sig":"MEQCIB/Ev9F7uIZPkwq4voFUmODnm/VHNSYjJL4eekMp/wm2AiABdFKD1KdrNrOlaJJaE6iCjfMCyWmBIZNmTiCmU8WsTA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16088},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"d8b74ac338428489f668d4e20beb38a15b6ec90d","scripts":{"test":"npx tsc && tsx watch src/test.ts && echo 'all tests are complete!'","prepare":"npx tsc && rm -f ./dist/test.js","manual-test":"npx tsc && tsx watch src/manualTest.ts"},"_npmUser":{"name":"jorban","email":"emandem1@ya.ru"},"repository":{"url":"git+https://github.com/Jor-ban/reactive-cache.git","type":"git"},"_npmVersion":"11.7.0","description":"reactive cache for angular and rxjs or signal projects","directories":{},"_nodeVersion":"22.21.1","dependencies":{"rxjs":"^7.8.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","axios":"^1.7.9","ts-node":"^10.9.2","typescript":"^5.5.3","@reactive-cache/core":"^0.1.4"},"_npmOperationalInternal":{"tmp":"tmp/core_3.1.0_1769062084053_0.6409710788942693","host":"s3://npm-registry-packages-npm-production"}},"3.2.0":{"name":"@reactive-cache/core","version":"3.2.0","keywords":["angular","rxjs","signal","cache","state-manager","state"],"author":{"name":"https://github.com/Jor-ban"},"license":"ISC","_id":"@reactive-cache/core@3.2.0","maintainers":[{"name":"jorban","email":"emandem1@ya.ru"}],"homepage":"https://github.com/Jor-ban/reactive-cache#readme","bugs":{"url":"https://github.com/Jor-ban/reactive-cache/issues"},"dist":{"shasum":"aaa0c071ea9ce8623012d19500fab836412d436a","tarball":"https://registry.npmjs.org/@reactive-cache/core/-/core-3.2.0.tgz","fileCount":5,"integrity":"sha512-UiMHsnBiSF0Li6JqLAlxFi1HdMeBKgBtGyVtEuirs8kx2n7F7yB4JjbynLyb6cXdGpEZ3pE/G1XdBVWpfp37Fw==","signatures":[{"sig":"MEUCIF8jtZGokbQ2UMYfGqIdBhuRiFI5n2aTzLVur3dGTvwiAiEA0MX+e4TLER6rbop8yHvIaaFkrj4WbK0AsU6UFviDErk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16793},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"f711629e7e7083d1821569e5897ee423f327af5d","scripts":{"test":"npx tsc && tsx watch src/test.ts && echo 'all tests are complete!'","prepare":"npx tsc && rm -f ./dist/test.js","manual-test":"npx tsc && tsx watch src/manualTest.ts"},"_npmUser":{"name":"jorban","email":"emandem1@ya.ru"},"repository":{"url":"git+https://github.com/Jor-ban/reactive-cache.git","type":"git"},"_npmVersion":"11.7.0","description":"reactive cache for angular and rxjs or signal projects","directories":{},"_nodeVersion":"22.21.1","dependencies":{"rxjs":"^7.8.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","axios":"^1.7.9","ts-node":"^10.9.2","typescript":"^5.5.3","@reactive-cache/core":"^0.1.4"},"_npmOperationalInternal":{"tmp":"tmp/core_3.2.0_1770267379277_0.6838257853531537","host":"s3://npm-registry-packages-npm-production"}},"3.2.2":{"name":"@reactive-cache/core","version":"3.2.2","type":"module","scripts":{"test":"npx tsc && tsx watch src/test.ts && echo 'all tests are complete!'","manual-test":"npx tsc && tsx watch src/manualTest.ts","prepare":"npx tsc && rm -f ./dist/test.js","serve":"npx serve ."},"devDependencies":{"@reactive-cache/core":"^0.1.4","axios":"^1.7.9","ts-node":"^10.9.2","tsx":"^4.19.2","typescript":"^5.5.3"},"dependencies":{"rxjs":"^7.8.1"},"description":"reactive cache for angular and rxjs or signal projects","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/Jor-ban/reactive-cache.git"},"keywords":["angular","rxjs","signal","cache","state-manager","state"],"author":{"name":"https://github.com/Jor-ban"},"license":"ISC","bugs":{"url":"https://github.com/Jor-ban/reactive-cache/issues"},"homepage":"https://github.com/Jor-ban/reactive-cache#readme","gitHead":"ec87a6483c4b3b324d9e3f3d9e111ed952002450","types":"./dist/index.d.ts","_id":"@reactive-cache/core@3.2.2","_nodeVersion":"25.6.1","_npmVersion":"11.9.0","dist":{"integrity":"sha512-OC6beMcItB7gSwwQq2f4ccoWYOTk6EDwm8a3K5gS6pa2kctgNbhNx8NpzNSODF8qlX0C/OcwYkg5u0AdCXks7A==","shasum":"919d2dd79c4f882cbef6f1b3b585c40560e4841a","tarball":"https://registry.npmjs.org/@reactive-cache/core/-/core-3.2.2.tgz","fileCount":5,"unpackedSize":16825,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC6ckkqy2zX+/tp3IKIc7qVhcbKFkq37Q9FVSXMeCfqgwIhAJbYfyxWvkzngi6ZCGLLfDVhkyu5tKxvFIG3l4/M1C1y"}]},"_npmUser":{"name":"jorban","email":"emandem1@ya.ru"},"directories":{},"maintainers":[{"name":"jorban","email":"emandem1@ya.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_3.2.2_1774265684264_0.3604566489517218"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-28T22:45:40.766Z","modified":"2026-03-23T11:34:44.608Z","0.1.0":"2024-08-19T15:30:45.221Z","0.1.1":"2024-08-19T15:38:02.589Z","0.1.2":"2024-08-19T15:45:38.024Z","0.1.3":"2024-08-19T15:45:54.534Z","0.1.4":"2024-08-19T15:46:58.383Z","0.1.5":"2024-08-19T15:55:43.684Z","0.1.6":"2024-08-20T07:30:47.339Z","0.1.7":"2024-08-20T07:32:23.749Z","0.1.8":"2024-08-20T08:49:11.894Z","0.1.9":"2024-08-20T08:55:45.443Z","0.1.10":"2024-08-20T08:56:09.679Z","0.1.11":"2024-08-20T09:08:29.752Z","0.2.0":"2024-08-28T22:57:32.649Z","0.2.1":"2024-09-23T10:12:01.188Z","0.2.2":"2024-09-23T10:29:33.074Z","0.2.3":"2024-09-23T10:34:17.790Z","0.3.0":"2024-09-23T11:28:26.669Z","1.0.0":"2024-11-12T10:28:20.761Z","1.1.0":"2024-11-12T10:50:50.854Z","1.2.0":"2024-11-12T11:12:09.845Z","1.5.0":"2024-12-04T08:31:35.366Z","1.6.0":"2024-12-04T09:21:29.952Z","1.7.0":"2024-12-06T13:53:13.829Z","1.8.0":"2024-12-13T13:43:30.459Z","2.0.0":"2024-12-14T06:35:05.155Z","2.1.0":"2024-12-16T08:42:09.930Z","2.2.0":"2024-12-16T09:34:53.619Z","2.2.2":"2024-12-16T09:37:08.196Z","2.2.3":"2024-12-16T09:53:08.816Z","2.3.0":"2024-12-18T07:44:51.492Z","2.3.1":"2024-12-18T07:51:15.035Z","2.3.2":"2024-12-27T11:19:45.206Z","2.4.0":"2024-12-27T12:19:37.128Z","2.5.0":"2025-01-14T09:06:03.682Z","2.6.0":"2025-01-14T09:07:29.071Z","2.7.0":"2025-06-28T22:45:41.404Z","2.8.0":"2025-06-29T19:43:09.333Z","2.9.0":"2025-07-01T21:56:06.519Z","3.0.0":"2026-01-21T07:46:05.365Z","3.1.0":"2026-01-22T06:08:04.182Z","3.2.0":"2026-02-05T04:56:19.433Z","3.2.2":"2026-03-23T11:34:44.461Z"},"bugs":{"url":"https://github.com/Jor-ban/reactive-cache/issues"},"author":{"name":"https://github.com/Jor-ban"},"license":"ISC","homepage":"https://github.com/Jor-ban/reactive-cache#readme","keywords":["angular","rxjs","signal","cache","state-manager","state"],"repository":{"type":"git","url":"git+https://github.com/Jor-ban/reactive-cache.git"},"description":"reactive cache for angular and rxjs or signal projects","maintainers":[{"name":"jorban","email":"emandem1@ya.ru"}],"readme":"# Reactive Cache\r\n\r\n<a href=\"https://www.npmjs.com/package/@reactive-cache/core?activeTab=readme\">\r\n    <img src=\"https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white\" />\r\n</a>\r\n\r\n## Core Idea\r\n\r\n  You give it a data source, it returns an Observable-like object that:\r\n  - Lazily fetches data only when subscribed to\r\n  - Caches the result to prevent redundant calls\r\n  - Allows manual updates (next(), update(), resetState())\r\n  - Provides synchronous access to the current value (in certain variants)\r\n\r\n## Cache Variants\r\n| Factory   |      Description      |\r\n|----------|:-------------:|\r\n| reactiveCache()   |   Full-featured cache with manual updates |\r\n| reactiveCache.readonly() |    Immutable — no manual state changes   |\r\n| reactiveCache.valueReadable()  | Adds synchronous getValue() access |\r\n| reactiveCache.anonymous()  | Unnamed (no global tracking) |\r\n| reactiveCache.constant()  | Emits once, ignores subsequent parent updates |\r\n\r\n## Installation\r\n\r\n```bash\r\n$ npm install @reactive-cache/core\r\n```\r\n\r\n\r\n## Usage\r\n```typescript\r\nimport { reactiveCache } from \"@reactive-cache/core\";\r\nimport { first, map } from \"rxjs\";\r\nimport { ajax } from \"rxjs/ajax\";\r\n\r\n// lets just create an observable that makes http requests\r\nconst cachedTodo = reactiveCache<Todo>(\r\n  \"cachedObservable\",\r\n  ajax<Todo>(\"https://jsonplaceholder.typicode.com/todos/1\").pipe(\r\n    map((respWithMetadata) => respWithMetadata.response)\r\n  )\r\n);\r\n\r\n// even tho the observable has many subscriptions, the request has not made again\r\ncachedTodo\r\n  .pipe(map((todo: Todo) => \"Author id is: \" + todo.userId))\r\n  .subscribe(console.log);\r\n\r\ncachedTodo.pipe(map((todo: Todo) => \"Title is: \" + todo.userId)).subscribe(console.log);\r\n\r\ncachedTodo\r\n  .pipe(map((todo: Todo) => (todo.completed ? \"Completed\" : \"Not completed\")))\r\n  .subscribe(console.log);\r\n\r\nsetTimeout(() => {\r\n  // the state just being droped and empty until a new subscription is emited\r\n  cachedTodo.resetState();\r\n  console.log(\"----------[ here the state resets ]-------------\");\r\n}, 5_000);\r\n\r\nsetTimeout(() => {\r\n  // a new subscription has been emited, and all old subscribers instantly get new data\r\n  cachedTodo.pipe(map((todo: Todo) => \"Todo id: \" + todo.id)).subscribe(console.log);\r\n}, 7_000);\r\n\r\nsetTimeout(() => {\r\n  console.log(\"-----------[ calling update ]------------\");\r\n  // now lets try to make it update itself without reseting\r\n  cachedTodo\r\n    .update()\r\n    .pipe(first())\r\n    .subscribe(() => {\r\n      console.log(\"---[ as you can see subscribers get update instantly ]---\");\r\n    });\r\n}, 10_000);\r\n```\r\n## Output\r\n\r\n```bash\r\nTitle is: 1\r\nNot completed\r\nAuthor id is: 1\r\n----------[ here the state resets ]-------------\r\nTitle is: 1\r\nNot completed\r\nAuthor id is: 1\r\nTodo id: 1\r\n-----------[ calling update ]------------\r\nTitle is: 1\r\nNot completed\r\nAuthor id is: 1\r\nTodo id: 1\r\n---[ as you can see subscribers get update instantly ]---\r\n```\r\n\r\n[![Edit reactive-cache-example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://yst6xw.csb.app/)","readmeFilename":"README.md"}