memorio 3.0.1 → 3.0.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 +59 -48
- package/docs/README.md +59 -48
- package/docs/markdown/CACHE.md +3 -3
- package/docs/markdown/CHANGELOG.md +63 -154
- package/docs/markdown/DEVTOOLS.md +1 -1
- package/docs/markdown/IDB.md +3 -3
- package/docs/markdown/LOGGER.md +2 -2
- package/docs/markdown/OBSERVER.md +4 -4
- package/docs/markdown/PLATFORM.md +5 -5
- package/docs/markdown/SECURITY.md +16 -4
- package/docs/markdown/SESSION.md +4 -4
- package/docs/markdown/STATE.md +7 -7
- package/docs/markdown/STORE.md +7 -7
- package/docs/markdown/USEOBSERVER.md +1 -1
- package/examples/react-app.tsx +6 -1
- package/index.cjs +106 -98
- package/index.js +106 -96
- package/package.json +1 -1
- package/types/memorio.d.ts +6 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Platform & Context Isolation - Memorio
|
|
2
2
|
|
|
3
|
-
> ℹ️ **New in v2.7.0**: Context isolation system for multi-tenant server-side applications
|
|
3
|
+
> ℹ️ **New in v2.7.0, expanded in v3.0.2**: Context isolation system for multi-tenant server-side applications
|
|
4
4
|
|
|
5
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
6
|
|
|
@@ -41,8 +41,8 @@ Memorio automatically detects the environment on import:
|
|
|
41
41
|
import 'memorio';
|
|
42
42
|
|
|
43
43
|
// Check current platform
|
|
44
|
-
console.
|
|
45
|
-
console.
|
|
44
|
+
console.debug(memorio.platform); // 'browser' | 'node' | 'deno' | 'edge'
|
|
45
|
+
console.debug(memorio.isPersistent); // true if using real storage
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
### Available Platform APIs
|
|
@@ -155,7 +155,7 @@ ctx.session.set('token', 'abc123');
|
|
|
155
155
|
ctx.cache.set('temp', data);
|
|
156
156
|
|
|
157
157
|
// Context is completely isolated from global state
|
|
158
|
-
console.
|
|
158
|
+
console.debug(state.user); // undefined - global state is separate
|
|
159
159
|
```
|
|
160
160
|
|
|
161
161
|
### Managing Contexts
|
|
@@ -163,7 +163,7 @@ console.log(state.user); // undefined - global state is separate
|
|
|
163
163
|
```javascript
|
|
164
164
|
// List all contexts
|
|
165
165
|
const contexts = memorio.listContexts();
|
|
166
|
-
console.
|
|
166
|
+
console.debug(contexts); // ['user-123', 'user-456', ...]
|
|
167
167
|
|
|
168
168
|
// Delete a context (cleanup)
|
|
169
169
|
memorio.deleteContext('user-123');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Memorio Security Documentation
|
|
2
2
|
|
|
3
|
-
> Last Updated:
|
|
3
|
+
> Last Updated: v3.0.2
|
|
4
4
|
|
|
5
5
|
This document describes the security measures implemented in Memorio to protect against common vulnerabilities and ensure safe operation across different platforms.
|
|
6
6
|
|
|
@@ -293,9 +293,21 @@ If you discover a security vulnerability in Memorio:
|
|
|
293
293
|
|
|
294
294
|
## Security Changelog
|
|
295
295
|
|
|
296
|
-
###
|
|
296
|
+
### v3.0.2 (Current)
|
|
297
297
|
|
|
298
|
-
- ✅
|
|
298
|
+
- ✅ Removed esbuild-sass-plugin / esbuild-scss-modules-plugin (SCSS attack vector eliminated)
|
|
299
|
+
- ✅ `store.set()` now blocks function values instead of silently continuing
|
|
300
|
+
- ✅ All `PRIVATE License` headers in `functions/idb/` replaced with `MIT`
|
|
301
|
+
- ✅ `buildPathTracker` dead code removed from state
|
|
302
|
+
- ✅ `Object.freeze(observer)` call removed (undeclared variable, caused `ReferenceError`)
|
|
303
|
+
- ✅ `confirm()` removed from `idb.db.delete()` (no blocking UI calls in libraries)
|
|
304
|
+
- ✅ Fully generated changelog for v3.0.2 across all github docs
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
### v2.7.0 — Previous
|
|
309
|
+
|
|
310
|
+
- ✅ Added `crypto.getRandomValues()` fallback
|
|
299
311
|
- ✅ Added key length validation (512 chars)
|
|
300
312
|
- ✅ Added character whitelist validation
|
|
301
313
|
- ✅ Improved session isolation
|
|
@@ -303,4 +315,4 @@ If you discover a security vulnerability in Memorio:
|
|
|
303
315
|
|
|
304
316
|
---
|
|
305
317
|
|
|
306
|
-
*This document was last updated for Memorio
|
|
318
|
+
*This document was last updated for Memorio v3.0.2*
|
package/docs/markdown/SESSION.md
CHANGED
|
@@ -27,10 +27,10 @@ session.set('token', 'abc123');
|
|
|
27
27
|
session.set('userId', 42);
|
|
28
28
|
|
|
29
29
|
// Read session data
|
|
30
|
-
console.
|
|
30
|
+
console.debug(session.get('token')); // "abc123"
|
|
31
31
|
|
|
32
32
|
// Check persistence
|
|
33
|
-
console.
|
|
33
|
+
console.debug(session.isPersistent); // true in browser, false in Node.js/Deno
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
### Example 2: Intermediate
|
|
@@ -56,11 +56,11 @@ if (session.get('authToken')) {
|
|
|
56
56
|
|
|
57
57
|
// Get storage quota (returns Promise<[usage, quota]> in KB)
|
|
58
58
|
const [used, total] = await session.quota();
|
|
59
|
-
console.
|
|
59
|
+
console.debug(`Using ${used} out of ${total} KB`);
|
|
60
60
|
|
|
61
61
|
// Get total size in characters
|
|
62
62
|
const size = session.size();
|
|
63
|
-
console.
|
|
63
|
+
console.debug(`${size} bytes`);
|
|
64
64
|
|
|
65
65
|
// Handle session expiry
|
|
66
66
|
window.addEventListener('storage', (e) => {
|
package/docs/markdown/STATE.md
CHANGED
|
@@ -28,7 +28,7 @@ state.name = 'Mario';
|
|
|
28
28
|
state.age = 25;
|
|
29
29
|
|
|
30
30
|
// Get a value
|
|
31
|
-
console.
|
|
31
|
+
console.debug(state.name); // "Mario"
|
|
32
32
|
|
|
33
33
|
// Simple object
|
|
34
34
|
state.user = { name: 'Luigi', level: 1 };
|
|
@@ -40,14 +40,14 @@ state.user = { name: 'Luigi', level: 1 };
|
|
|
40
40
|
// Array operations
|
|
41
41
|
state.items = [1, 2, 3];
|
|
42
42
|
state.items.push(4);
|
|
43
|
-
console.
|
|
43
|
+
console.debug(state.items); // [1, 2, 3, 4]
|
|
44
44
|
|
|
45
45
|
// Nested objects
|
|
46
46
|
state.config = { theme: 'dark', lang: 'en' };
|
|
47
47
|
state.config.theme = 'light';
|
|
48
48
|
|
|
49
49
|
// List all states
|
|
50
|
-
console.
|
|
50
|
+
console.debug(state.list);
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
### Example 3: Advanced
|
|
@@ -60,14 +60,14 @@ state.frozenConfig.lock();
|
|
|
60
60
|
|
|
61
61
|
// Path tracking
|
|
62
62
|
const path = state.user.path;
|
|
63
|
-
console.
|
|
64
|
-
console.
|
|
63
|
+
console.debug(path.name); // "user"
|
|
64
|
+
console.debug(path.profile.name); // "user.profile"
|
|
65
65
|
|
|
66
66
|
// Get full path as string
|
|
67
|
-
console.
|
|
67
|
+
console.debug(state.user.__path); // "state.user"
|
|
68
68
|
|
|
69
69
|
// Protected keys (internal use)
|
|
70
|
-
console.
|
|
70
|
+
console.debug(protect); // Array of protected keys
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
---
|
package/docs/markdown/STORE.md
CHANGED
|
@@ -27,11 +27,11 @@ store.set('username', 'Mario');
|
|
|
27
27
|
store.set('score', 1500);
|
|
28
28
|
|
|
29
29
|
// Read data
|
|
30
|
-
console.
|
|
31
|
-
console.
|
|
30
|
+
console.debug(store.get('username')); // "Mario"
|
|
31
|
+
console.debug(store.get('score')); // 1500
|
|
32
32
|
|
|
33
33
|
// Check if using real persistence
|
|
34
|
-
console.
|
|
34
|
+
console.debug(store.isPersistent); // true in browser, false in Node.js/Deno
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### Example 2: Intermediate
|
|
@@ -40,14 +40,14 @@ console.log(store.isPersistent); // true in browser, false in Node.js/Deno
|
|
|
40
40
|
// Store objects
|
|
41
41
|
store.set('user', { name: 'Luigi', level: 5 });
|
|
42
42
|
const user = store.get('user');
|
|
43
|
-
console.
|
|
43
|
+
console.debug(user.name); // "Luigi"
|
|
44
44
|
|
|
45
45
|
// Remove single item
|
|
46
46
|
store.remove('username');
|
|
47
47
|
|
|
48
48
|
// Check size
|
|
49
49
|
const totalSize = store.size();
|
|
50
|
-
console.
|
|
50
|
+
console.debug(`${totalSize} bytes`);
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
### Example 3: Advanced
|
|
@@ -55,11 +55,11 @@ console.log(`${totalSize} bytes`);
|
|
|
55
55
|
```javascript
|
|
56
56
|
// Get storage quota (returns Promise<[usage, quota]> in KB)
|
|
57
57
|
const [used, total] = await store.quota();
|
|
58
|
-
console.
|
|
58
|
+
console.debug(`Using ${used} out of ${total} KB`);
|
|
59
59
|
|
|
60
60
|
// Get total size in characters
|
|
61
61
|
const size = store.size();
|
|
62
|
-
console.
|
|
62
|
+
console.debug(`${size} bytes`);
|
|
63
63
|
|
|
64
64
|
// Clear all data
|
|
65
65
|
store.removeAll();
|
|
@@ -111,7 +111,7 @@ When `deps` is omitted, useObserver automatically discovers all state properties
|
|
|
111
111
|
// No deps needed - magic auto-discovery!
|
|
112
112
|
useObserver(() => {
|
|
113
113
|
// Automatically tracks state.user, state.items, state.counter
|
|
114
|
-
console.
|
|
114
|
+
console.debug(state.user.name, state.items.length, state.counter);
|
|
115
115
|
});
|
|
116
116
|
```
|
|
117
117
|
|
package/examples/react-app.tsx
CHANGED
|
@@ -156,6 +156,11 @@ function Cart() {
|
|
|
156
156
|
</div>
|
|
157
157
|
))}
|
|
158
158
|
<strong>Total: ${total}</strong>
|
|
159
|
+
<div style={{ marginTop: '1rem' }}>
|
|
160
|
+
<AddToCartButton
|
|
161
|
+
product={{ id: 1, name: 'Sample Product', price: 9.99 }}
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
159
164
|
</div>
|
|
160
165
|
)
|
|
161
166
|
}
|
|
@@ -217,7 +222,7 @@ function Notifications() {
|
|
|
217
222
|
// Settings Component
|
|
218
223
|
// ------------------------------
|
|
219
224
|
function Settings() {
|
|
220
|
-
const [theme
|
|
225
|
+
const [theme] = useState(state.theme)
|
|
221
226
|
const [savedSettings, setSavedSettings] = useState<any>(null)
|
|
222
227
|
|
|
223
228
|
// Load saved settings from store
|