@syntropysoft/syntropyfront 0.1.0-alpha.1
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 +322 -0
- package/dist/index.cjs +3357 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +3349 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/package.json +80 -0
package/README.md
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./assets/syntropysoft-logo.png" alt="SyntropyLog Logo" width="170"/>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">SyntropyFront</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>From Chaos to Clarity</strong>
|
|
9
|
+
<br />
|
|
10
|
+
The Observability Framework for High-Performance Teams
|
|
11
|
+
</p>
|
|
12
|
+
<p align="center">
|
|
13
|
+
Advanced frontend tracing and error monitoring with reactive object tracking, worker architecture, and circular reference handling
|
|
14
|
+
<br />
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
## ๐ Features
|
|
18
|
+
|
|
19
|
+
- **๐ Reactive Object Tracking** - Real-time object state tracking using JavaScript Proxies
|
|
20
|
+
- **โก Worker Architecture** - Non-blocking data collection and processing
|
|
21
|
+
- **๐ก๏ธ Circular Reference Handling** - Robust serialization for complex objects
|
|
22
|
+
- **๐ฏ Configuration Presets** - Pre-configured setups for different use cases
|
|
23
|
+
- **๐ฆ Lazy Loading** - Dynamic module loading for optimal bundle size
|
|
24
|
+
- **๐ Framework Agnostic** - Works with any JavaScript framework
|
|
25
|
+
- **๐ Breadcrumb System** - Comprehensive user action tracking
|
|
26
|
+
- **๐ Automatic Retry** - Exponential backoff with persistent buffer
|
|
27
|
+
- **๐ Privacy First** - Granular context collection with opt-in sensitive data
|
|
28
|
+
|
|
29
|
+
## ๐ฆ Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install syntropyfront
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## ๐ฏ Quick Start
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
import { SyntropyFront } from 'syntropyfront';
|
|
39
|
+
|
|
40
|
+
// Initialize with balanced preset
|
|
41
|
+
await SyntropyFront.init({
|
|
42
|
+
preset: 'balanced',
|
|
43
|
+
agent: {
|
|
44
|
+
endpoint: 'https://your-api.com/errors'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Add reactive object tracking
|
|
49
|
+
const userProfile = SyntropyFront.addProxyObject('userProfile', {
|
|
50
|
+
name: 'John Doe',
|
|
51
|
+
preferences: { theme: 'dark' }
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Track user actions automatically
|
|
55
|
+
// Error handling is automatic
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## โ๏ธ Configuration Presets
|
|
59
|
+
|
|
60
|
+
### Safe Preset
|
|
61
|
+
```javascript
|
|
62
|
+
await SyntropyFront.init({
|
|
63
|
+
preset: 'safe',
|
|
64
|
+
agent: { endpoint: 'https://api.com/errors' }
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
- **Use case**: Production environments with privacy concerns
|
|
68
|
+
- **Features**: Errors only, minimal context, no tracking
|
|
69
|
+
- **Bundle size**: ~25KB
|
|
70
|
+
|
|
71
|
+
### Balanced Preset (Default)
|
|
72
|
+
```javascript
|
|
73
|
+
await SyntropyFront.init({
|
|
74
|
+
preset: 'balanced',
|
|
75
|
+
agent: { endpoint: 'https://api.com/errors' }
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
- **Use case**: General production use
|
|
79
|
+
- **Features**: Periodic sending, curated context, moderate tracking
|
|
80
|
+
- **Bundle size**: ~60KB
|
|
81
|
+
|
|
82
|
+
### Debug Preset
|
|
83
|
+
```javascript
|
|
84
|
+
await SyntropyFront.init({
|
|
85
|
+
preset: 'debug',
|
|
86
|
+
agent: { endpoint: 'https://api.com/errors' }
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
- **Use case**: Development and debugging
|
|
90
|
+
- **Features**: Frequent sending, full context, complete tracking
|
|
91
|
+
- **Bundle size**: ~60KB
|
|
92
|
+
|
|
93
|
+
### Performance Preset
|
|
94
|
+
```javascript
|
|
95
|
+
await SyntropyFront.init({
|
|
96
|
+
preset: 'performance',
|
|
97
|
+
agent: { endpoint: 'https://api.com/errors' }
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
- **Use case**: High-performance applications
|
|
101
|
+
- **Features**: Critical errors only, minimal overhead
|
|
102
|
+
- **Bundle size**: ~25KB
|
|
103
|
+
|
|
104
|
+
## ๐ Reactive Object Tracking
|
|
105
|
+
|
|
106
|
+
Track object changes in real-time using JavaScript Proxies:
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
// Add object for tracking
|
|
110
|
+
const userProfile = SyntropyFront.addProxyObject('userProfile', {
|
|
111
|
+
name: 'John Doe',
|
|
112
|
+
preferences: { theme: 'dark' }
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Changes are automatically tracked
|
|
116
|
+
userProfile.name = 'Jane Doe';
|
|
117
|
+
userProfile.preferences.theme = 'light';
|
|
118
|
+
|
|
119
|
+
// Get tracking history
|
|
120
|
+
const history = SyntropyFront.getProxyObjectHistory('userProfile');
|
|
121
|
+
const currentState = SyntropyFront.getProxyObjectState('userProfile');
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## โก Worker Architecture
|
|
125
|
+
|
|
126
|
+
Offload data processing to Web Workers for non-blocking operation:
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
// Worker is automatically used when enabled
|
|
130
|
+
await SyntropyFront.init({
|
|
131
|
+
useWorker: true,
|
|
132
|
+
// ... other config
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Check worker status
|
|
136
|
+
const isAvailable = SyntropyFront.isWorkerAvailable();
|
|
137
|
+
const status = SyntropyFront.getWorkerStatus();
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## ๐ก๏ธ Circular Reference Handling
|
|
141
|
+
|
|
142
|
+
Safely serialize complex objects with circular references:
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
// Create circular reference
|
|
146
|
+
const obj = { name: 'test' };
|
|
147
|
+
obj.self = obj;
|
|
148
|
+
|
|
149
|
+
// SyntropyFront handles this automatically
|
|
150
|
+
SyntropyFront.sendError(new Error('Test'), { context: obj });
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## ๐ Breadcrumb System
|
|
154
|
+
|
|
155
|
+
Track user actions and application events:
|
|
156
|
+
|
|
157
|
+
```javascript
|
|
158
|
+
// Add custom breadcrumbs
|
|
159
|
+
SyntropyFront.addBreadcrumb('user', 'User clicked button', {
|
|
160
|
+
buttonId: 'submit',
|
|
161
|
+
timestamp: Date.now()
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// Get breadcrumbs
|
|
165
|
+
const breadcrumbs = SyntropyFront.getBreadcrumbs();
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## ๐ Framework Integration
|
|
169
|
+
|
|
170
|
+
### React
|
|
171
|
+
```javascript
|
|
172
|
+
// In your main App component
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
SyntropyFront.init({
|
|
175
|
+
preset: 'balanced',
|
|
176
|
+
agent: { endpoint: 'https://api.com/errors' }
|
|
177
|
+
});
|
|
178
|
+
}, []);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Vue
|
|
182
|
+
```javascript
|
|
183
|
+
// In your main.js
|
|
184
|
+
import { createApp } from 'vue';
|
|
185
|
+
import App from './App.vue';
|
|
186
|
+
|
|
187
|
+
const app = createApp(App);
|
|
188
|
+
|
|
189
|
+
// Initialize SyntropyFront
|
|
190
|
+
SyntropyFront.init({
|
|
191
|
+
preset: 'balanced',
|
|
192
|
+
agent: { endpoint: 'https://api.com/errors' }
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
app.mount('#app');
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Angular
|
|
199
|
+
```typescript
|
|
200
|
+
// In your main.ts
|
|
201
|
+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
202
|
+
import { AppModule } from './app/app.module';
|
|
203
|
+
|
|
204
|
+
// Initialize SyntropyFront
|
|
205
|
+
SyntropyFront.init({
|
|
206
|
+
preset: 'balanced',
|
|
207
|
+
agent: { endpoint: 'https://api.com/errors' }
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
platformBrowserDynamic().bootstrapModule(AppModule);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## ๐ API Reference
|
|
214
|
+
|
|
215
|
+
### Core Methods
|
|
216
|
+
|
|
217
|
+
#### `SyntropyFront.init(config)`
|
|
218
|
+
Initialize SyntropyFront with configuration.
|
|
219
|
+
|
|
220
|
+
#### `SyntropyFront.addProxyObject(name, object, options)`
|
|
221
|
+
Add an object for reactive tracking.
|
|
222
|
+
|
|
223
|
+
#### `SyntropyFront.getProxyObjectHistory(name)`
|
|
224
|
+
Get the change history of a tracked object.
|
|
225
|
+
|
|
226
|
+
#### `SyntropyFront.addBreadcrumb(type, message, data)`
|
|
227
|
+
Add a breadcrumb entry.
|
|
228
|
+
|
|
229
|
+
#### `SyntropyFront.sendError(error, context)`
|
|
230
|
+
Send an error with context to the backend.
|
|
231
|
+
|
|
232
|
+
### Configuration Options
|
|
233
|
+
|
|
234
|
+
```javascript
|
|
235
|
+
{
|
|
236
|
+
preset: 'balanced', // 'safe' | 'balanced' | 'debug' | 'performance'
|
|
237
|
+
agent: {
|
|
238
|
+
endpoint: 'https://api.com/errors',
|
|
239
|
+
batchTimeout: 10000,
|
|
240
|
+
batchSize: 20,
|
|
241
|
+
maxRetries: 3,
|
|
242
|
+
usePersistentBuffer: true
|
|
243
|
+
},
|
|
244
|
+
proxyTracking: {
|
|
245
|
+
enabled: true,
|
|
246
|
+
maxStates: 10,
|
|
247
|
+
trackNested: true,
|
|
248
|
+
trackArrays: true
|
|
249
|
+
},
|
|
250
|
+
useWorker: true,
|
|
251
|
+
maxBreadcrumbs: 50,
|
|
252
|
+
context: {
|
|
253
|
+
device: true,
|
|
254
|
+
window: true,
|
|
255
|
+
session: true,
|
|
256
|
+
ui: true,
|
|
257
|
+
network: true
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## ๐งช Testing
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Run tests
|
|
266
|
+
npm test
|
|
267
|
+
|
|
268
|
+
# Run tests in watch mode
|
|
269
|
+
npm run test:watch
|
|
270
|
+
|
|
271
|
+
# Run tests with coverage
|
|
272
|
+
npm run test:coverage
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## ๐๏ธ Development
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Install dependencies
|
|
279
|
+
npm install
|
|
280
|
+
|
|
281
|
+
# Build the package
|
|
282
|
+
npm run build
|
|
283
|
+
|
|
284
|
+
# Build in watch mode
|
|
285
|
+
npm run dev
|
|
286
|
+
|
|
287
|
+
# Lint code
|
|
288
|
+
npm run lint
|
|
289
|
+
|
|
290
|
+
# Fix linting issues
|
|
291
|
+
npm run lint:fix
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## ๐ฆ Build Outputs
|
|
295
|
+
|
|
296
|
+
The build process generates multiple formats:
|
|
297
|
+
|
|
298
|
+
- **ESM** (`dist/index.js`) - Modern ES modules
|
|
299
|
+
- **CommonJS** (`dist/index.cjs`) - Node.js compatibility
|
|
300
|
+
- **IIFE** (`dist/index.min.js`) - Browser-ready minified bundle
|
|
301
|
+
|
|
302
|
+
## ๐ค Contributing
|
|
303
|
+
|
|
304
|
+
1. Fork the repository
|
|
305
|
+
2. Create a feature branch
|
|
306
|
+
3. Make your changes
|
|
307
|
+
4. Add tests
|
|
308
|
+
5. Submit a pull request
|
|
309
|
+
|
|
310
|
+
## ๐ License
|
|
311
|
+
|
|
312
|
+
Apache 2.0 - see [LICENSE](LICENSE) file for details.
|
|
313
|
+
|
|
314
|
+
## ๐ Support
|
|
315
|
+
|
|
316
|
+
- ๐ [Documentation](https://github.com/Syntropysoft/syntropyfront)
|
|
317
|
+
- ๐ [Issues](https://github.com/Syntropysoft/syntropyfront/issues)
|
|
318
|
+
- ๐ฌ [Discussions](https://github.com/Syntropysoft/syntropyfront/discussions)
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
Made with โค๏ธ by the SyntropyLog Team
|