memorio 3.0.0 → 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.
@@ -4,181 +4,90 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ---
6
6
 
7
- ## v2.7.0 (Current) - Cross-Platform & Security Update
8
-
9
- ### 🚀 New Features
10
-
11
- #### 1. Platform Compatibility Layer
12
- - **Auto-detection**: Automatically detects Browser, Node.js, Deno, Edge Workers
13
- - **Polyfills**: Automatic fallback for server environments
14
- - **New exports**:
15
- - `memorio.isBrowser()` - Check if running in browser
16
- - `memorio.isNode()` - Check if running in Node.js
17
- - `memorio.isDeno()` - Check if running in Deno
18
- - `memorio.isEdge()` - Check if running in Edge Worker
19
- - `memorio.getCapabilities()` - Get platform capabilities
20
-
21
- #### 2. Session Isolation
22
- - **Unique Session IDs**: Each import/session gets unique ID via `crypto.randomUUID()`
23
- - **Namespaced Storage**: Keys prefixed with session ID to prevent cross-contamination
24
- - **Format**: `memorio_store_[session-uuid]_keyname`
25
-
26
- #### 3. Context Isolation (Multi-Tenant Support)
27
- - **New API**:
28
- - `memorio.createContext(name?)` - Create isolated context
29
- - `memorio.listContexts()` - List all contexts
30
- - `memorio.deleteContext(id)` - Delete context
31
- - `memorio.isolate(name?)` - Alias for createContext
32
-
33
- #### 4. Persistence Detection
34
- - **New Properties**:
35
- - `store.isPersistent` - Check if using real localStorage
36
- - `session.isPersistent` - Check if using real sessionStorage
7
+ ## v3.0.2 (Current) - 2026-05-19 Bug Fix, Security & API Expansion
37
8
 
38
- ### 🔒 Security Improvements
39
-
40
- | Feature | Before v2.7.0 | After v2.7.0 |
41
- |---------|---------------|--------------|
42
- | Session ID | `Math.random()` | `crypto.randomUUID()` |
43
- | Key Validation | None | Max 512 chars + whitelist |
44
- | Server Isolation | None | Context system |
45
- | Fallback Security | Basic | `crypto.getRandomValues()` |
46
-
47
- ### 📝 Documentation Updates
48
-
49
- - **New Documents**:
50
- - [`PLATFORM.md`](PLATFORM.md) - Platform compatibility guide
51
- - [`SECURITY.md`](SECURITY.md) - Security documentation
9
+ ### 🐛 Bug Fixes
52
10
 
53
- - **Updated Documents**:
54
- - All module docs now have platform labels ( Universal, 🖥️ Browser, ⚛️ React)
55
- - Platform comparison tables added
56
- - Client vs Server usage clarified
11
+ - Removed dead code: `buildPathTracker` from `functions/state/index.ts` (unused Proxy builder, exported nowhere)
12
+ - Removed double `delete` in state `removeAll` handler (redundant null-check + delete on same key)
13
+ - Removed unbound `globalThis.state` reference in state init (would throw `ReferenceError` in strict mode)
14
+ - Removed `Object.freeze(observer)` referencing undeclared variable (`ReferenceError` on module load)
15
+ - Removed `confirm()` synchronous blocking call from `idb.db.delete` (library must not block main thread)
57
16
 
58
- ### 🔧 Examples
17
+ ### 🔒 Security Improvements
59
18
 
60
- - **New Examples**:
61
- - [`examples/platform.ts`](../examples/platform.ts) - Platform detection + Context demo
19
+ - Removed `esbuild-sass-plugin` and `esbuild-scss-modules-plugin` from `devDependencies` (unnecessary for a library with no styles)
20
+ - Removed `injectStyle: true`, `sassPlugin()` and `.css` loader from `tsup.config.ts`
21
+ - Deleted `tsup.plugin.injectCss.ts` (code injection vector completely removed from build pipeline)
22
+ - `console.error`/`console.warn` → `console.debug` in `devtools` and `idb` error handlers (consistent debug-only logging policy)
23
+ - `store.set()` now blocks function values instead of silently logging and continuing
24
+ - All `PRIVATE License` headers in `functions/idb/` replaced with `MIT License`
62
25
 
63
- - **Updated Examples**:
64
- - [`examples/basic.ts`](../examples/basic.ts) - Platform detection added
65
- - [`examples/store-advanced.ts`](../examples/store-advanced.ts) - isPersistent check
66
- - [`examples/session-advanced.ts`](../examples/session-advanced.ts) - isPersistent check
26
+ ### 🔧 Code Quality
67
27
 
68
- ### ⚠️ Breaking Changes
28
+ - Added JSDoc to `observerFunction` in `functions/observer/index.ts`
29
+ - Added JSDoc to `cache` global in `functions/cache/index.ts`
30
+ - `lint` and `tsc` pass clean — 0 vulnerabilities from `npm audit`
69
31
 
70
- | Change | Impact | Migration |
71
- |--------|--------|-----------|
72
- | Key validation | Low | Invalid keys now rejected with debug message |
73
- | Storage key format | Low | Keys now prefixed with session ID |
32
+ ### 🆕 API New in 3.0.2
74
33
 
75
- ### 🏗️ Internal Changes
34
+ | Function | Description |
35
+ |----------|-------------|
36
+ | `memorio.isBrowser()` | Returns `true` when running in a browser |
37
+ | `memorio.isNode()` | Returns `true` when running in Node.js |
38
+ | `memorio.isDeno()` | Returns `true` when running in Deno |
39
+ | `memorio.isEdge()` | Returns `true` in Cloudflare Workers, Vercel Edge, etc. |
40
+ | `memorio.getCapabilities()` | Full capabilities object (`platform`, `hasLocalStorage`, `hasIndexedDB`, …) |
41
+ | `memorio.createContext(name?)` | Create multi-tenant isolated context |
42
+ | `memorio.listContexts()` | List all active isolated contexts |
43
+ | `memorio.deleteContext(id)` | Delete isolated context by ID |
44
+ | `memorio.isolate(name?)` | Shorthand alias for `createContext` |
76
45
 
77
- - **New files**:
78
- - `config/platform.ts` - Platform detection + Context system
46
+ ### 🧪 Tests
79
47
 
80
- - **Modified files**:
81
- - `config/global.ts` - Added context exports
82
- - `functions/store/index.ts` - Added validation + isPersistent
83
- - `functions/session/index.ts` - Added validation + isPersistent
48
+ - Created `tests/jest/tests/observer.test.ts` — 12 tests (deprecation warning, input validation, `.list`, `.remove`, `.removeAll`)
49
+ - Created `tests/jest/tests/useObserver.test.ts` 12 tests (existence, edge cases, proxy/string deps, auto-discovery, cleanup)
50
+ - **Result: 8 suites · 95 passed · 3 skipped · 0 failed**
84
51
 
85
- ---
52
+ ### 🗑️ Dependency Changes
86
53
 
87
- ## v2.6.x - Previous Versions
54
+ | Removed | Reason |
55
+ |---------|--------|
56
+ | `esbuild-sass-plugin@3.7.0` | No SCSS in a library |
57
+ | `esbuild-scss-modules-plugin@1.1.1` | No SCSS in a library |
58
+ | 36 transitive packages | Removed from `node_modules` |
88
59
 
89
- *(Documentation for versions prior to v2.7.0 is not included in this changelog)*
60
+ ### 📝 Documentation Updates
90
61
 
91
- ### Typical v2.6.x Features:
92
- - State management with Proxy
93
- - Observer pattern
94
- - useObserver React hook
95
- - Store (localStorage wrapper)
96
- - Session (sessionStorage wrapper)
97
- - Cache (in-memory)
98
- - IDB (IndexedDB wrapper)
99
- - DevTools
100
- - Logger
62
+ - `docs/README.md`: replaced `console.log` with `console.debug` in usage examples; fixed `esbuild` badge → `tsup`
63
+ - `.github/CHANGELOG.md`: restructured with fix / security / changed sections
64
+ - `.github/HISTORY.md`: complete rewrite through v3.0.2
65
+ - `.github/SECURITY.md`: NIST/NSA standard + OWASP Top 10 mapping
66
+ - `.github/CITATION.cff`: license PRIVATE → MIT to match `package.json`
67
+ - `.project/*`: all context documents updated to v3.0.2
101
68
 
102
69
  ---
103
70
 
104
- ## Migration Guide: v2.6.x v2.7.0
105
-
106
- ### 1. Platform Detection (Optional)
107
-
108
- ```typescript
109
- // NEW: Check platform
110
- if (memorio.isNode()) {
111
- console.log('Running on server')
112
- }
113
- ```
71
+ ## v2.9.0 2026-05-13
114
72
 
115
- ### 2. Persistence Check (Optional)
73
+ ### Added
74
+ - DevTools — `memorio.devtools.inspect()`, `stats()`, `exportData()`
75
+ - Logger with full history, stats and export
76
+ - Platform detection (`isBrowser`, `isNode`, `isDeno`, `isEdge`, `getCapabilities`)
77
+ - Session isolation via `crypto.randomUUID()`
116
78
 
117
- ```typescript
118
- // NEW: Check if data persists
119
- if (!store.isPersistent) {
120
- console.warn('Data will be lost on restart!')
121
- }
122
- ```
79
+ ### Changed
80
+ - Updated dependencies to latest versions
81
+ - Improved cross-platform support (Deno, Edge Workers, Node.js)
123
82
 
124
- ### 3. Server-Side Isolation (Recommended for Node.js)
125
-
126
- ```typescript
127
- // NEW: Create isolated context per request
128
- app.use((req, res, next) => {
129
- req.ctx = memorio.createContext(`req-${req.id}`)
130
- next()
131
- })
132
-
133
- app.get('/data', (req, res) => {
134
- req.ctx.state.user = getUser()
135
- // Each request has isolated state
136
- })
137
- ```
138
-
139
- ### 4. Key Validation (Automatic)
140
-
141
- ```typescript
142
- // Keys are now validated - invalid keys rejected
143
- store.set('valid-key', 'value') // ✅ Works
144
- store.set('key with spaces', 'x') // ❌ Rejected (debug message)
145
- store.set('key>1000chars', 'x') // ❌ Rejected if >512 chars
146
- ```
147
-
148
- ---
149
-
150
- ## Comparison Table: v2.6.x vs v2.7.0
151
-
152
- | Feature | v2.6.x | v2.7.0 |
153
- |---------|--------|--------|
154
- | **Platform Support** | | |
155
- | Browser | ✅ | ✅ |
156
- | Node.js | ⚠️ Partial | ✅ Full |
157
- | Deno | ❌ | ✅ Full |
158
- | Edge Workers | ❌ | ✅ |
159
- | **Security** | | |
160
- | Secure Random | ❌ | ✅ |
161
- | Key Validation | ❌ | ✅ |
162
- | Session Isolation | ❌ | ✅ |
163
- | Context Isolation | ❌ | ✅ |
164
- | **API** | | |
165
- | isPersistent | ❌ | ✅ |
166
- | createContext | ❌ | ✅ |
167
- | Platform APIs | ❌ | ✅ |
168
- | **Documentation** | | |
169
- | Platform Guide | ❌ | ✅ |
170
- | Security Docs | ❌ | ✅ |
171
- | Platform Tables | ❌ | ✅ |
83
+ ### Security
84
+ - Secure random session IDs replaced `Math.random()`
85
+ - Key validation (max 512 chars + character whitelist)
172
86
 
173
87
  ---
174
88
 
175
- ## Deprecations
176
-
177
- | Feature | Status | Alternative |
178
- |---------|--------|---------|
179
- | `observer()` | ⚠️ Deprecated | Use `useObserver()` in React |
180
- | Global state in Node.js | ⚡ Discouraged | Use `memorio.createContext()` |
181
-
182
- ---
89
+ ## v2.5.0 — 2026-02-17
183
90
 
184
- *For older versions, please refer to the git history or npm package versions.*
91
+ - Initial release of memorio (state, store, session, cache, idb)
92
+ - Observer pattern (`observer`)
93
+ - `useObserver` React hook
@@ -63,7 +63,7 @@ Export all data as JSON.
63
63
 
64
64
  ```javascript
65
65
  const json = memorio.devtools.exportData()
66
- console.log(json)
66
+ console.debug(json)
67
67
  ```
68
68
 
69
69
  ### importData(jsonString)
@@ -29,7 +29,7 @@ idb.data.set('myApp', 'users', { id: 1, name: 'Mario' });
29
29
 
30
30
  // Get data
31
31
  const user = idb.data.get('myApp', 'users', 1);
32
- console.log(user.name); // "Mario"
32
+ console.debug(user.name); // "Mario"
33
33
  ```
34
34
 
35
35
  ### Example 2: Intermediate
@@ -45,7 +45,7 @@ idb.data.set('store', 'products', { id: 2, name: 'Banana', price: 0.8 });
45
45
 
46
46
  // List databases
47
47
  const databases = idb.db.list();
48
- console.log(databases); // ['myApp', 'store']
48
+ console.debug(databases); // ['myApp', 'store']
49
49
  ```
50
50
 
51
51
  ### Example 3: Advanced
@@ -65,7 +65,7 @@ idb.db.delete('store');
65
65
 
66
66
  // Handle quota
67
67
  const quota = idb.db.quota();
68
- console.log(`Using ${quota.used} of ${quota.total} bytes`);
68
+ console.debug(`Using ${quota.used} of ${quota.total} bytes`);
69
69
  ```
70
70
 
71
71
  ---
@@ -107,7 +107,7 @@ state.user = { name: 'John' }
107
107
 
108
108
  ```javascript
109
109
  const stats = memorio.logger.getStats()
110
- console.log(stats)
110
+ console.debug(stats)
111
111
  // { total: 15, state: 5, store: 3, session: 2, cache: 5, set: 10, get: 0, delete: 3, clear: 2 }
112
112
  ```
113
113
 
@@ -143,5 +143,5 @@ const stateLogs = logs.filter(l => l.module === 'state')
143
143
  const setOperations = logs.filter(l => l.action === 'set')
144
144
 
145
145
  // Export for debugging
146
- console.log(memorio.logger.exportLogs())
146
+ console.debug(memorio.logger.exportLogs())
147
147
  ```
@@ -25,7 +25,7 @@ import 'memorio';
25
25
  console.warn('observer() is deprecated. Please use useObserver() for React or memorio.dispatch for vanilla JS.');
26
26
 
27
27
  observer('state.counter', (newValue) => {
28
- console.log('Counter is now:', newValue);
28
+ console.debug('Counter is now:', newValue);
29
29
  });
30
30
 
31
31
  state.counter = 1;
@@ -42,7 +42,7 @@ state.counter = 5;
42
42
  ```javascript
43
43
  // Observer with old value
44
44
  observer('state.user', (newValue, oldValue) => {
45
- console.log(`User changed from ${oldValue?.name} to ${newValue?.name}`);
45
+ console.debug(`User changed from ${oldValue?.name} to ${newValue?.name}`);
46
46
  });
47
47
 
48
48
  state.user = { name: 'Mario' };
@@ -60,7 +60,7 @@ const obs1 = observer('state.data', handler1);
60
60
  const obs2 = observer('state.data', handler2);
61
61
 
62
62
  // List all observers
63
- console.log(observer.list);
63
+ console.debug(observer.list);
64
64
  // Output: [{ name: 'state.data', id: '...' }, ...]
65
65
 
66
66
  // Remove specific observer
@@ -122,7 +122,7 @@ observer('state.counter', () => {
122
122
  ```javascript
123
123
  useEffect(() => {
124
124
  const handleChange = (newVal) => {
125
- console.log('Changed:', newVal);
125
+ console.debug('Changed:', newVal);
126
126
  };
127
127
 
128
128
  observer('state.data', handleChange);
@@ -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.log(memorio.platform); // 'browser' | 'node' | 'deno' | 'edge'
45
- console.log(memorio.isPersistent); // true if using real storage
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.log(state.user); // undefined - global state is separate
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.log(contexts); // ['user-123', 'user-456', ...]
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: v2.7.0
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
- ### v2.7.0 (Current)
296
+ ### v3.0.2 (Current)
297
297
 
298
- - ✅ Added crypto.getRandomValues() fallback
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 v2.7.0*
318
+ *This document was last updated for Memorio v3.0.2*
@@ -27,10 +27,10 @@ session.set('token', 'abc123');
27
27
  session.set('userId', 42);
28
28
 
29
29
  // Read session data
30
- console.log(session.get('token')); // "abc123"
30
+ console.debug(session.get('token')); // "abc123"
31
31
 
32
32
  // Check persistence
33
- console.log(session.isPersistent); // true in browser, false in Node.js/Deno
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.log(`Using ${used} out of ${total} KB`);
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.log(`${size} bytes`);
63
+ console.debug(`${size} bytes`);
64
64
 
65
65
  // Handle session expiry
66
66
  window.addEventListener('storage', (e) => {
@@ -28,7 +28,7 @@ state.name = 'Mario';
28
28
  state.age = 25;
29
29
 
30
30
  // Get a value
31
- console.log(state.name); // "Mario"
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.log(state.items); // [1, 2, 3, 4]
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.log(state.list);
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.log(path.name); // "user"
64
- console.log(path.profile.name); // "user.profile"
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.log(state.user.__path); // "state.user"
67
+ console.debug(state.user.__path); // "state.user"
68
68
 
69
69
  // Protected keys (internal use)
70
- console.log(protect); // Array of protected keys
70
+ console.debug(protect); // Array of protected keys
71
71
  ```
72
72
 
73
73
  ---
@@ -27,11 +27,11 @@ store.set('username', 'Mario');
27
27
  store.set('score', 1500);
28
28
 
29
29
  // Read data
30
- console.log(store.get('username')); // "Mario"
31
- console.log(store.get('score')); // 1500
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.log(store.isPersistent); // true in browser, false in Node.js/Deno
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.log(user.name); // "Luigi"
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.log(`${totalSize} bytes`);
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.log(`Using ${used} out of ${total} KB`);
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.log(`${size} bytes`);
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.log(state.user.name, state.items.length, state.counter);
114
+ console.debug(state.user.name, state.items.length, state.counter);
115
115
  });
116
116
  ```
117
117
 
package/examples/basic.ts CHANGED
@@ -16,23 +16,23 @@ import 'memorio'
16
16
  // PLATFORM DETECTION
17
17
  // ============================================
18
18
 
19
- console.log('=== Platform Detection ===')
20
- console.log('Memorio version:', memorio.version)
19
+ console.debug('=== Platform Detection ===')
20
+ console.debug('Memorio version:', memorio.version)
21
21
 
22
22
  // Check platform
23
23
  if (memorio.isBrowser()) {
24
- console.log('Platform: Browser')
24
+ console.debug('Platform: Browser')
25
25
  } else if (memorio.isNode()) {
26
- console.log('Platform: Node.js')
26
+ console.debug('Platform: Node.js')
27
27
  } else if (memorio.isDeno()) {
28
- console.log('Platform: Deno')
28
+ console.debug('Platform: Deno')
29
29
  } else if (memorio.isEdge()) {
30
- console.log('Platform: Edge Worker')
30
+ console.debug('Platform: Edge Worker')
31
31
  }
32
32
 
33
33
  // Get capabilities
34
34
  const caps = memorio.getCapabilities()
35
- console.log('Capabilities:', {
35
+ console.debug('Capabilities:', {
36
36
  platform: caps.platform,
37
37
  hasLocalStorage: caps.hasLocalStorage,
38
38
  hasSessionStorage: caps.hasSessionStorage,
@@ -43,7 +43,7 @@ console.log('Capabilities:', {
43
43
  // STATE - In-memory reactive state
44
44
  // ============================================
45
45
 
46
- console.log('\n=== State Management ===')
46
+ console.debug('\n=== State Management ===')
47
47
 
48
48
  // Set some state values
49
49
  state.name = 'Mario'
@@ -55,21 +55,21 @@ state.profile = {
55
55
  }
56
56
 
57
57
  // Get state values
58
- console.log('Name:', state.name)
59
- console.log('Age:', state.age)
60
- console.log('Profile:', state.profile)
58
+ console.debug('Name:', state.name)
59
+ console.debug('Age:', state.age)
60
+ console.debug('Profile:', state.profile)
61
61
 
62
62
  // List all states
63
- console.log('All states:', state.list)
63
+ console.debug('All states:', state.list)
64
64
 
65
65
  // ============================================
66
66
  // STORE - Persistent localStorage
67
67
  // ============================================
68
68
 
69
- console.log('\n=== Store (Persistent Storage) ===')
69
+ console.debug('\n=== Store (Persistent Storage) ===')
70
70
 
71
71
  // Check persistence
72
- console.log('Is persistent:', store.isPersistent) // true in browser, false in Node.js/Deno
72
+ console.debug('Is persistent:', store.isPersistent) // true in browser, false in Node.js/Deno
73
73
 
74
74
  // Save to localStorage
75
75
  store.set('username', 'mario')
@@ -77,28 +77,28 @@ store.set('preferences', { theme: 'dark', language: 'en' })
77
77
  store.set('lastLogin', Date.now())
78
78
 
79
79
  // Read from localStorage
80
- console.log('Username:', store.get('username'))
81
- console.log('Preferences:', store.get('preferences'))
80
+ console.debug('Username:', store.get('username'))
81
+ console.debug('Preferences:', store.get('preferences'))
82
82
 
83
83
  // Get storage size
84
- console.log('Storage size:', store.size(), 'bytes')
84
+ console.debug('Storage size:', store.size(), 'bytes')
85
85
 
86
86
  // ============================================
87
87
  // SESSION - Temporary session storage
88
88
  // ============================================
89
89
 
90
- console.log('\n=== Session (Temporary Storage) ===')
90
+ console.debug('\n=== Session (Temporary Storage) ===')
91
91
 
92
92
  // Check persistence
93
- console.log('Is persistent:', session.isPersistent) // true in browser, false in Node.js/Deno
93
+ console.debug('Is persistent:', session.isPersistent) // true in browser, false in Node.js/Deno
94
94
 
95
95
  // Save session data (cleared when tab closes)
96
96
  session.set('token', 'abc123xyz')
97
97
  session.set('userId', 42)
98
98
 
99
99
  // Read session data
100
- console.log('Token:', session.get('token'))
101
- console.log('User ID:', session.get('userId'))
100
+ console.debug('Token:', session.get('token'))
101
+ console.debug('User ID:', session.get('userId'))
102
102
 
103
103
  // ============================================
104
104
  // CLEANUP
@@ -112,4 +112,4 @@ session.remove('token')
112
112
  store.removeAll()
113
113
  session.removeAll()
114
114
 
115
- console.log('\nExample complete!')
115
+ console.debug('\nExample complete!')
@@ -350,8 +350,8 @@ Session ID: ${memorio.getCapabilities().sessionId.substring(0, 8)}...
350
350
  `.trim()
351
351
 
352
352
  // Log welcome
353
- console.log('🧠 Memorio loaded!')
354
- console.log('Platform:', memorio.getCapabilities().platform)
353
+ console.debug('🧠 Memorio loaded!')
354
+ console.debug('Platform:', memorio.getCapabilities().platform)
355
355
  </script>
356
356
  </body>
357
357