@biglogic/rgs 3.5.1 → 3.5.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
@@ -1,304 +1,323 @@
1
- # Argis (RGS) - Reactive Global State
2
-
3
- > "The Magnetar" **Atomic Precision. Immutable Safety. Zen Simplicity.**
4
- > The most powerful state management engine for React. Built for those who demand industrial-grade reliability with a zero-boilerplate experience.
5
-
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
- [![version](https://img.shields.io/npm/v/@biglogic/rgs.svg)](https://npmjs.org/package/@biglogic/rgs)
8
- [![downloads](https://img.shields.io/npm/dm/@biglogic/rgs.svg)](https://npmjs.org/package/@biglogic/rgs)
9
-
10
- ![Javascript](https://img.shields.io/badge/Javascript-gray?logo=Javascript)
11
- ![React](https://img.shields.io/badge/React-gray?logo=React)
12
- ![TypeScript](https://img.shields.io/badge/TypeScript-gray?logo=typescript)
13
- ![Node.js](https://img.shields.io/badge/Node.js-gray?logo=node.js)
14
- ![Jest](https://img.shields.io/badge/Jest-gray?logo=jest)
15
- ![ESLint](https://img.shields.io/badge/Eslint-gray?logo=eslint)
16
- ![esbuild](https://img.shields.io/badge/esbuild-gray?logo=esbuild)
17
-
18
- ![Snik](https://img.shields.io/badge/Snyk-gray?logo=Snyk)
19
- ![Snik](https://img.shields.io/badge/Socket-gray?logo=socket)
20
-
21
- <!-- [![GitBook](https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1)](https://a51.gitbook.io/rgs) -->
22
-
23
- ---
24
-
25
- ## 🌟 Why Magnetar?
26
-
27
- We took the simplicity of **Reactive Global State (RGS)** and fused it with the architecture of a **High-Performance Kernel**. It's the only library that gives you:
28
-
29
- - **💎 Absolute Immutability**: Powered by **Immer**. No more manual spreads. State is frozen by default.
30
- - **🛡️ Industrial-Grade Safety**: Deep Proxy guards that throw `Forbidden Mutation` errors if you try to bypass the kernel.
31
- - **🔌 Enterprise Ecosystem**: A real plugin architecture with 10+ official modules (Sync, Storage, DevTools, etc.).
32
- - **⚛️ Power on Demand**: Advanced async and persistence tools isolated in the `advanced` export.
33
- - **🏗️ Stellar Architecture**: Zero circular dependencies. Modular, clean, and 100% type-safe.
34
-
35
- ---
36
-
37
- ## gState vs useState
38
-
39
- | Feature | useState | gState |
40
- |---------|----------|--------|
41
- | **Global state across components** | ❌ Need Context/props | ✅ Automatic sharing |
42
- | **Provider wrapper** | ❌ Required | ✅ Not needed |
43
- | **Persistence (localStorage)** | ❌ Manual | ✅ Built-in |
44
- | **Data encryption** | ❌ | ✅ AES-256-GCM |
45
- | **Multiple namespaces/stores** | ❌ | ✅ |
46
- | **Plugins (Immer, Undo/Redo)** | ❌ | ✅ |
47
- | **Audit logging** | ❌ | ✅ |
48
- | **RBAC/GDPR consent** | ❌ | ✅ |
49
- | **SSR/Hydration** | ❌ Manual | ✅ Automatic |
50
- | **Computed values** | ❌ | ✅ |
51
-
52
- ### When to use what?
53
-
54
- - **useState**: Local UI, single component, temporary state
55
- - **gState**:
56
- - Shared state across multiple components
57
- - Persistent data (preferences, cart, authentication)
58
- - Sensitive data (encryption)
59
- - Advanced features (undo/redo, snapshots)
60
- - Enterprise (audit, RBAC, GDPR)
61
-
62
- ---
63
-
64
- ## ⚔️ The Arena: RGS vs The World
65
-
66
- |Feature|**RGS (Argis)**|Zustand|Redux Toolkit|Recoil|
67
- |:---|:---|:---|:---|:---|
68
- | **Philosophy** | **Zen State** | Minimalist | Enterprise Flux | Atomic |
69
- | **API Surface** | **1 Function** | Simple | Complex | Complex |
70
- | **Mutations** | **Magic (Immer)** | Manual Spreads | Magic (Immer) | Manual |
71
- | **Selectors** | **Type-Safe** | Functional | Functional | ⚠️ Selectors |
72
- | **Security** | 🛡️ **AES-256 + RBAC** | None | Ecosystem | None |
73
- | **Persistence** | 💾 **First-class** | 🔌 Middleware | 🔌 Middleware | 🔌 Effects |
74
- | **Async** | **Atomic** | Async/Await | Thunks | Suspense |
75
- | **Bundle Size** | **~2kB** | ~1kB | >10kB | >20kB |
76
-
77
- > **RGS** is the only library on the market that treats **Security** and **Persistence** as first-class citizens.
78
-
79
- ---
80
-
81
- ### Installation
82
-
83
- ```shell
84
- npm install @biglogic/rgs
85
- ```
86
-
87
- ---
88
-
89
- ### Examples and guide
90
-
91
- **[github.com/BigLogic-ca/rgs](https://github.com/BigLogic-ca/rgs)**
92
-
93
- ---
94
-
95
- ## 🏗️ Architecture
96
-
97
- ```mermaid
98
- graph TB
99
- subgraph API
100
- A[gstate] --> D[IStore]
101
- B[useStore] --> D
102
- C[createStore] --> D
103
- end
104
-
105
- D --> E[Storage Adapter]
106
- D --> F[Immer Proxy]
107
- D --> G[Plugins]
108
- D --> H[Security]
109
- D --> I[Async Store]
110
-
111
- E --> J[local]
112
- E --> K[session]
113
- E --> L[memory]
114
-
115
- G --> M[UndoRedo]
116
- G --> N[Sync]
117
- G --> O[Schema]
118
- G --> P[Analytics]
119
- ```
120
-
121
- ### Core Components
122
-
123
- | Component | Description |
124
- |-----------|-------------|
125
- | **gstate()** | Creates store + hook in one line |
126
- | **useStore()** | React hook for subscribing to state |
127
- | **createStore()** | Classic store factory |
128
- | **IStore** | Core interface with get/set/subscribe |
129
- | **StorageAdapters** | local, session, memory persistence |
130
- | **Plugins** | Immer, Undo/Redo, Sync, Schema, etc. |
131
- | **Security** | Encryption, RBAC, GDPR consent |
132
-
133
- ---
134
-
135
- ## Requirements
136
-
137
- - **React 16.8+** (for hooks support)
138
- - **React DOM**
139
-
140
- ## ⚡ Zero-Boilerplate Quickstart
141
-
142
- ### Path A: The Zen Way (Modular)
143
-
144
- Best for modern applications. Clean imports, zero global pollution, **Type-Safe**.
145
-
146
- ```tsx
147
- import { gstate } from '@biglogic/rgs'
148
-
149
- // 1. Create a typed store hook
150
- const useCounter = gstate({ count: 0, user: { name: 'Alice' } })
151
-
152
- // 2. Use with Type-Safe Selectors (Preferred)
153
- const count = useCounter(state => state.count)
154
- const userName = useCounter(state => state.user.name)
155
-
156
- // OR use string keys (Legacy)
157
- const [count, setCount] = useCounter('count')
158
- ```
159
-
160
- ### Path B: The Classic Way (Global)
161
-
162
- Best for shared state across the entire application.
163
-
164
- ```tsx
165
- // 1. Initialize once
166
- import { initState, useStore } from '@biglogic/rgs'
167
- initState({ namespace: 'app' })
168
-
169
- // 2. Use anywhere
170
- const [user, setUser] = useStore('user')
171
- ```
172
-
173
- ---
174
-
175
- ## 📚 Quick Examples
176
-
177
- ```tsx
178
- const store = gstate({ theme: 'dark' }, "my-app")
179
- ```
180
-
181
- ### Encryption
182
-
183
- ```tsx
184
- const secureStore = gstate({ token: 'xxx' }, { encoded: true })
185
- ```
186
-
187
- ### Undo/Redo
188
-
189
- ```tsx
190
- const store = gstate({ count: 0 })
191
- store._addPlugin(undoRedoPlugin({ limit: 50 }))
192
-
193
- store.undo()
194
- store.redo()
195
- ```
196
-
197
- ### Cross-Tab Sync
198
-
199
- ```tsx
200
- const store = gstate({ theme: 'light' })
201
- store._addPlugin(syncPlugin({ channelName: 'my-app' }))
202
- ```
203
-
204
- ```tsx
205
- const store = gstate({ firstName: 'John', lastName: 'Doe' })
206
- store.compute('fullName', (get) => `${get('firstName')} ${get('lastName')}`)
207
-
208
- const [fullName] = store('fullName') // "John Doe"
209
- ```
210
-
211
- ### Error Handling with onError
212
-
213
- Handle errors gracefully with the `onError` callback - perfect for production apps:
214
-
215
- ```tsx
216
- const store = gstate({ data: null }, {
217
- onError: (error, context) => {
218
- console.error(`Error in ${context.operation}:`, error.message)
219
- // Send to error tracking service (Sentry, etc.)
220
- }
221
- })
222
- ```
223
-
224
- ### Size Limits (maxObjectSize & maxTotalSize)
225
-
226
- Protect your app from memory issues with automatic size warnings:
227
-
228
- ```tsx
229
- const store = gstate({ data: {} }, {
230
- // Warn if single value exceeds 5MB (Default is 0/Disabled for performance)
231
- maxObjectSize: 5 * 1024 * 1024,
232
- // Warn if total store exceeds 50MB (Default is 0/Disabled)
233
- maxTotalSize: 50 * 1024 * 1024
234
- })
235
- ```
236
-
237
- ---
238
-
239
- ## Multiple Stores
240
-
241
- You can create multiple independent stores using namespaces:
242
-
243
- ```tsx
244
- // Option 1: gstate with namespace
245
- const userStore = gstate({ name: 'John' }, { namespace: 'users' })
246
- const appStore = gstate({ theme: 'dark' }, { namespace: 'app' })
247
-
248
- // In components - same key, different stores
249
- const [name] = userStore('name') // 'John'
250
- const [theme] = appStore('theme') // 'dark'
251
-
252
- // Option 2: initState + useStore (global default store)
253
- initState({ namespace: 'global' })
254
- const [value, setValue] = useStore('key')
255
- ```
256
-
257
- **Tip**: Keys are unique per-namespace, so you can use the same key name in different stores.
258
-
259
- ## 🚀 Advanced Superpowers
260
-
261
- ### 🔌 Official Plugin Ecosystem
262
-
263
- Extend the core functionality dynamically with specialized modules.
264
-
265
- 1. **ImmerPlugin**: Adds `setWithProduce` for functional updates.
266
- 2. **UndoRedoPlugin**: Multi-level history management.
267
- 3. **PersistencePlugin**: Advanced storage with custom serialization.
268
- 4. **SyncPlugin**: Cross-tab state synchronization via BroadcastChannel.
269
- 5. **SchemaPlugin**: Runtime validation (perfect for Zod).
270
- 6. **DevToolsPlugin**: Redux DevTools integration.
271
- 7. **TTLPlugin**: Time-to-live management.
272
- 8. **AnalyticsPlugin**: Tracking bridge for metrics.
273
- 9. **SnapshotPlugin**: Manual state checkpointing.
274
- 10. **GuardPlugin**: Data transformation layer.
275
-
276
- ```typescript
277
- import { createStore, PersistencePlugin, undoRedoPlugin } from '@biglogic/rgs'
278
-
279
- const store = createStore()
280
- store._addPlugin(PersistencePlugin({ storage: 'localStorage' }))
281
- store._addPlugin(undoRedoPlugin({ limit: 50 }))
282
-
283
- // Undo like a pro
284
- store.undo()
285
- ```
286
-
287
- ### 🔬 Power Tools (Import from `rgs/advanced`)
288
-
289
- Need the heavy artillery? We've got you covered.
290
-
291
- - `createAsyncStore(fetcher)`: Atomic async state management.
292
- - `StorageAdapters`: High-level interfaces for any storage engine.
293
- - `Middleware / IPlugin`: Build your own extensions.
294
-
295
- ---
296
-
297
- ## 📄 License
298
-
299
- MIT © [Dario Passariello](https://github.com/dpassariello)
300
-
301
- ---
302
-
303
- **Designed for those who build the future.**
304
- Made with ❤️ and a lot of caffe' espresso!
1
+ # Argis (RGS) - Reactive Global State
2
+
3
+ > "The Magnetar" **Atomic Precision. Immutable Safety. Zen Simplicity.**
4
+ > The most powerful state management engine for React. Built for those who demand industrial-grade reliability with a zero-boilerplate experience.
5
+
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![version](https://img.shields.io/npm/v/@biglogic/rgs.svg)](https://npmjs.org/package/@biglogic/rgs)
8
+ [![downloads](https://img.shields.io/npm/dm/@biglogic/rgs.svg)](https://npmjs.org/package/@biglogic/rgs)
9
+
10
+ ![Javascript](https://img.shields.io/badge/Javascript-gray?logo=Javascript)
11
+ ![React](https://img.shields.io/badge/React-gray?logo=React)
12
+ ![TypeScript](https://img.shields.io/badge/TypeScript-gray?logo=typescript)
13
+ ![Node.js](https://img.shields.io/badge/Node.js-gray?logo=node.js)
14
+ ![Jest](https://img.shields.io/badge/Jest-gray?logo=jest)
15
+ ![Playwright](https://img.shields.io/badge/Playwright-gray?logo=playwright)
16
+ ![ESLint](https://img.shields.io/badge/Eslint-gray?logo=eslint)
17
+ ![esbuild](https://img.shields.io/badge/esbuild-gray?logo=esbuild)
18
+
19
+ ![Snik](https://img.shields.io/badge/Snyk-gray?logo=Snyk)
20
+ ![Snik](https://img.shields.io/badge/Socket-gray?logo=socket)
21
+
22
+ <!-- [![GitBook](https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1)](https://a51.gitbook.io/rgs) -->
23
+
24
+ ---
25
+
26
+ ## 🌟 Why Magnetar?
27
+
28
+ We took the simplicity of **Reactive Global State (RGS)** and fused it with the architecture of a **High-Performance Kernel**. It's the only library that gives you:
29
+
30
+ - **💎 Absolute Immutability**: Powered by **Immer**. No more manual spreads. State is frozen by default.
31
+ - **🛡️ Industrial-Grade Safety**: Deep Proxy guards that throw `Forbidden Mutation` errors if you try to bypass the kernel.
32
+ - **🔌 Enterprise Ecosystem**: A real plugin architecture with 10+ official modules (Sync, Storage, DevTools, etc.).
33
+ - **⚛️ Power on Demand**: Advanced async and persistence tools isolated in the `advanced` export.
34
+ - **🏗️ Stellar Architecture**: Zero circular dependencies. Modular, clean, and 100% type-safe.
35
+
36
+ ---
37
+
38
+ ## gState vs useState
39
+
40
+ | Feature | useState | gState |
41
+ |---------|----------|--------|
42
+ | **Global state across components** | ❌ Need Context/props | ✅ Automatic sharing |
43
+ | **Provider wrapper** | ❌ Required | ✅ Not needed |
44
+ | **Persistence (localStorage)** | ❌ Manual | ✅ Built-in |
45
+ | **Data encryption** | ❌ | ✅ AES-256-GCM |
46
+ | **Multiple namespaces/stores** | ❌ | ✅ |
47
+ | **Plugins (Immer, Undo/Redo)** | ❌ | ✅ |
48
+ | **Audit logging** | ❌ | ✅ |
49
+ | **RBAC/GDPR consent** | ❌ | ✅ |
50
+ | **SSR/Hydration** | ❌ Manual | ✅ Automatic |
51
+ | **Computed values** | ❌ | ✅ |
52
+
53
+ ### When to use what?
54
+
55
+ - **useState**: Local UI, single component, temporary state
56
+ - **gState**:
57
+ - Shared state across multiple components
58
+ - Persistent data (preferences, cart, authentication)
59
+ - Sensitive data (encryption)
60
+ - Advanced features (undo/redo, snapshots)
61
+ - Enterprise (audit, RBAC, GDPR)
62
+
63
+ ---
64
+
65
+ ## ⚔️ The Arena: RGS vs The World
66
+
67
+ |Feature|**RGS (Argis)**|Zustand|Redux Toolkit|Recoil|
68
+ |:---|:---|:---|:---|:---|
69
+ | **Philosophy** | **Zen State** | Minimalist | Enterprise Flux | Atomic |
70
+ | **API Surface** | **1 Function** | Simple | Complex | Complex |
71
+ | **Mutations** | **Magic (Immer)** | Manual Spreads | Magic (Immer) | Manual |
72
+ | **Selectors** | **Type-Safe** | Functional | Functional | ⚠️ Selectors |
73
+ | **Security** | 🛡️ **AES-256 + RBAC** | None | Ecosystem | None |
74
+ | **Persistence** | 💾 **First-class** | 🔌 Middleware | 🔌 Middleware | 🔌 Effects |
75
+ | **Async** | **Atomic** | Async/Await | Thunks | Suspense |
76
+ | **Bundle Size** | **~2kB** | ~1kB | >10kB | >20kB |
77
+
78
+ > **RGS** is the only library on the market that treats **Security** and **Persistence** as first-class citizens.
79
+
80
+ ---
81
+
82
+ ### Installation
83
+
84
+ ```shell
85
+ npm install @biglogic/rgs
86
+ ```
87
+
88
+ ---
89
+
90
+ ### Examples and guide
91
+
92
+ **[github.com/BigLogic-ca/rgs](https://github.com/BigLogic-ca/rgs)**
93
+
94
+ ---
95
+
96
+ ## 🏗️ Architecture
97
+
98
+ ```mermaid
99
+ graph TB
100
+ subgraph API
101
+ A[gstate] --> D[IStore]
102
+ B[useStore] --> D
103
+ C[createStore] --> D
104
+ end
105
+
106
+ D --> E[Storage Adapter]
107
+ D --> F[Immer Proxy]
108
+ D --> G[Plugins]
109
+ D --> H[Security]
110
+ D --> I[Async Store]
111
+
112
+ E --> J[local]
113
+ E --> K[session]
114
+ E --> L[memory]
115
+
116
+ G --> M[UndoRedo]
117
+ G --> N[Sync]
118
+ G --> O[Schema]
119
+ G --> P[Analytics]
120
+ ```
121
+
122
+ ### Core Components
123
+
124
+ | Component | Description |
125
+ |-----------|-------------|
126
+ | **gstate()** | Creates store + hook in one line |
127
+ | **useStore()** | React hook for subscribing to state |
128
+ | **createStore()** | Classic store factory |
129
+ | **IStore** | Core interface with get/set/subscribe |
130
+ | **StorageAdapters** | local, session, memory persistence |
131
+ | **Plugins** | Immer, Undo/Redo, Sync, Schema, etc. |
132
+ | **Security** | Encryption, RBAC, GDPR consent |
133
+
134
+ ---
135
+
136
+ ## Requirements
137
+
138
+ - **React 16.8+** (for hooks support)
139
+ - **React DOM**
140
+
141
+ ## ⚡ Zero-Boilerplate Quickstart
142
+
143
+ ### Path A: The Zen Way (Modular)
144
+
145
+ Best for modern applications. Clean imports, zero global pollution, **Type-Safe**.
146
+
147
+ ```tsx
148
+ import { gstate } from '@biglogic/rgs'
149
+
150
+ // 1. Create a typed store hook
151
+ const useCounter = gstate({ count: 0, user: { name: 'Alice' } })
152
+
153
+ // 2. Use with Type-Safe Selectors (Preferred)
154
+ const count = useCounter(state => state.count)
155
+ const userName = useCounter(state => state.user.name)
156
+
157
+ // OR use string keys (Legacy)
158
+ const [count, setCount] = useCounter('count')
159
+ ```
160
+
161
+ ### Path B: The Classic Way (Global)
162
+
163
+ Best for shared state across the entire application.
164
+
165
+ ```tsx
166
+ // 1. Initialize once
167
+ import { initState, useStore } from '@biglogic/rgs'
168
+ initState({ namespace: 'app' })
169
+
170
+ // 2. Use anywhere
171
+ const [user, setUser] = useStore('user')
172
+ ```
173
+
174
+ ---
175
+
176
+ ## 📚 Quick Examples
177
+
178
+ ```tsx
179
+ const store = gstate({ theme: 'dark' }, "my-app")
180
+ ```
181
+
182
+ ### Encryption
183
+
184
+ ```tsx
185
+ const secureStore = gstate({ token: 'xxx' }, { encoded: true })
186
+ ```
187
+
188
+ ### Undo/Redo
189
+
190
+ ```tsx
191
+ const store = gstate({ count: 0 })
192
+ store._addPlugin(undoRedoPlugin({ limit: 50 }))
193
+
194
+ store.undo()
195
+ store.redo()
196
+ ```
197
+
198
+ ### Cross-Tab Sync
199
+
200
+ ```tsx
201
+ const store = gstate({ theme: 'light' })
202
+ store._addPlugin(syncPlugin({ channelName: 'my-app' }))
203
+ ```
204
+
205
+ ```tsx
206
+ const store = gstate({ firstName: 'John', lastName: 'Doe' })
207
+ store.compute('fullName', (get) => `${get('firstName')} ${get('lastName')}`)
208
+
209
+ const [fullName] = store('fullName') // "John Doe"
210
+ ```
211
+
212
+ ### Error Handling with onError
213
+
214
+ Handle errors gracefully with the `onError` callback - perfect for production apps:
215
+
216
+ ```tsx
217
+ const store = gstate({ data: null }, {
218
+ onError: (error, context) => {
219
+ console.error(`Error in ${context.operation}:`, error.message)
220
+ // Send to error tracking service (Sentry, etc.)
221
+ }
222
+ })
223
+ ```
224
+
225
+ ### Size Limits (maxObjectSize & maxTotalSize)
226
+
227
+ Protect your app from memory issues with automatic size warnings:
228
+
229
+ ```tsx
230
+ const store = gstate({ data: {} }, {
231
+ // Warn if single value exceeds 5MB (Default is 0/Disabled for performance)
232
+ maxObjectSize: 5 * 1024 * 1024,
233
+ // Warn if total store exceeds 50MB (Default is 0/Disabled)
234
+ maxTotalSize: 50 * 1024 * 1024
235
+ })
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Multiple Stores
241
+
242
+ You can create multiple independent stores using namespaces:
243
+
244
+ ```tsx
245
+ // Option 1: gstate with namespace
246
+ const userStore = gstate({ name: 'John' }, { namespace: 'users' })
247
+ const appStore = gstate({ theme: 'dark' }, { namespace: 'app' })
248
+
249
+ // In components - same key, different stores
250
+ const [name] = userStore('name') // 'John'
251
+ const [theme] = appStore('theme') // 'dark'
252
+
253
+ // Option 2: initState + useStore (global default store)
254
+ initState({ namespace: 'global' })
255
+ const [value, setValue] = useStore('key')
256
+ ```
257
+
258
+ **Tip**: Keys are unique per-namespace, so you can use the same key name in different stores.
259
+
260
+ ## 🚀 Advanced Superpowers
261
+
262
+ ### 🔌 Official Plugin Ecosystem
263
+
264
+ Extend the core functionality dynamically with specialized modules.
265
+
266
+ 1. **ImmerPlugin**: Adds `setWithProduce` for functional updates.
267
+ 2. **UndoRedoPlugin**: Multi-level history management.
268
+ 3. **PersistencePlugin**: Advanced storage with custom serialization.
269
+ 4. **SyncPlugin**: Cross-tab state synchronization via BroadcastChannel.
270
+ 5. **SchemaPlugin**: Runtime validation (perfect for Zod).
271
+ 6. **DevToolsPlugin**: Redux DevTools integration.
272
+ 7. **TTLPlugin**: Time-to-live management.
273
+ 8. **AnalyticsPlugin**: Tracking bridge for metrics.
274
+ 9. **SnapshotPlugin**: Manual state checkpointing.
275
+ 10. **GuardPlugin**: Data transformation layer.
276
+
277
+ ```typescript
278
+ import { createStore, PersistencePlugin, undoRedoPlugin } from '@biglogic/rgs'
279
+
280
+ const store = createStore()
281
+ store._addPlugin(PersistencePlugin({ storage: 'localStorage' }))
282
+ store._addPlugin(undoRedoPlugin({ limit: 50 }))
283
+
284
+ // Undo like a pro
285
+ store.undo()
286
+ ```
287
+
288
+ ### 🔬 Power Tools (Import from `rgs/advanced`)
289
+
290
+ Need the heavy artillery? We've got you covered.
291
+
292
+ - `createAsyncStore(fetcher)`: Atomic async state management.
293
+ - `StorageAdapters`: High-level interfaces for any storage engine.
294
+ - `Middleware / IPlugin`: Build your own extensions.
295
+
296
+ ---
297
+
298
+ ## 🛡️ Quality & Testing
299
+
300
+ RGS is built with an obsession for reliability. Our test suite covers multiple layers to ensure zero-regressions:
301
+
302
+ - **Unit Tests (Jest)**: 100+ tests covering core logic, stores, and hooks.
303
+ - **E2E Tests (Playwright)**: Real-world browser testing for cross-tab synchronization and Web Crypto API.
304
+ - **Concurrency Testing**: Verification of race conditions in multi-tab environments.
305
+
306
+ ```bash
307
+ # Run unit tests
308
+ npm run test
309
+
310
+ # Run E2E tests
311
+ npm run test:e2e
312
+ ```
313
+
314
+ ---
315
+
316
+ ## 📄 License
317
+
318
+ MIT © [Dario Passariello](https://github.com/dpassariello)
319
+
320
+ ---
321
+
322
+ **Designed for those who build the future.**
323
+ Made with ❤️ and a lot of caffe' espresso!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biglogic/rgs",
3
- "version": "3.5.1",
3
+ "version": "3.5.2",
4
4
  "description": "Argis (RGS) - Reactive Global State: A react state everywhere made easy",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -49,9 +49,6 @@
49
49
  "npm:pack": "npm run build && cd dist && npm pack",
50
50
  "npm:publish": "npm run build && npm run build:extension && cd dist && npm publish --access=public"
51
51
  },
52
- "dependencies": {
53
- "immer": "^11.1.4"
54
- },
55
52
  "peerDependencies": {
56
53
  "react": ">=16.8.0",
57
54
  "react-dom": ">=16.8.0"
@@ -64,12 +61,15 @@
64
61
  "optional": false
65
62
  }
66
63
  },
64
+ "dependencies": {
65
+ "immer": "^11.1.4"
66
+ },
67
67
  "devDependencies": {
68
+ "memorio": "^2.2.1",
68
69
  "@types/jest": "30.0.0",
69
70
  "@types/node": "^25.3.0",
70
71
  "@types/react": "^19.2.14",
71
72
  "@types/react-dom": "^19.2.3",
72
- "dphelper": "^2.6.4",
73
73
  "esbuild": "^0.27.3",
74
74
  "esbuild-plugin-copy": "^2.1.1",
75
75
  "react": "^19.2.4",
Binary file