@reactive-cache/core 3.1.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,23 @@
4
4
  <img src="https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white" />
5
5
  </a>
6
6
 
7
+ ## Core Idea
8
+
9
+ You give it a data source, it returns an Observable-like object that:
10
+ - Lazily fetches data only when subscribed to
11
+ - Caches the result to prevent redundant calls
12
+ - Allows manual updates (next(), update(), resetState())
13
+ - Provides synchronous access to the current value (in certain variants)
14
+
15
+ ## Cache Variants
16
+ | Factory | Description |
17
+ |----------|:-------------:|
18
+ | reactiveCache() | Full-featured cache with manual updates |
19
+ | reactiveCache.readonly() | Immutable — no manual state changes |
20
+ | reactiveCache.valueReadable() | Adds synchronous getValue() access |
21
+ | reactiveCache.anonymous() | Unnamed (no global tracking) |
22
+ | reactiveCache.constant() | Emits once, ignores subsequent parent updates |
23
+
7
24
  ## Installation
8
25
 
9
26
  ```bash
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BehaviorSubject, defer, exhaustMap, filter, from, Observable, switchMap, tap } from "rxjs";
2
- import { NamedBehaviorSubject } from "./named-behavior-subject";
2
+ import { NamedBehaviorSubject } from "./named-behavior-subject.js";
3
3
  export const __REACTIVE_CACHE_WINDOW_PROP_NAME__ = '__REACTIVE_CACHE_DATA__';
4
4
  export const __REACTIVE_CACHES_LIST__ = [];
5
5
  export const __REACTIVE_CACHES_ON_UPDATE_MAP__ = new WeakMap();
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@reactive-cache/core",
3
- "version": "3.1.0",
3
+ "version": "3.2.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "npx tsc && tsx watch src/test.ts && echo 'all tests are complete!'",
7
7
  "manual-test": "npx tsc && tsx watch src/manualTest.ts",
8
- "prepare": "npx tsc && rm -f ./dist/test.js"
8
+ "prepare": "npx tsc && rm -f ./dist/test.js",
9
+ "serve": "npx serve ."
9
10
  },
10
11
  "devDependencies": {
11
12
  "@reactive-cache/core": "^0.1.4",
package/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto