@biglogic/rgs 3.8.0 → 3.8.4

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.
@@ -1,190 +0,0 @@
1
- # 🔌 Chapter 5: Ecosystem and Plugins - Become a Power User
2
-
3
- RGS is not a closed box. It's a modular engine that you can extend to cover every business need. All plugins are designed to be "Plug & Play".
4
-
5
- ## 🔌 Available Plugins
6
-
7
- RGS includes 11 official plugins:
8
-
9
- | Plugin | Purpose | Import |
10
- |--------|---------|--------|
11
- | `devToolsPlugin` | Redux DevTools integration | `rgs` |
12
- | `debugPlugin` | Console debug access (DEV only) | `rgs` |
13
- | `indexedDBPlugin` | GB-scale Local Storage | `rgs/advanced` |
14
- | `cloudSyncPlugin` | Remote Cloud Backup/Sync | `rgs/advanced` |
15
- | `syncPlugin` | Cross-tab synchronization | `rgs/advanced` |
16
- | `immerPlugin` | Immer for mutable-style updates | `rgs` |
17
- | `snapshotPlugin` | Save/restore state snapshots | `rgs` |
18
- | `undoRedoPlugin` | History management | `rgs` |
19
- | `schemaPlugin` | Schema validation | `rgs` |
20
- | `guardPlugin` | Pre-set value transformation | `rgs` |
21
- | `analyticsPlugin` | Track state changes | `rgs` |
22
-
23
- ## 🔎 1. DevTools: See Under the Hood
24
-
25
- Import the official plugin and you'll see every state change, transaction, and execution time in the console or dev tools (Redux DevTools support included!).
26
-
27
- ```typescript
28
- import { devToolsPlugin } from '@biglogic/rgs';
29
-
30
- store._addPlugin(devToolsPlugin({ name: 'My Store' }));
31
- ```
32
-
33
- ## 🐛 2. Debug: Console Access (DEV ONLY)
34
-
35
- ⚠️ **FOR DEVELOPMENT ONLY** - This plugin is automatically disabled in production.
36
-
37
- Access your store directly from the browser console:
38
-
39
- ```typescript
40
- import { debugPlugin } from '@biglogic/rgs';
41
-
42
- // Always wrap in dev check
43
- if (process.env.NODE_ENV === 'development') {
44
- store._addPlugin(debugPlugin())
45
- }
46
- ```
47
-
48
- Then in the browser console:
49
- ```javascript
50
- gstate.list() // View all state
51
- gstate.get('key') // Get a value
52
- gstate.set('key', val) // Set a value
53
- gstate.info() // Store info
54
- gstate.banner() // Show help
55
- ```
56
-
57
- ## 2. Cross-Tab Sync: Multi-Tab Magic
58
-
59
- Have your app open in three browser tabs? With the `syncPlugin`, if a user changes the theme in one tab, all other tabs update instantly. **Without hitting the server.**
60
-
61
- ```typescript
62
- import { syncPlugin } from 'rgs/advanced';
63
-
64
- store._addPlugin(syncPlugin({ channelName: 'my_app_sync' }));
65
- ```
66
-
67
- ## 🔐 3. Encode Option: Base64 Encoding
68
-
69
- Use the `encoded` option for simple base64 encoding (not encryption, just obfuscation):
70
-
71
- ```typescript
72
- // Per-value encoding
73
- store.set('token', 'secret-value', { persist: true, encoded: true })
74
-
75
- // Or global encoding for all persisted values
76
- const store = initState({ encoded: true })
77
- ```
78
-
79
- > **Note:** Use `encryptionKey` with AES-256-GCM for real security. The `encoded` option is just simple obfuscation.
80
-
81
- ## 🕐 4. TTL (Time To Live): Expiring Data
82
-
83
- Use the `ttl` option in persist to make data expire automatically:
84
-
85
- ```typescript
86
- store.set('session_token', tokenValue, {
87
- persist: true,
88
- ttl: 3600000 // Expires in 1 hour
89
- });
90
- ```
91
-
92
- ## 🎲 5. Undo/Redo: History Management
93
-
94
- ```typescript
95
- import { undoRedoPlugin } from '@biglogic/rgs';
96
-
97
- store._addPlugin(undoRedoPlugin({ limit: 50 }));
98
-
99
- // Later...
100
- store.undo();
101
- store.redo();
102
- store.canUndo(); // boolean
103
- store.canRedo(); // boolean
104
- ```
105
-
106
- ## 📸 6. Snapshots: Save & Restore State
107
-
108
- ```typescript
109
- import { snapshotPlugin } from '@biglogic/rgs';
110
-
111
- store._addPlugin(snapshotPlugin());
112
-
113
- // Save current state
114
- store.takeSnapshot('backup_1');
115
-
116
- // Restore
117
- store.restoreSnapshot('backup_1');
118
-
119
- // List all snapshots
120
- store.listSnapshots(); // ['backup_1', ...]
121
-
122
- // Delete
123
- store.deleteSnapshot('backup_1');
124
- store.clearSnapshots();
125
- ```
126
-
127
- ## 🛡️ 7. Guard: Pre-Set Transformation
128
-
129
- Transform values before they hit the store:
130
-
131
- ```typescript
132
- import { guardPlugin } from '@biglogic/rgs';
133
-
134
- store._addPlugin(guardPlugin({
135
- 'user_input': (val) => val.trim().toLowerCase()
136
- }));
137
- ```
138
-
139
- ## ✅ 8. Schema: Validation
140
-
141
- Validate values before setting:
142
-
143
- ```typescript
144
- import { schemaPlugin } from '@biglogic/rgs';
145
-
146
- store._addPlugin(schemaPlugin({
147
- 'email': (val) => {
148
- if (typeof val !== 'string') return 'Must be a string';
149
- return val.includes('@') ? true : 'Invalid email';
150
- }
151
- }));
152
- ```
153
-
154
- ## 📊 9. Analytics: Track Changes
155
-
156
- ```typescript
157
- import { analyticsPlugin } from '@biglogic/rgs';
158
-
159
- store._addPlugin(analyticsPlugin({
160
- provider: (event) => {
161
- console.log('State changed:', event);
162
- // Send to analytics service
163
- },
164
- keys: ['user', 'cart'] // Only track these keys
165
- }));
166
- ```
167
-
168
- ## 🔄 10. Immer Integration
169
-
170
- ```typescript
171
- import { immerPlugin } from '@biglogic/rgs';
172
-
173
- store._addPlugin(immerPlugin());
174
-
175
- // Update nested state with Immer
176
- store.setWithProduce('user', (draft) => {
177
- draft.name = 'New Name';
178
- draft.address.city = 'New City';
179
- });
180
- ```
181
-
182
- ---
183
-
184
- ## 💡 A Word of Wisdom for Easy & Advanced Scenarios
185
-
186
- Plugins are used to **abstract the boring logic**. If you find yourself writing the same `useEffect` to sync two things in 5 different parts of your app... **Stop.** Create a plugin or use an existing one.
187
-
188
- The best code is the code you write once and forget about.
189
-
190
- **Next step:** [Case Studies: Real-World Production Strategies](06-case-studies.md)
package/docs/qa.md DELETED
@@ -1,47 +0,0 @@
1
- # 🚀 QA Release Checklist: Massive Change
2
-
3
- > **Release ID:** [Insert ID]
4
- > **Date:** 2026-02-19
5
- > **QA Lead:** [Name]
6
-
7
- ---
8
-
9
- ### 1. 🔍 Impact Analysis & Setup
10
- - [ ] **Traceability Matrix:** Mapping new requirements to existing test cases.
11
- - [ ] **Impact Analysis:** Identifying "High-Risk" modules (e.g., DB, API, Payment Gateway).
12
- - [ ] **Staging Environment:** Verify alignment of config/data with Production.
13
- - [ ] **Smoke Test Suite:** Selection of 10-15 fundamental tests to validate build stability.
14
-
15
- ### 2. 🛡️ Regression & Functional Testing
16
- - [ ] **Critical Regression:** Execution of automated tests on core flows (Business Critical).
17
- - [ ] **New Features:** Detailed validation according to acceptance criteria (AC).
18
- - [ ] **Edge Cases:** Testing on invalid inputs and boundary scenarios.
19
- - [ ] **Compatibility:** Testing on Browsers (Chrome, Safari, Firefox) and Mobile (iOS, Android).
20
-
21
- ### 3. ⚙️ Technical Integrity & Performance
22
- - [ ] **Data Migration:** Verify that DB changes haven't corrupted existing records.
23
- - [ ] **API Contracts:** Verify that endpoints haven't introduced breaking changes.
24
- - [ ] **Performance Baseline:** Check response times compared to the previous version.
25
- - [ ] **Security Scan:** Basic check on permissions and OWASP vulnerabilities.
26
-
27
- ### 4. 🏁 Release Readiness (Go/No-Go)
28
- - [ ] **UAT Sign-off:** Final approval from stakeholders.
29
- - [ ] **Rollback Plan:** Documented and ready recovery procedure.
30
- - [ ] **Feature Flags:** Verify that toggles are correctly configured on [LaunchDarkly](https://launchdarkly.com) or similar.
31
- - [ ] **Monitoring:** [Sentry](https://sentry.io) or [Datadog](https://www.datadoghq.com) dashboards ready for post-live monitoring.
32
-
33
- ---
34
-
35
- ### 📊 Execution Report
36
-
37
-
38
- | Category | Total Tests | Passed | Failed | Blockers |
39
- | :--- | :---: | :---: | :---: | :---: |
40
- | **Smoke Test** | 0 | 0 | 0 | 0 |
41
- | **Regression** | 0 | 0 | 0 | 0 |
42
- | **New Features**| 0 | 0 | 0 | 0 |
43
-
44
- ---
45
-
46
- **Final Notes:**
47
- *Add any critical bugs found or observations on stability here.*
File without changes