memorio 4.2.0 → 4.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
@@ -232,6 +232,19 @@ memorio.isolate('tenant-name')
232
232
 
233
233
  ---
234
234
 
235
+ ## Browser Extension (Chrome/Edge)
236
+
237
+ ![dphelper Banner](https://raw.githubusercontent.com/passariello/container/refs/heads/main/dphelper/assets/images/screenshot.png)
238
+
239
+ Manage your `Memorio` on `dphelper Manager Browser Extension*` environment, monitor memory usage, and access documentation directly from your browser.
240
+
241
+ *Need to install dphelper npm
242
+
243
+ - [Download for Chrome](https://chrome.google.com/webstore/detail/dphelper-manager-dev-tool/oppppldaoknfddeikfloonnialijngbk)
244
+ - [Download for Edge](https://microsoftedge.microsoft.com/addons/detail/dphelper-manager-dev-to/kphabkbdpaljlfagldhojilhfammepnk)
245
+
246
+ ---
247
+
235
248
  ## Cross-Platform
236
249
 
237
250
  Memorio runs in every JavaScript environment, with automatic fallbacks.
package/index.cjs CHANGED
@@ -1,5 +1,3 @@
1
- "use strict";
2
-
3
1
  var e = Object.getOwnPropertyNames, o = (o, t) => function() {
4
2
  return o && (t = (0, o[e(o)[0]])(o = 0)), t;
5
3
  }, t = {}, r = o({
@@ -317,7 +315,7 @@ function J(e) {
317
315
  };
318
316
  }
319
317
 
320
- var z = "4.2.0";
318
+ var z = "4.2.2";
321
319
 
322
320
  Object.defineProperty(globalThis, "memorio", {
323
321
  value: {},
package/index.js CHANGED
@@ -315,7 +315,7 @@ function J(e) {
315
315
  };
316
316
  }
317
317
 
318
- var z = "4.2.0";
318
+ var z = "4.2.2";
319
319
 
320
320
  Object.defineProperty(globalThis, "memorio", {
321
321
  value: {},
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "memorio",
3
3
  "codeName": "memorio",
4
- "version": "4.2.0",
4
+ "version": "4.2.2",
5
5
  "description": "Memorio, State + Observer, Store and iDB for an easy life - Cross-platform compatible",
6
6
  "main": "./index.cjs",
7
7
  "browser": "./index.cjs",
@@ -44,9 +44,6 @@
44
44
  "url": "https://www.patreon.com/passariello"
45
45
  }
46
46
  ],
47
- "workspaces": [
48
- "tests"
49
- ],
50
47
  "engines": {
51
48
  "node": ">=18.0.0"
52
49
  },
@@ -67,18 +64,10 @@
67
64
  }
68
65
  },
69
66
  "overrides": {
70
- "es-define-property": "npm:@socketregistry/es-define-property@^1",
71
- "es-set-tostringtag": "npm:@socketregistry/es-set-tostringtag@^1",
72
- "function-bind": "npm:@socketregistry/function-bind@^1",
73
- "gopd": "npm:@socketregistry/gopd@^1",
74
- "has-symbols": "npm:@socketregistry/has-symbols@^1",
75
- "has-tostringtag": "npm:@socketregistry/has-tostringtag@^1",
76
- "hasown": "npm:@socketregistry/hasown@^1",
77
- "indent-string": "npm:@socketregistry/indent-string@^1",
78
- "object-assign": "npm:@socketregistry/object-assign@^1",
79
- "safe-buffer": "npm:@socketregistry/safe-buffer@^1",
80
- "safer-buffer": "npm:@socketregistry/safer-buffer@^1",
81
- "side-channel": "npm:@socketregistry/side-channel@^1"
67
+ "object-assign": "npm:@socketregistry/object-assign@^1"
68
+ },
69
+ "resolutions": {
70
+ "object-assign": "npm:@socketregistry/object-assign@^1"
82
71
  },
83
72
  "exports": {
84
73
  ".": {
package/docs/README.md DELETED
@@ -1,266 +0,0 @@
1
- # [memorio](https://npmjs.com/package/memorio)
2
-
3
- ![image](https://raw.githubusercontent.com/passariello/container/refs/heads/main/memorio/banner.svg)
4
-
5
- ![version](https://img.shields.io/npm/v/memorio.svg)
6
- ![install size](https://img.shields.io/badge/dynamic/json?url=https://packagephobia.com/v2/api.json?p=memorio&query=$.install.pretty&label=install%20size&style=flat-square)
7
- ![downloads](https://img.shields.io/npm/dm/memorio.svg)
8
-
9
- ![Node.js](https://img.shields.io/badge/Node.js-gray?logo=node.js)
10
- ![Browser](https://img.shields.io/badge/Browser-gray?logo=google-chrome)
11
- ![Deno](https://img.shields.io/badge/Deno-gray?logo=deno)
12
- ![TypeScript](https://img.shields.io/badge/TypeScript-gray?logo=typescript)
13
- ![MIT](https://img.shields.io/badge/MIT-green?logo=open-source-initiative)
14
- ![tsup](https://img.shields.io/badge/tsup-gray?logo=tsup)
15
-
16
- **State management that actually makes your life easier.**
17
- Zero friction. Zero bloat. Single import. Works everywhere JavaScript runs.
18
-
19
- [Get Started](#-quick-start) · [API Reference](#-api-reference) · [License: MIT](https://opensource.org/licenses/MIT)
20
-
21
- ---
22
-
23
- ## Why memorio?
24
-
25
- | | memorio | Redux | Zustand |
26
- |---|---|---|---|
27
- | **Setup** | 1 import | Boilerplate hell | Moderate |
28
- | **Dependencies** | **Zero** | Many | Few |
29
- | **TypeScript** | ✅ Native | ✅ | ✅ |
30
- | **Binary storage** | ✅ Built-in IDB | ❌ Add-on | ❌ |
31
- | **Observer** | ✅ Built-in | ❌ Add-on | ❌ |
32
- | **DevTools** | ✅ Built-in + dphelper-manager extension | ❌ Extension | ❌ |
33
- | **Running on the edge** | ✅ Workers, Deno | ⚠️ Limited | ⚠️ Limited |
34
-
35
- If you need a `store` on the server. A `cache` in the edge worker.
36
- Session isolation in Next.js. IndexedDB in a Service Worker.
37
- All from one import, zero configuration.
38
-
39
- ---
40
-
41
- ## Features
42
-
43
- | | |
44
- |---|---|
45
- | **`state`** | Reactive, volatile state — listen with `useObserver` |
46
- | **`store`** | localStorage persistence — survives refresh |
47
- | **`session`** | sessionStorage — dies with the tab |
48
- | **`cache`** | In-memory cache — fastest read possible |
49
- | **`idb`** | IndexedDB with typed tables — structured, persistent, async |
50
- | **`observer`** | Object watcher — legacy, still works |
51
- | **`useObserver`** | React hook with auto-discovery — drops in |
52
- | **`devtools`** | `memorio.devtools.inspect()` — see everything in console |
53
- | **`logger`** | Auto-log every state change with timestamps |
54
- | **Session Isolation** | Every browser tab, every request: isolated namespace |
55
- | **Platform Detection** | `isBrowser`, `isNode`, `isDeno`, `isEdge` |
56
-
57
- No Zustand. No Redux. No provider boilerplate.
58
- Just import it and start storing.
59
-
60
- ---
61
-
62
- ## Installation options
63
-
64
- ```bash
65
- # npm
66
- npm i memorio
67
-
68
- # pnpm
69
- pnpm add memorio
70
-
71
- # yarn
72
- yarn add memorio
73
-
74
- # React peer dep (optional, React ≥ 16.8)
75
- npm i react react-dom
76
- ```
77
-
78
- ## **Setup**
79
-
80
- ```typescript
81
- // memorio/index.ts — import once at your app entry point
82
- import 'memorio'
83
-
84
- // Memory
85
- state.user = { name: 'Sara', role: 'admin' }
86
- state.counter++
87
- state.settings = { theme: 'dark', lang: 'it' }
88
-
89
- // Call it "a store" but make it observe automatically
90
- useObserver(
91
- () => { console.debug('user changed:', state.user) },
92
- [state.user]
93
- )
94
- ```
95
-
96
- That is it.
97
- No context providers. No `<Store>` wrappers. No action creators.
98
- Import → assign → done.
99
-
100
- ---
101
-
102
- ## API Reference
103
-
104
- ### `state` — Volatile reactive state
105
-
106
- Global, Proxy-based, reactive. Access anywhere.
107
-
108
- ```javascript
109
- // Set
110
- state.user = { name: 'Sara', role: 'admin' }
111
- state.items = [1, 2, 3]
112
-
113
- // Get
114
- const name = state.user.name // 'Sara'
115
-
116
- // List all keys
117
- console.debug(state.list) // ['user', 'items']
118
-
119
- // Remove one key
120
- state.remove('items')
121
-
122
- // Clear all — lock/unlock available for frozen objects
123
- state.removeAll()
124
- state.lock() // freeze everything
125
- state.unlock() // unfreeze
126
- ```
127
-
128
- ### `store` — survives refresh
129
-
130
- ```javascript
131
- store.set('preferences', { theme: 'dark' })
132
- const prefs = store.get('preferences') // { theme: 'dark' } or null
133
- store.remove('preferences')
134
- store.removeAll()
135
- console.debug(store.size(), 'chars stored')
136
- console.debug(store.isPersistent) // true → real localStorage
137
- ```
138
-
139
- ### `session` — dies with tab
140
-
141
- ```javascript
142
- session.set('token', 'user-abc-123')
143
- const token = session.get('token') // 'user-abc-123' or null
144
- session.removeAll()
145
- ```
146
-
147
- ### `cache` — In-memory, disappears on refresh
148
-
149
- ```javascript
150
- cache.set('temp', computeExpensiveResult())
151
- const result = cache.get('temp') // undefined or the value
152
- cache.clear() // empty it all
153
- ```
154
-
155
- ### `idb` — structured & typed
156
-
157
- ```javascript
158
- await idb.db.create('my-db')
159
- await idb.table.create('my-db', 'users')
160
- await idb.data.set('my-db', 'users', { id: 1, name: 'Sara' })
161
- const user = await idb.data.get('my-db', 'users', 1)
162
- ```
163
-
164
- ### `observer` — Object watcher (DEPRECATED)
165
-
166
- ```javascript
167
- globalThis.observer('state.user', (newVal, oldVal) => {
168
- console.debug('user changed:', newVal, oldVal)
169
- })
170
- ```
171
-
172
- ### `useObserver` — React observer hook
173
-
174
- Available globally after `import 'memorio'`.
175
-
176
- ```jsx
177
- import 'memorio'
178
-
179
- function Counter() {
180
- const [, forceUpdate] = useReducer(x => x + 1, 0)
181
-
182
- useObserver(forceUpdate, [state.counter])
183
- // State path auto-discovered during render — no manual deps needed
184
-
185
- return <div>Count: {state.counter}</div>
186
- }
187
- ```
188
-
189
- ### `devtools` — inspect everything in one call
190
-
191
- ```javascript
192
- memorio.devtools.inspect() // pretty-prints state, store, session, cache
193
- memorio.devtools.stats() // { stateKeys, storeKeys, sessionKeys, ... }
194
- memorio.devtools.clear('state')
195
- memorio.devtools.exportData() // JSON snapshot
196
- $state // console shortcut — same as globalThis.state
197
- ```
198
-
199
- > **Browser Extension Integration:** When used with dphelper-manager browser extension, memorio's global state namespace is automatically detected and visualized through a dedicated DevTools panel, providing time-travel debugging and structural guardrails.
200
-
201
- ### `logger` — track every change
202
-
203
- ```javascript
204
- memorio.logger.configure({ enabled: true, logToConsole: true })
205
- memorio.logger.getHistory() // [{ timestamp, module, action, path, value }, ...]
206
- memorio.logger.getStats() // { total, state, set, get, ... }
207
- memorio.logger.exportLogs() // JSON string of all history
208
- ```
209
-
210
- ### Platform detection
211
-
212
- Access via `memorio.*`:
213
-
214
- ```javascript
215
- memorio.isBrowser() // true in Chrome, Firefox, Safari
216
- memorio.isNode() // true in Node.js
217
- memorio.isDeno() // true in Deno
218
- memorio.isEdge() // true in Cloudflare Workers, Vercel Edge
219
-
220
- const caps = memorio.getCapabilities()
221
- // { platform: 'browser', hasLocalStorage: true, hasIndexedDB: true, ... }
222
- ```
223
-
224
- ### Context (multi-tenant)
225
-
226
- ```javascript
227
- memorio.createContext('tenant-name')
228
- memorio.listContexts()
229
- memorio.deleteContext('context-id')
230
- memorio.isolate('tenant-name')
231
- ```
232
-
233
- ---
234
-
235
- ## Cross-Platform
236
-
237
- Memorio runs in every JavaScript environment, with automatic fallbacks.
238
-
239
- | | Browser | Node.js | Deno | Edge / Workers |
240
- |---|---|---|---|---|
241
- | `state` | ✅ | ✅ | ✅ | ✅ |
242
- | `observer` / `useObserver` | ✅ | ✅ | ✅ | ✅ |
243
- | `cache` | ✅ | ✅ | ✅ | ✅ |
244
- | `store` | ✅ localStorage | ⚠️ memory | ⚠️ memory | ✅ localStorage |
245
- | `session` | ✅ sessionStorage | ⚠️ memory | ⚠️ memory | ✅ sessionStorage |
246
- | `idb` | ✅ IndexedDB | ❌ | ❌ | ⚠️ |
247
- | `devtools` | ✅ | ❌ | ❌ | ⚠️ |
248
-
249
- > **Why memory fallbacks on the server?** There is no browser. `store` and `session` gracefully fall back to `Map`. You still get the same API. Same `state`, same `cache`, same `useObserver`. No extra config required.
250
-
251
- ---
252
-
253
- ## Security
254
-
255
- - Zero production dependencies — no supply chain surprises
256
- - NIST & NSA aligned — enterprise-grade security standards
257
- - No `eval`, no obfuscation, no hardcoded secrets
258
- - All inputs validated, keys sanitized, errors caught
259
- - Secure random session IDs via `crypto.randomUUID`
260
- - MIT license — full audit trail on [`SECURITY.md`](.github/SECURITY.md)
261
-
262
- ---
263
-
264
- ## License
265
-
266
- MIT © [Dario Passariello](https://dario.passariello.ca)
package/docs/_config.yml DELETED
@@ -1 +0,0 @@
1
- theme: jekyll-theme-modernist
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes