memorio 5.0.0 → 5.1.0

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 (60) hide show
  1. package/README.md +80 -449
  2. package/SECURITY.md +152 -42
  3. package/SUMMARY.md +1 -1
  4. package/adr/001-state-proxy-model.md +95 -96
  5. package/adr/002-observer-semantics.md +179 -180
  6. package/adr/003-deep-mutation-semantics.md +7 -8
  7. package/adr/004-array-mutation-semantics.md +127 -128
  8. package/adr/005-scheduler-contract.md +148 -149
  9. package/adr/006-context-isolation.md +91 -92
  10. package/adr/007-mutation-records.md +5 -6
  11. package/adr/008-transactions.md +6 -7
  12. package/adr/009-history-model.md +6 -7
  13. package/adr/README.md +46 -46
  14. package/adr/template.md +48 -49
  15. package/bin/cli.js +68 -0
  16. package/global.cjs +1462 -323
  17. package/global.js +1459 -324
  18. package/index.cjs +1462 -323
  19. package/index.d.ts +1 -0
  20. package/index.js +1459 -324
  21. package/llms.txt +42 -5
  22. package/markdown/AUDIT-REPORT.md +7 -8
  23. package/markdown/CACHE.md +190 -99
  24. package/markdown/DEVTOOLS.md +0 -1
  25. package/markdown/DISPATCH.md +0 -1
  26. package/markdown/HISTORY.md +0 -1
  27. package/markdown/IDB.md +0 -1
  28. package/markdown/IMPORT.md +0 -1
  29. package/markdown/INSPECT.md +0 -1
  30. package/markdown/LOGGER.md +0 -1
  31. package/markdown/MEMORY-ATTACHMENT.md +0 -1
  32. package/markdown/MEMORY.md +0 -1
  33. package/markdown/OBSERVER.md +0 -1
  34. package/markdown/PLATFORM.md +277 -271
  35. package/markdown/REDUX.md +54 -0
  36. package/markdown/SCHEMA.md +0 -1
  37. package/markdown/SESSION.md +0 -1
  38. package/markdown/SQLITE.md +0 -1
  39. package/markdown/STATE.md +0 -1
  40. package/markdown/STORE.md +0 -1
  41. package/markdown/SYNC.md +0 -1
  42. package/markdown/TYPED.md +0 -1
  43. package/markdown/USEOBSERVER.md +0 -1
  44. package/modules/redux.cjs +381 -10
  45. package/modules/redux.cjs.map +1 -1
  46. package/modules/redux.js +381 -10
  47. package/modules/redux.js.map +1 -1
  48. package/package.json +14 -2
  49. package/types/broadcast.d.ts +61 -0
  50. package/types/computed.d.ts +96 -0
  51. package/types/encryption.d.ts +129 -0
  52. package/types/exports.d.ts +9 -0
  53. package/types/memorio.d.ts +19 -12
  54. package/types/security.d.ts +67 -0
  55. package/types/session.d.ts +23 -5
  56. package/types/store.d.ts +19 -3
  57. package/vsix/memorio.vsix +0 -0
  58. package/markdown/CHANGELOG.md +0 -243
  59. package/markdown/PROJECT.md +0 -311
  60. package/markdown/SECURITY.md +0 -330
@@ -1,271 +1,277 @@
1
- # Platform & Context Isolation - Memorio
2
-
3
- > ℹ️ **New in v2.7.0, expanded in v3.0.2**: Context isolation system for multi-tenant server-side applications
4
-
5
- Memorio automatically detects the runtime environment and adapts its behavior accordingly. This document explains platform compatibility, session isolation, and the new context system.
6
-
7
- ---
8
-
9
- ## Quick Reference: Client vs Server
10
-
11
- ### Which Module to Use?
12
-
13
- | Scenario | Recommended Module | Persistence |
14
- |----------|-------------------|-------------|
15
- | UI State (React/components) | `state` | Memory |
16
- | Temporary computed data | `cache` | Memory |
17
- | User preferences | `store` | Browser localStorage |
18
- | Auth tokens | `session` | Browser sessionStorage |
19
- | Large offline data | `idb` | IndexedDB |
20
- | Server request isolation | `memorio.createContext()` | Memory |
21
-
22
- ### Module Availability
23
-
24
- | Module | Browser | Node.js | Deno | Edge |
25
- |--------|--------|---------|------|------|
26
- | `state` | ✅ | ✅ | ✅ | ✅ |
27
- | `cache` | ✅ | ✅ | ✅ | ✅ |
28
- | `store` | ✅ (localStorage) | ⚠️ (memory) | ⚠️ (memory) | ✅ |
29
- | `session` | ✅ (sessionStorage) | ⚠️ (memory) | ⚠️ (memory) | ✅ |
30
- | `idb` | ✅ | ❌ | ❌ | ⚠️ |
31
- | `useObserver` | ✅ | ⚠️ | ⚠️ | ✅ |
32
- | `devtools` | ✅ | ❌ | ❌ | ❌ |
33
-
34
- ---
35
-
36
- ## Platform Detection
37
-
38
- Memorio automatically detects the environment on import:
39
-
40
- ```javascript
41
- import { memorio, store } from 'memorio';
42
-
43
- // Check current platform
44
- console.debug(memorio.getCapabilities().platform); // 'browser' | 'node' | 'deno' | 'edge'
45
- console.debug(store.isPersistent); // true if using real localStorage
46
- ```
47
-
48
- ### Available Platform APIs
49
-
50
- ```javascript
51
- // Check platform
52
- memorio.isBrowser() // true in browser
53
- memorio.isNode() // true in Node.js
54
- memorio.isDeno() // true in Deno
55
- memorio.isEdge() // true in Edge Workers
56
-
57
- // Get capabilities
58
- const caps = memorio.getCapabilities();
59
- // caps.platform, caps.hasSessionStorage, caps.hasLocalStorage, etc.
60
- ```
61
-
62
- ---
63
-
64
- ## Platform Compatibility Matrix
65
-
66
- | Feature | Browser | Node.js | Deno | Edge Workers |
67
- |---------|---------|---------|------|--------------|
68
- | `state` | ✅ | ✅ | ✅ | ✅ |
69
- | `observer` | ✅ | ✅ | ✅ | ✅ |
70
- | `useObserver` | ✅ | ⚠️ React only | ⚠️ React only | ✅ |
71
- | `cache` | ✅ | ✅ | ✅ | ✅ |
72
- | `store` | ✅ (localStorage) | ⚠️ (memory) | ⚠️ (memory) | ✅ (localStorage) |
73
- | `session` | ✅ (sessionStorage) | ⚠️ (memory) | ⚠️ (memory) | ✅ (sessionStorage) |
74
- | `idb` | ✅ | ❌ | ❌ | ⚠️ |
75
-
76
- - ✅ Full support
77
- - ⚠️ Partial support (fallback to in-memory)
78
- - ❌ Not available
79
-
80
- ---
81
-
82
- ## Client vs Server Usage
83
-
84
- ### 🖥️ Client-Side (Browser)
85
-
86
- All features work with real browser storage:
87
-
88
- ```javascript
89
- import { store, session, idb } from 'memorio'
90
-
91
- // Store - persistent localStorage
92
- store.set('preferences', { theme: 'dark' });
93
- store.isPersistent; // true
94
-
95
- // Session - temporary sessionStorage
96
- session.set('token', 'jwt-token');
97
- session.isPersistent; // true (survives refresh)
98
-
99
- // IDB - large data storage
100
- idb.db.create('myApp');
101
- ```
102
-
103
- ### 🖥️ Server-Side (Node.js/Deno)
104
-
105
- Use `state` and `cache` for in-memory data. Store/session fall back to memory:
106
-
107
- ```javascript
108
- import { state, store, session, cache } from 'memorio'
109
-
110
- // State - in-memory global state
111
- state.user = { name: 'Server User' };
112
-
113
- // Cache - in-memory temporary cache
114
- cache.set('apiResponse', data);
115
-
116
- // Store - in-memory fallback (not persistent)
117
- store.set('temp', data);
118
- store.isPersistent; // false - data lost on restart
119
-
120
- // Session - in-memory fallback
121
- session.set('requestData', data);
122
- session.isPersistent; // false - data lost on restart
123
- ```
124
-
125
- ---
126
-
127
- ## Session Isolation
128
-
129
- Each instance/session gets unique storage keys to prevent conflicts:
130
-
131
- ```javascript
132
- // Without context: "memorio_store_[sessionId]_key"
133
- // With context: "[contextName]-key"
134
- ```
135
-
136
- This ensures:
137
- - Multiple browser tabs don't share session data
138
- - Server-side requests are isolated
139
-
140
- ---
141
-
142
- ## Context Isolation (Server-Side Multi-Tenancy)
143
-
144
- > ⚠️ **Server-Side Only**: This feature is designed for multi-tenant server environments (Node.js, Deno). Not needed for client-side applications.
145
-
146
- For server-side applications handling multiple tenants (e.g., different users/requests), use **contexts** to isolate data:
147
-
148
- ### Creating a Context
149
-
150
- ```javascript
151
- import { memorio, state } from 'memorio'
152
-
153
- // Create isolated context for a user/session
154
- const ctx = memorio.isolate('user-123');
155
-
156
- // Keys in store/session are prefixed with context name
157
- // store: "user-123-key"
158
- // session: "user-123-key"
159
-
160
- // Use context's isolated storage
161
- ctx.state.user = { name: 'Isolated User' };
162
- ctx.store.set('settings', { theme: 'dark' });
163
- ctx.session.set('token', 'abc123');
164
- ctx.cache.set('temp', data);
165
-
166
- // Context is completely isolated from global state
167
- console.debug(state.user); // undefined - global state is separate
168
- ```
169
-
170
- ### Managing Contexts
171
-
172
- ```javascript
173
- // List all contexts
174
- const contexts = memorio.listContexts();
175
- console.debug(contexts); // ['user-123', 'user-456', ...]
176
-
177
- // Delete a context (cleanup)
178
- memorio.deleteContext('user-123');
179
- ```
180
-
181
- > **Note**: `memorio.isolate('name')` is a shorthand alias for creating isolated contexts.
182
-
183
- ### Context Use Cases
184
-
185
- #### 1. Per-Request Isolation (Express/Fastify)
186
-
187
- ```javascript
188
- // Middleware to isolate each request
189
- app.use((req, res, next) => {
190
- const ctx = memorio.createContext(`req-${req.id}`);
191
- req.memorioContext = ctx;
192
- next();
193
- });
194
-
195
- // In route handler
196
- app.get('/user', (req, res) => {
197
- const ctx = req.memorioContext;
198
- ctx.state.user = getUserData();
199
- // Each request has isolated state
200
- });
201
- ```
202
-
203
- #### 2. Multi-Tenant SaaS
204
-
205
- ```javascript
206
- // Each tenant gets isolated storage
207
- function handleTenant(tenantId) {
208
- const ctx = memorio.createContext(tenantId);
209
-
210
- ctx.state.config = getTenantConfig(tenantId);
211
- ctx.store.set('data', tenantData);
212
-
213
- return ctx;
214
- }
215
- ```
216
-
217
- ---
218
-
219
- ## Best Practices
220
-
221
- ### Client-Side (Browser)
222
-
223
- 1. Use `store` for persistent data (preferences, user settings)
224
- 2. Use `session` for temporary data (auth tokens)
225
- 3. Use `cache` for computed values
226
- 4. Use `state` for reactive UI state
227
-
228
- ### Server-Side (Node.js/Deno)
229
-
230
- 1. Use `memorio.createContext()` for each request/tenant
231
- 2. Don't use global `state`/`store`/`session` across requests
232
- 3. Use `cache` for request-scoped caching
233
- 4. Check `store.isPersistent` / `session.isPersistent` if persistence matters
234
-
235
- ### Edge Workers
236
-
237
- Same as browser - localStorage and sessionStorage are available.
238
-
239
- ---
240
-
241
- ## API Reference
242
-
243
- ### Global Functions
244
-
245
- | Function | Returns | Description |
246
- |----------|---------|-------------|
247
- | `memorio.isBrowser()` | `boolean` | Check if running in browser |
248
- | `memorio.isNode()` | `boolean` | Check if running in Node.js |
249
- | `memorio.isDeno()` | `boolean` | Check if running in Deno |
250
- | `memorio.isEdge()` | `boolean` | Check if running in Edge |
251
- | `memorio.getCapabilities()` | `object` | Get platform capabilities |
252
-
253
- ### Context Management
254
-
255
- | Function | Returns | Description |
256
- |----------|---------|-------------|
257
- | `memorio.isolate(name?)` | `Context` | Create isolated context |
258
- | `memorio.listContexts()` | `string[]` | List all context IDs |
259
- | `memorio.deleteContext(id)` | `boolean` | Delete a context |
260
-
261
- ### Properties
262
-
263
- | Property | Type | Description |
264
- |----------|------|-------------|
265
- | `memorio.version` | `string` | Memorio version |
266
- | `memorio.getCapabilities().platform` | `string` | Current platform |
267
- | `memorio.isBrowser()` / `isNode()` / `isDeno()` / `isEdge()` | `boolean` | Platform checks |
268
- | `memorio._sessionId` | `string` | Unique session identifier |
269
-
270
- > **Classic `import`**: context APIs are also named exports.
271
- > `import { createContext, listContexts, deleteContext, isolate } from 'memorio'`.
1
+ # Platform & Context Isolation - Memorio
2
+
3
+ > ℹ️ **New in v2.7.0, expanded in v3.0.2**: Context isolation system for multi-tenant server-side applications
4
+
5
+ Memorio automatically detects the runtime environment and adapts its behavior accordingly. This document explains platform compatibility, session isolation, and the new context system.
6
+
7
+ ---
8
+
9
+ ## Quick Reference: Client vs Server
10
+
11
+ ### Which Module to Use?
12
+
13
+ | Scenario | Recommended Module | Persistence |
14
+ |----------|-------------------|-------------|
15
+ | UI State (React/components) | `state` | Memory |
16
+ | Temporary computed data | `cache` | Memory |
17
+ | User preferences | `store` | Browser localStorage |
18
+ | Auth tokens | `session` | Browser sessionStorage |
19
+ | Large offline data | `idb` | IndexedDB |
20
+ | Server request isolation | `memorio.createContext()` | Memory |
21
+
22
+ ### Module Availability
23
+
24
+ | Module | Browser | Node.js | Bun | Deno | Edge |
25
+ |--------|--------|---------|-----|------|------|
26
+ | `state` | ✅ | ✅ | ✅ | ✅ | ✅ |
27
+ | `cache` | ✅ | ✅ | ✅ | ✅ | ✅ |
28
+ | `store` | ✅ (localStorage) | ⚠️ (memory) | ✅* | ⚠️ (memory) | ✅ |
29
+ | `session` | ✅ (sessionStorage) | ⚠️ (memory) | ⚠️ (memory) | ⚠️ (memory) | ✅ |
30
+ | `idb` | ✅ | ❌ | ❌ | ❌ | ⚠️ |
31
+ | `sqlite` | ✅ (sql.js) | ❌ | ✅ (native `bun:sqlite`) | ❌ | ⚠️ |
32
+ | `useObserver` | ✅ | ⚠️ | ⚠️ | ⚠️ | ✅ |
33
+ | `devtools` | ✅ | ❌ | ❌ | ❌ | ❌ |
34
+
35
+ *Bun: `store` uses `localStorage` when available (Bun 1.x+), falls back to memory otherwise.
36
+
37
+ > ⚠️ **Bun row added from project notes, not verified against source for this document.** Confirm against `core/platform.ts` before publishing.
38
+
39
+ ---
40
+
41
+ ## Platform Detection
42
+
43
+ Memorio automatically detects the environment on import:
44
+
45
+ ```javascript
46
+ import { memorio, store } from 'memorio';
47
+
48
+ // Check current platform
49
+ console.debug(memorio.getCapabilities().platform); // 'browser' | 'node' | 'bun' | 'deno' | 'edge'
50
+ console.debug(store.isPersistent); // true if using real localStorage
51
+ ```
52
+
53
+ ### Available Platform APIs
54
+
55
+ ```javascript
56
+ // Check platform
57
+ memorio.isBrowser() // true in browser
58
+ memorio.isNode() // true in Node.js
59
+ memorio.isBun() // true in Bun
60
+ memorio.isDeno() // true in Deno
61
+ memorio.isEdge() // true in Edge Workers
62
+
63
+ // Get capabilities
64
+ const caps = memorio.getCapabilities();
65
+ // caps.platform, caps.hasSessionStorage, caps.hasLocalStorage, caps.hasBunSqlite, etc.
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Platform Compatibility Matrix
71
+
72
+ | Feature | Browser | Node.js | Deno | Edge Workers |
73
+ |---------|---------|---------|------|--------------|
74
+ | `state` | ✅ | ✅ | ✅ | ✅ |
75
+ | `observer` | ✅ | ✅ | ✅ | ✅ |
76
+ | `useObserver` | ✅ | ⚠️ React only | ⚠️ React only | ✅ |
77
+ | `cache` | ✅ | ✅ | ✅ | ✅ |
78
+ | `store` | ✅ (localStorage) | ⚠️ (memory) | ⚠️ (memory) | ✅ (localStorage) |
79
+ | `session` | ✅ (sessionStorage) | ⚠️ (memory) | ⚠️ (memory) | ✅ (sessionStorage) |
80
+ | `idb` | ✅ | ❌ | ❌ | ⚠️ |
81
+
82
+ - ✅ Full support
83
+ - ⚠️ Partial support (fallback to in-memory)
84
+ - ❌ Not available
85
+
86
+ ---
87
+
88
+ ## Client vs Server Usage
89
+
90
+ ### 🖥️ Client-Side (Browser)
91
+
92
+ All features work with real browser storage:
93
+
94
+ ```javascript
95
+ import { store, session, idb } from 'memorio'
96
+
97
+ // Store - persistent localStorage
98
+ store.set('preferences', { theme: 'dark' });
99
+ store.isPersistent; // true
100
+
101
+ // Session - temporary sessionStorage
102
+ session.set('token', 'jwt-token');
103
+ session.isPersistent; // true (survives refresh)
104
+
105
+ // IDB - large data storage
106
+ idb.db.create('myApp');
107
+ ```
108
+
109
+ ### 🖥️ Server-Side (Node.js/Deno)
110
+
111
+ Use `state` and `cache` for in-memory data. Store/session fall back to memory:
112
+
113
+ ```javascript
114
+ import { state, store, session, cache } from 'memorio'
115
+
116
+ // State - in-memory global state
117
+ state.user = { name: 'Server User' };
118
+
119
+ // Cache - in-memory temporary cache
120
+ cache.set('apiResponse', data);
121
+
122
+ // Store - in-memory fallback (not persistent)
123
+ store.set('temp', data);
124
+ store.isPersistent; // false - data lost on restart
125
+
126
+ // Session - in-memory fallback
127
+ session.set('requestData', data);
128
+ session.isPersistent; // false - data lost on restart
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Session Isolation
134
+
135
+ Each instance/session gets unique storage keys to prevent conflicts:
136
+
137
+ ```javascript
138
+ // Without context: "memorio_store_[sessionId]_key"
139
+ // With context: "[contextName]-key"
140
+ ```
141
+
142
+ This ensures:
143
+ - Multiple browser tabs don't share session data
144
+ - Server-side requests are isolated
145
+
146
+ ---
147
+
148
+ ## Context Isolation (Server-Side Multi-Tenancy)
149
+
150
+ > ⚠️ **Server-Side Only**: This feature is designed for multi-tenant server environments (Node.js, Deno). Not needed for client-side applications.
151
+
152
+ For server-side applications handling multiple tenants (e.g., different users/requests), use **contexts** to isolate data:
153
+
154
+ ### Creating a Context
155
+
156
+ ```javascript
157
+ import { memorio, state } from 'memorio'
158
+
159
+ // Create isolated context for a user/session
160
+ const ctx = memorio.isolate('user-123');
161
+
162
+ // Keys in store/session are prefixed with context name
163
+ // store: "user-123-key"
164
+ // session: "user-123-key"
165
+
166
+ // Use context's isolated storage
167
+ ctx.state.user = { name: 'Isolated User' };
168
+ ctx.store.set('settings', { theme: 'dark' });
169
+ ctx.session.set('token', 'abc123');
170
+ ctx.cache.set('temp', data);
171
+
172
+ // Context is completely isolated from global state
173
+ console.debug(state.user); // undefined - global state is separate
174
+ ```
175
+
176
+ ### Managing Contexts
177
+
178
+ ```javascript
179
+ // List all contexts
180
+ const contexts = memorio.listContexts();
181
+ console.debug(contexts); // ['user-123', 'user-456', ...]
182
+
183
+ // Delete a context (cleanup)
184
+ memorio.deleteContext('user-123');
185
+ ```
186
+
187
+ > **Note**: `memorio.isolate('name')` is a shorthand alias for creating isolated contexts.
188
+
189
+ ### Context Use Cases
190
+
191
+ #### 1. Per-Request Isolation (Express/Fastify)
192
+
193
+ ```javascript
194
+ // Middleware to isolate each request
195
+ app.use((req, res, next) => {
196
+ const ctx = memorio.createContext(`req-${req.id}`);
197
+ req.memorioContext = ctx;
198
+ next();
199
+ });
200
+
201
+ // In route handler
202
+ app.get('/user', (req, res) => {
203
+ const ctx = req.memorioContext;
204
+ ctx.state.user = getUserData();
205
+ // Each request has isolated state
206
+ });
207
+ ```
208
+
209
+ #### 2. Multi-Tenant SaaS
210
+
211
+ ```javascript
212
+ // Each tenant gets isolated storage
213
+ function handleTenant(tenantId) {
214
+ const ctx = memorio.createContext(tenantId);
215
+
216
+ ctx.state.config = getTenantConfig(tenantId);
217
+ ctx.store.set('data', tenantData);
218
+
219
+ return ctx;
220
+ }
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Best Practices
226
+
227
+ ### Client-Side (Browser)
228
+
229
+ 1. Use `store` for persistent data (preferences, user settings)
230
+ 2. Use `session` for temporary data (auth tokens)
231
+ 3. Use `cache` for computed values
232
+ 4. Use `state` for reactive UI state
233
+
234
+ ### Server-Side (Node.js/Deno)
235
+
236
+ 1. Use `memorio.createContext()` for each request/tenant
237
+ 2. Don't use global `state`/`store`/`session` across requests
238
+ 3. Use `cache` for request-scoped caching
239
+ 4. Check `store.isPersistent` / `session.isPersistent` if persistence matters
240
+
241
+ ### Edge Workers
242
+
243
+ Same as browser - localStorage and sessionStorage are available.
244
+
245
+ ---
246
+
247
+ ## API Reference
248
+
249
+ ### Global Functions
250
+
251
+ | Function | Returns | Description |
252
+ |----------|---------|-------------|
253
+ | `memorio.isBrowser()` | `boolean` | Check if running in browser |
254
+ | `memorio.isNode()` | `boolean` | Check if running in Node.js |
255
+ | `memorio.isDeno()` | `boolean` | Check if running in Deno |
256
+ | `memorio.isEdge()` | `boolean` | Check if running in Edge |
257
+ | `memorio.getCapabilities()` | `object` | Get platform capabilities |
258
+
259
+ ### Context Management
260
+
261
+ | Function | Returns | Description |
262
+ |----------|---------|-------------|
263
+ | `memorio.isolate(name?)` | `Context` | Create isolated context |
264
+ | `memorio.listContexts()` | `string[]` | List all context IDs |
265
+ | `memorio.deleteContext(id)` | `boolean` | Delete a context |
266
+
267
+ ### Properties
268
+
269
+ | Property | Type | Description |
270
+ |----------|------|-------------|
271
+ | `memorio.version` | `string` | Memorio version |
272
+ | `memorio.getCapabilities().platform` | `string` | Current platform |
273
+ | `memorio.isBrowser()` / `isNode()` / `isDeno()` / `isEdge()` | `boolean` | Platform checks |
274
+ | `memorio._sessionId` | `string` | Unique session identifier |
275
+
276
+ > **Classic `import`**: context APIs are also named exports.
277
+ > `import { createContext, listContexts, deleteContext, isolate } from 'memorio'`.
@@ -0,0 +1,54 @@
1
+ > **Status:** Published
2
+ > **Date:** 2026-09-12
3
+ > **Scope**: API Reference
4
+ > **Standard**: Memorio API Specification v5
5
+ >
6
+ ---
7
+ # Redux and other state managers - Memorio
8
+
9
+ > Skip this unless you already use Redux.
10
+
11
+ > **Your state manager owns application state. Memorio owns memory.**
12
+
13
+ ```ts
14
+ import { createMemorioReduxBridge } from 'memorio/redux'
15
+
16
+ const memorioRedux = createMemorioReduxBridge<AppState>({
17
+ mappings: {
18
+ 'user.preferences': {
19
+ selector: state => state.user.preferences,
20
+ type: 'preference',
21
+ scope: 'local',
22
+ tags: ['app', 'user']
23
+ },
24
+ 'user.name': state => state.user.name
25
+ },
26
+ whitelist: ['user/preferencesChanged', 'user/nameChanged'],
27
+ debug: true
28
+ })
29
+
30
+ const store = createStore(reducer, applyMiddleware(memorioRedux.middleware))
31
+
32
+ await memorioRedux.hydrate(store, {
33
+ onHydration(values) { store.dispatch(restorePreferences(values)) }
34
+ })
35
+ ```
36
+
37
+ ```text
38
+ Redux ─────────────→ memorio memorio ───────────→ Redux
39
+ application state durable memory bootstrap hydration (one-shot)
40
+ ```
41
+
42
+ The bridge persists only mapped selectors, never mirrors the full tree, coalesces bursts, and never breaks Redux dispatch if Memorio fails.
43
+
44
+ | | Redux | Memorio |
45
+ |---|---|---|
46
+ | Core model | single store | independent runtime layers |
47
+ | State changes | actions + reducers | direct reactive mutation |
48
+ | Persistence | external integration | built in |
49
+ | Structured memory | - | native |
50
+ | Offline memory sync | - | supported |
51
+ | Time-travel debugging | mature | State Intelligence (in progress) |
52
+ | Production dependencies | ecosystem-dependent | zero in core |
53
+
54
+ Use Redux when you need its action-pipeline discipline and ecosystem. Use Memorio when you want state, persistence, and structured memory under one runtime. You can use both.
@@ -1,6 +1,5 @@
1
1
  > **Status:** Published
2
2
  > **Date:** 2026-09-12
3
- > **Deciders:** Memorio 5.x Core Team
4
3
  > **Scope**: API Reference
5
4
  > **Standard**: Memorio API Specification v5
6
5
  >
@@ -1,6 +1,5 @@
1
1
  > **Status:** Published
2
2
  > **Date:** 2026-09-12
3
- > **Deciders:** Memorio 5.x Core Team
4
3
  > **Scope**: API Reference
5
4
  > **Standard**: Memorio API Specification v5
6
5
  >
@@ -1,6 +1,5 @@
1
1
  > **Status:** Published
2
2
  > **Date:** 2026-09-12
3
- > **Deciders:** Memorio 5.x Core Team
4
3
  > **Scope**: API Reference
5
4
  > **Standard**: Memorio API Specification v5
6
5
  >
package/markdown/STATE.md CHANGED
@@ -1,6 +1,5 @@
1
1
  > **Status:** Published
2
2
  > **Date:** 2026-09-12
3
- > **Deciders:** Memorio 5.x Core Team
4
3
  > **Scope**: API Reference
5
4
  > **Standard**: Memorio API Specification v5
6
5
  >
package/markdown/STORE.md CHANGED
@@ -1,6 +1,5 @@
1
1
  > **Status:** Published
2
2
  > **Date:** 2026-09-12
3
- > **Deciders:** Memorio 5.x Core Team
4
3
  > **Scope**: API Reference
5
4
  > **Standard**: Memorio API Specification v5
6
5
  >
package/markdown/SYNC.md CHANGED
@@ -1,6 +1,5 @@
1
1
  > **Status:** Published
2
2
  > **Date:** 2026-09-12
3
- > **Deciders:** Memorio 5.x Core Team
4
3
  > **Scope**: API Reference
5
4
  > **Standard**: Memorio API Specification v5
6
5
  >