@telperion/reactive-storage 1.2.0 → 1.3.1

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.
Files changed (55) hide show
  1. package/.build-manifest.json +86 -0
  2. package/README.md +6 -6
  3. package/fesm/reactive-storage.mjs +639 -0
  4. package/fesm/reactive-storage.mjs.map +1 -0
  5. package/index.cjs +17 -8
  6. package/index.cjs.map +1 -0
  7. package/index.d.cts +6 -0
  8. package/index.d.ts +6 -5
  9. package/index.js +5 -6
  10. package/index.js.map +1 -1
  11. package/json-parse.cjs +5 -3
  12. package/json-parse.cjs.map +1 -0
  13. package/json-parse.d.cts +8 -0
  14. package/json-parse.d.ts +3 -1
  15. package/json-parse.js +2 -1
  16. package/json-parse.js.map +1 -1
  17. package/package.json +60 -31
  18. package/reactive-cookie-storage.cjs +69 -50
  19. package/reactive-cookie-storage.cjs.map +1 -0
  20. package/reactive-cookie-storage.d.cts +77 -0
  21. package/reactive-cookie-storage.d.ts +48 -40
  22. package/reactive-cookie-storage.js +60 -41
  23. package/reactive-cookie-storage.js.map +1 -1
  24. package/reactive-storage.cjs +168 -83
  25. package/reactive-storage.cjs.map +1 -0
  26. package/reactive-storage.d.cts +165 -0
  27. package/reactive-storage.d.ts +118 -37
  28. package/reactive-storage.js +128 -43
  29. package/reactive-storage.js.map +1 -1
  30. package/reactive-web-local-storage.cjs +30 -8
  31. package/reactive-web-local-storage.cjs.map +1 -0
  32. package/reactive-web-local-storage.d.cts +37 -0
  33. package/reactive-web-local-storage.d.ts +30 -5
  34. package/reactive-web-local-storage.js +27 -5
  35. package/reactive-web-local-storage.js.map +1 -1
  36. package/reactive-web-session-storage.cjs +24 -8
  37. package/reactive-web-session-storage.cjs.map +1 -0
  38. package/reactive-web-session-storage.d.cts +31 -0
  39. package/reactive-web-session-storage.d.ts +24 -5
  40. package/reactive-web-session-storage.js +21 -5
  41. package/reactive-web-session-storage.js.map +1 -1
  42. package/reactive-web-storage.cjs +42 -27
  43. package/reactive-web-storage.cjs.map +1 -0
  44. package/reactive-web-storage.d.cts +47 -0
  45. package/reactive-web-storage.d.ts +28 -10
  46. package/reactive-web-storage.js +33 -18
  47. package/reactive-web-storage.js.map +1 -1
  48. package/async-iterator.polyfill.cjs +0 -87
  49. package/async-iterator.polyfill.d.ts +0 -2
  50. package/async-iterator.polyfill.js +0 -86
  51. package/async-iterator.polyfill.js.map +0 -1
  52. package/regex-parser.cjs +0 -29
  53. package/regex-parser.d.ts +0 -11
  54. package/regex-parser.js +0 -27
  55. package/regex-parser.js.map +0 -1
@@ -0,0 +1,86 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "name": "reactive-storage",
4
+ "version": "0.0.0",
5
+ "formats": [
6
+ "esm",
7
+ "esmFlat",
8
+ "cjs",
9
+ "dts",
10
+ "dcts"
11
+ ],
12
+ "entries": [
13
+ {
14
+ "name": "index",
15
+ "sourcePath": "src/index.ts",
16
+ "outputs": {
17
+ "esm": "index.js",
18
+ "esmFlat": "fesm/reactive-storage.mjs",
19
+ "cjs": "index.cjs",
20
+ "dts": "index.d.ts",
21
+ "dcts": "index.d.cts"
22
+ }
23
+ },
24
+ {
25
+ "name": "json-parse",
26
+ "sourcePath": "src/json-parse.ts",
27
+ "outputs": {
28
+ "esm": "json-parse.js",
29
+ "cjs": "json-parse.cjs",
30
+ "dts": "json-parse.d.ts",
31
+ "dcts": "json-parse.d.cts"
32
+ }
33
+ },
34
+ {
35
+ "name": "reactive-cookie-storage",
36
+ "sourcePath": "src/reactive-cookie-storage.ts",
37
+ "outputs": {
38
+ "esm": "reactive-cookie-storage.js",
39
+ "cjs": "reactive-cookie-storage.cjs",
40
+ "dts": "reactive-cookie-storage.d.ts",
41
+ "dcts": "reactive-cookie-storage.d.cts"
42
+ }
43
+ },
44
+ {
45
+ "name": "reactive-storage",
46
+ "sourcePath": "src/reactive-storage.ts",
47
+ "outputs": {
48
+ "esm": "reactive-storage.js",
49
+ "cjs": "reactive-storage.cjs",
50
+ "dts": "reactive-storage.d.ts",
51
+ "dcts": "reactive-storage.d.cts"
52
+ }
53
+ },
54
+ {
55
+ "name": "reactive-web-local-storage",
56
+ "sourcePath": "src/reactive-web-local-storage.ts",
57
+ "outputs": {
58
+ "esm": "reactive-web-local-storage.js",
59
+ "cjs": "reactive-web-local-storage.cjs",
60
+ "dts": "reactive-web-local-storage.d.ts",
61
+ "dcts": "reactive-web-local-storage.d.cts"
62
+ }
63
+ },
64
+ {
65
+ "name": "reactive-web-session-storage",
66
+ "sourcePath": "src/reactive-web-session-storage.ts",
67
+ "outputs": {
68
+ "esm": "reactive-web-session-storage.js",
69
+ "cjs": "reactive-web-session-storage.cjs",
70
+ "dts": "reactive-web-session-storage.d.ts",
71
+ "dcts": "reactive-web-session-storage.d.cts"
72
+ }
73
+ },
74
+ {
75
+ "name": "reactive-web-storage",
76
+ "sourcePath": "src/reactive-web-storage.ts",
77
+ "outputs": {
78
+ "esm": "reactive-web-storage.js",
79
+ "cjs": "reactive-web-storage.cjs",
80
+ "dts": "reactive-web-storage.d.ts",
81
+ "dcts": "reactive-web-storage.d.cts"
82
+ }
83
+ }
84
+ ],
85
+ "generatedAt": "2026-11-19T13:52:07.439Z"
86
+ }
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm version](https://badge.fury.io/js/%40telperion%2Freactive-storage.svg)](https://badge.fury.io/js/%40telperion%2Freactive-storage)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- Reactive RxJS-based wrapper for browser storage APIs (localStorage and sessionStorage). Provides an Observable-based API for real-time storage updates with support for nested property access and automatic synchronization.
6
+ Reactive RxJS-based wrapper for browser storage APIs (localStorage and sessionStorage). Provides an Observable-based API for real-time storage updates with support for nested property access. Changes made through an instance (or, for cookies, through linked instances) reach all of its subscribers.
7
7
 
8
8
  ## Features
9
9
 
@@ -100,12 +100,12 @@ const storage = new ReactiveCookieStorage(
100
100
  - `options` (optional): Cookie configuration options
101
101
 
102
102
  **Options:**
103
- - `path` (string): URL path where cookie is valid. Default: `'/'`
103
+ - `path` (string): URL path where cookie is valid. Default: not set (the browser uses the current page's path)
104
104
  - `domain` (string): Domain where cookie is valid. Default: current domain
105
105
  - `maxAge` (number): Cookie lifetime in seconds. Default: `undefined` (session cookie)
106
106
  - `expires` (Date): Absolute expiration date. Default: `undefined`
107
107
  - `secure` (boolean): HTTPS only flag. Default: `false`
108
- - `sameSite` ('strict' | 'lax' | 'none'): CSRF protection level. Default: `'lax'`
108
+ - `sameSite` ('strict' | 'lax' | 'none'): CSRF protection level. Default: not set (the browser default, `lax` in current browsers)
109
109
 
110
110
  **Third Parameter (optional):**
111
111
  - `linker` (any): Value to link multiple instances for cross-instance synchronization. Can be a Symbol, string, number, object, or any other value.
@@ -202,7 +202,7 @@ await storage.set('user', 'profile.name', undefined);
202
202
 
203
203
  #### `patch(storeName: string, key: string, value: any): Promise<void>`
204
204
 
205
- Merge a partial object into existing value. Only works with objects.
205
+ Merge the properties of an object into the object at a path, one level deep. `null` and `undefined` properties are skipped; when there is no object yet, the value starts a new one.
206
206
 
207
207
  **Example:**
208
208
  ```typescript
@@ -240,7 +240,7 @@ await storage.push('todos', 'items', 'Task 2', 'Task 3');
240
240
 
241
241
  #### `drop(storeName: string, key: string, value: any): Promise<void>`
242
242
 
243
- Remove a specific value from an array in storage.
243
+ Remove the first item of an array in storage that equals the value. Items are compared by content (as JSON), so objects match when they have the same properties and values.
244
244
 
245
245
  **Example:**
246
246
  ```typescript
@@ -441,7 +441,7 @@ This library serves as the foundation for framework-specific integrations:
441
441
  3. **Change Tracking**: Internal Subject emits changes that update all subscribers
442
442
  4. **FIFO Queue**: Write operations are queued using `@FifoPromise` decorator to prevent race conditions
443
443
  5. **Immutability**: All emitted values are deep-frozen to prevent accidental mutations
444
- 6. **Native Events**: localStorage uses the storage event for automatic cross-tab synchronization
444
+ 6. **Scope**: Only changes made through the same instance are observed; changes from other tabs or other instances are not
445
445
 
446
446
  ### Cookie Storage
447
447