@syntropysoft/syntropyfront 0.4.6 → 0.4.8

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/CHANGELOG.md ADDED
@@ -0,0 +1,473 @@
1
+ ## [0.4.8] - 2026-03-01
2
+
3
+ ### Added
4
+ - **Examples**: Single shared stylesheet `examples/examples.css` for all pure HTML demos.
5
+ - **README (main)**: Examples section with table linking to examples/README.md, basic-usage.html, HTML demos, react-example, vue-example, svelte-example.
6
+
7
+ ### Changed
8
+ - **Keywords (package.json)**: Tuned for accuracy (e.g. production-errors, lightweight, zero-dependencies); removed performance-monitoring / web-performance (not a full APM).
9
+ - **README**: Reorganized for clarity—what it does, why use it, Quick Start, API table, PII/config summary, short Design, Quality, Contributing. Honest impact, no overclaim.
10
+ - **SECURITY.md**: Added **Network access** section (data sent only to your endpoint or callback).
11
+ - **Examples (HTML)**: All pure HTML demos now load the IIFE bundle (`dist/index.min.js`) so they work when opened via file:// after `pnpm run build`. Demos updated to current API (`configure`, `getStats`, no `init`/presets). Worker/Proxy/Presets demos simplified or stubbed where the API is not in the current build.
12
+ - **examples/README.md**: Documents basic-usage, other HTML demos, React/Vue/Svelte with run commands; notes shared CSS and build requirement.
13
+
14
+ ---
15
+
16
+ ## [0.4.7] - 2026-03-01
17
+
18
+ ### Changed
19
+ - **Package**: Include `CHANGELOG.md` in published `files` (Socket.dev / maintainability).
20
+ - **README**: Coverage badge and Quality Metrics set to 87%; "future version" wording for 0.5.0; explicit **Network access** note (data only to configured endpoint).
21
+
22
+ ---
23
+
24
+ ## [0.4.6] - 2026-03-01
25
+
26
+ ### Fixed
27
+ - **ClickInterceptor**: Removed invalid CSS selector `[@click]` that caused `closest()` to throw in the browser. Wrapped `closest()` in try/catch so invalid selectors (e.g. from cached bundles) fall back to cursor:pointer detection instead of breaking the app.
28
+
29
+ ---
30
+
31
+ ## [0.4.5] - 2026-03-01
32
+
33
+ ### Added
34
+ - **Architecture review**: `docs/ARCHITECTURE_REVIEW.md` (internal analysis in Spanish).
35
+ - **DIP & refactor**: Injected deps in SerializationManager and PersistentBufferManager; RobustSerializer split into pure shape/restore helpers; JSDoc contracts on Agent, QueueManager, RetryManager, HttpTransport.
36
+ - **New modules**: DataMaskingManager, Environment, FunctionWrapper; ClickInterceptor, FetchInterceptor, ErrorInterceptor.
37
+
38
+ ### Fixed
39
+ - **RetryManager**: `scheduleRetry` now passes send/remove callbacks so automatic retries persist correctly.
40
+ - **BreadcrumbStore**: Decoupled from Agent via `onBreadcrumbAdded`; facade wires batchTimeout.
41
+ - **RobustSerializer**: ESLint compliance (no-magic-numbers, complexity ≤10, max-len); guard for `makeSerializable(null|undefined)`; DataMaskingManager ANSI regex (intentional control char) with eslint-disable.
42
+ - **CI**: Lint errors resolved (indent and rules); tests updated for English messages and behaviour.
43
+
44
+ ### Changed
45
+ - **Codebase**: All source comments, JSDoc, console messages and error strings in English.
46
+ - **Tests**: Behaviour-focused assertions; expectations aligned with refactor and i18n.
47
+
48
+ ---
49
+
50
+ ## [0.4.4] - 2026-03-01
51
+
52
+ ### Added
53
+ - **Community Health**: Added `CONTRIBUTING.md`, `SECURITY.md`, and `CODE_OF_CONDUCT.md` to establish community standards and security disclosure policies.
54
+ - **Project Configuration**: Added `.editorconfig` for consistent development environment.
55
+
56
+ ### Changed
57
+ - **Package Metadata**: Updated `package.json` to include new community documentation files in the published package.
58
+
59
+ ## [0.4.3] - 2026-03-01
60
+
61
+ ### Added
62
+ - **Legal Compliance**: Standardized `LICENSE` file with official Apache-2.0 verbatim text and added official `NOTICE` file.
63
+ - **Improved CJS Support**: Fixed `exports` mapping in `package.json` to correctly point to `dist/index.cjs`.
64
+
65
+ ## [0.4.2] - 2026-03-01
66
+
67
+ ### Added
68
+ - **TypeScript Support**: Added comprehensive type definitions (`index.d.ts`) for native autocompletion and better developer experience.
69
+
70
+ ### Fixed
71
+ - **Supply Chain Security**: Preliminary fix for `LICENSE` placeholders and standardized internal scripts to use `pnpm`.
72
+ - **Package Metadata**: Fixed missing type declarations in the distributed bundle.
73
+
74
+ ## [0.4.1] - 2026-03-01
75
+
76
+ ### Fixed
77
+ - **Security Vulnerabilities**: Resolved high-severity RCE and ReDoS vulnerabilities in devDependencies (`serialize-javascript`, `ajv`, `tmp`).
78
+ - **Dependency Overrides**: Forced `serialize-javascript@7.0.3` to ensure a secure build environment.
79
+
80
+ ### Changed
81
+ - **Node.js Engine**: Upgraded minimum required version to **Node >=20.0.0** to support secure dependency requirements (WebCrypto) natively.
82
+
83
+ ## [0.4.0] - 2026-03-01
84
+
85
+ ### Added
86
+ - **Modular Architecture (Facade)**: Refactored the main entry point to delegate responsibilities to specialized components (`Agent`, `Interceptors`).
87
+ - **Automatic Resilience**: The system now automatically recovers and retries sending failed data from previous sessions stored in IndexedDB upon initialization.
88
+ - **Event Throttling**: Implemented a 500ms throttle for click capture to reduce event noise.
89
+ - **Smart Click Filtering**: Only captures clicks on interactive elements (buttons, links, etc.), significantly improving breadcrumb quality.
90
+
91
+ ### Changed
92
+ - Removed the `flatted` external dependency in favor of our own `RobustSerializer`.
93
+ - Improved global error capture robustness using the Chaining Pattern.
94
+
95
+ ## [0.3.0] - 2024-12-19
96
+
97
+ ### 🚀 **Major Performance & Bundle Optimizations**
98
+
99
+ #### **Dependency Cleanup & Bundle Size Reduction**
100
+ - **Massive Dependency Reduction**: Removed 45+ unnecessary packages
101
+ - **Eliminated Unused Dependencies**: Removed `@stryker-mutator/vitest-runner` (using Jest only)
102
+ - **Streamlined Stryker Setup**: Kept only essential packages (`core` and `jest-runner`)
103
+ - **Bundle Size Optimization**: Significantly reduced final bundle size
104
+ - **Faster Installation**: Reduced npm install time and disk usage
105
+
106
+ #### **CI/CD & Dependabot Improvements**
107
+ - **Smart Dependabot Configuration**: Added selective ignore for Stryker packages
108
+ - **Prevented Incompatible Updates**: Dependabot no longer suggests Node.js >=20 incompatible updates
109
+ - **Maintained Compatibility**: Full Node.js 18, 20, 22 compatibility preserved
110
+ - **Stable CI Pipeline**: Eliminated CI failures from incompatible dependency updates
111
+ - **Consistent Workflow Matrix**: All workflows now use consistent Node.js version testing
112
+
113
+ #### **Development Experience Enhancements**
114
+ - **Cleaner Package Structure**: Only 1 runtime dependency (`flatted` for serialization)
115
+ - **Optimized DevDependencies**: All testing tools properly categorized
116
+ - **Faster Development**: Reduced cognitive load and setup complexity
117
+ - **Better Maintenance**: Easier to maintain and update dependencies
118
+
119
+ ### 🔧 **Technical Improvements**
120
+
121
+ #### **Dependency Management**
122
+ - **Runtime Dependencies**: Reduced from multiple to just 1 essential dependency
123
+ - **DevDependencies**: Properly categorized all development tools
124
+ - **Package Lock**: Optimized and cleaned up dependency tree
125
+ - **Security**: Maintained all security benefits while reducing complexity
126
+
127
+ #### **Testing Infrastructure**
128
+ - **Mutation Testing**: Maintained full Stryker functionality with Jest
129
+ - **Test Coverage**: All 485 tests continue to pass
130
+ - **CI Stability**: Eliminated flaky CI builds from dependency conflicts
131
+ - **Cross-Node Testing**: Full compatibility across Node.js 18, 20, 22
132
+
133
+ ### 🎯 **No Breaking Changes**
134
+ - **Public API**: All public APIs remain unchanged
135
+ - **Configuration**: Existing configurations continue to work
136
+ - **Migration**: No migration required for existing users
137
+ - **Functionality**: All features work exactly as before
138
+
139
+ ### 📦 **Installation & Usage**
140
+ - **Faster Installation**: Reduced package size and dependencies
141
+ - **Better Performance**: Optimized bundle size for production
142
+ - **Same API**: Identical usage patterns and configuration options
143
+
144
+ ---
145
+
146
+ ## [0.2.4] - 2024-08-02
147
+
148
+ ### 🎨 **UI/UX Improvements**
149
+
150
+ #### **Vue Example Simplification**
151
+ - **Complete UI Overhaul**: Simplified Vue example from 447 lines to clean, modern design
152
+ - **Official Vue Branding**: Implemented official Vue.js colors (#42b883, #35495e, #42d392)
153
+ - **Architecture Fix**: Replaced hardcoded HTML with proper Vite + Vue SFC architecture
154
+ - **Code Reduction**: Eliminated 535+ lines of unnecessary complexity
155
+ - **Modern Design**: Clean, professional UI matching React example simplicity
156
+
157
+ #### **Example Improvements**
158
+ - **Simplified Documentation**: Removed verbose explanations, kept essential information
159
+ - **Better UX**: Improved button layouts and responsive design
160
+ - **Consistent Branding**: Unified color scheme across all examples
161
+ - **Maintained Functionality**: All SyntropyFront features work perfectly
162
+
163
+ ### 🔧 **Infrastructure & Compatibility**
164
+
165
+ #### **GitHub Actions Updates**
166
+ - **Deprecation Fixes**: Updated all deprecated GitHub Actions to latest versions
167
+ - **Actions Updated**:
168
+ - `actions/upload-artifact@v3` → `@v4`
169
+ - `codecov/codecov-action@v3` → `@v4`
170
+ - **CI/CD Compatibility**: Ensured compatibility with latest GitHub Actions runner (2.327.1)
171
+ - **Workflow Files Updated**:
172
+ - `.github/workflows/test.yml`
173
+ - `.github/workflows/mutation-test.yml`
174
+ - `.github/workflows/ci.yml`
175
+ - `.github/workflows/quality.yml`
176
+
177
+ #### **Node.js Compatibility**
178
+ - **Multi-Node Support**: Full compatibility with Node 18, 20, and 22
179
+ - **ESLint Configuration**: Fixed Node 20+ ES modules compatibility
180
+ - Renamed `.eslintrc.js` → `.eslintrc.cjs`
181
+ - Removed conflicting `.eslintrc.json`
182
+ - **Test Timing Fixes**: Resolved timing-sensitive test failures in Node 22
183
+ - Increased timing tolerance from 1ms to 50-100ms
184
+ - Fixed exponential backoff delay tests
185
+ - Maintained test accuracy while improving compatibility
186
+
187
+ #### **Code Quality Improvements**
188
+ - **Indentation Fixes**: Fixed 2106+ indentation errors with `eslint --fix`
189
+ - **Error Reduction**: Reduced from 2202 problems to 95 warnings only
190
+ - **Consistent Formatting**: Standardized 2-space indentation across codebase
191
+ - **Linting Compliance**: 100% ESLint compliance with modern standards
192
+
193
+ ### 🧪 **Testing Enhancements**
194
+
195
+ #### **Test Compatibility**
196
+ - **Cross-Node Testing**: All 484 tests pass in Node 18, 20, and 22
197
+ - **Timing Tolerance**: Improved test reliability across different Node versions
198
+ - **Test Files Updated**:
199
+ - `tests/retryManager.test.js` - Fixed timing-sensitive tests
200
+ - `tests/agent.test.js` - Improved retry delay assertions
201
+ - **Test Results**: 484 passed, 1 skipped (by design), 0 failed
202
+
203
+ #### **CI/CD Pipeline**
204
+ - **Automated Testing**: GitHub Actions now work seamlessly across all Node versions
205
+ - **Quality Gates**: Maintained high test coverage and mutation scores
206
+ - **Artifact Management**: Updated artifact upload/download processes
207
+
208
+ ### 🚀 **Developer Experience**
209
+
210
+ #### **Simplified Development**
211
+ - **Clean Examples**: Developers can now focus on functionality, not complexity
212
+ - **Modern Tooling**: Updated to latest stable versions of all tools
213
+ - **Better Documentation**: Clearer, more focused examples
214
+ - **Faster Setup**: Reduced cognitive load for new developers
215
+
216
+ #### **Maintenance Improvements**
217
+ - **Reduced Complexity**: Eliminated unnecessary code and configurations
218
+ - **Better Organization**: Cleaner file structure and naming conventions
219
+ - **Future-Proof**: Ready for upcoming Node.js and tooling updates
220
+
221
+ ### 🐛 **Bug Fixes**
222
+ - **ESLint Configuration Conflicts**: Resolved multiple ESLint config file conflicts
223
+ - **Node 22 Timing Issues**: Fixed test failures due to precise timing in Node 22
224
+ - **GitHub Actions Deprecation**: Eliminated deprecation warnings in CI/CD
225
+ - **Import Path Issues**: Fixed module resolution in different Node versions
226
+
227
+ ### 📦 **Dependencies & Tools**
228
+ - **Updated Actions**: Latest GitHub Actions for better security and performance
229
+ - **Node Compatibility**: Full support for current and future Node.js versions
230
+ - **Build Tools**: Improved compatibility with modern development environments
231
+
232
+ ### 🎯 **No Breaking Changes**
233
+ - **Public API**: All public APIs remain unchanged
234
+ - **Configuration**: Existing configurations continue to work
235
+ - **Migration**: No migration required for existing users
236
+
237
+ ---
238
+
239
+ ## [0.2.3] - 2024-08-02
240
+
241
+ ### 🎉 Major Refactoring & Architecture Improvements
242
+
243
+ #### 🏗️ **Architecture Overhaul**
244
+ - **Complete SRP Refactoring**: Broke down monolithic classes into focused, single-responsibility components
245
+ - **Modular Structure**: Reorganized codebase into logical folders for better maintainability
246
+ - **Dependency Injection**: Implemented proper dependency injection patterns throughout the codebase
247
+
248
+ #### 📁 **New Folder Structure**
249
+ ```
250
+ src/core/
251
+ ├── agent/ # Core Agent components
252
+ ├── database/ # IndexedDB management
253
+ ├── retry/ # Retry system
254
+ ├── persistent/ # Persistent buffer
255
+ ├── breadcrumbs/ # Event tracking
256
+ ├── context/ # Context collection
257
+ └── utils/ # Utilities
258
+ ```
259
+
260
+ #### 🔧 **Component Refactoring**
261
+
262
+ ##### **Agent.js** → Coordinator Pattern
263
+ - **Before**: Monolithic class handling configuration, queuing, HTTP, retries, and persistence
264
+ - **After**: Coordinator that delegates to specialized managers
265
+ - **New Components**:
266
+ - `ConfigurationManager.js` - Configuration handling
267
+ - `QueueManager.js` - Batching and queuing logic
268
+ - `HttpTransport.js` - HTTP communication
269
+ - `RetryManager.js` - Retry coordination
270
+ - `PersistentBufferManager.js` - Buffer management
271
+
272
+ ##### **DatabaseManager.js** → Specialized Managers
273
+ - **Before**: Single class handling connection, configuration, and transactions
274
+ - **After**: Coordinator with specialized managers
275
+ - **New Components**:
276
+ - `DatabaseConfigManager.js` - Configuration and validation
277
+ - `DatabaseConnectionManager.js` - Connection lifecycle
278
+ - `DatabaseTransactionManager.js` - Transaction management
279
+
280
+ ##### **StorageManager.js** → Pure CRUD + Serialization
281
+ - **Before**: Mixed CRUD operations with serialization logic
282
+ - **After**: Pure CRUD operations with separate serialization manager
283
+ - **New Component**: `SerializationManager.js` - Declarative serialization with error handling
284
+
285
+ ##### **PersistentBufferManager.js** → Coordinator Pattern
286
+ - **Before**: Direct IndexedDB operations
287
+ - **After**: Coordinator delegating to specialized components
288
+ - **New Component**: `RetryLogicManager.js` - Retry logic and cleanup
289
+
290
+ #### 🧪 **Testing Improvements**
291
+
292
+ ##### **Comprehensive Test Suite**
293
+ - **Total Tests**: 484 tests (1 skipped)
294
+ - **Test Coverage**: 92.22% (up from ~80%)
295
+ - **Mutation Score**: 77.60% (up from 68.55%)
296
+ - **New Test Files**: 15+ new test files for refactored components
297
+
298
+ ##### **Test Organization**
299
+ - **Component-Specific Tests**: Each new component has dedicated test file
300
+ - **Mock Improvements**: Better mocking strategies for IndexedDB and HTTP
301
+ - **Timeout Optimization**: Reduced test timeouts for faster execution (500ms vs 5000ms)
302
+
303
+ #### 🚀 **Performance Optimizations**
304
+
305
+ ##### **Timeout Optimizations**
306
+ - **Test Timeouts**: Reduced from 5000ms to 500ms
307
+ - **Batch Timeouts**: Reduced from 1000ms to 500ms
308
+ - **Stryker Timeouts**: Optimized for faster mutation testing
309
+ - **Build Speed**: Improved compilation time (153ms vs ~200ms)
310
+
311
+ ##### **Memory & Processing**
312
+ - **Queue Management**: Optimized batching and flushing logic
313
+ - **Retry System**: Improved exponential backoff implementation
314
+ - **Serialization**: More efficient circular reference handling
315
+
316
+ #### 🔍 **Quality Assurance**
317
+
318
+ ##### **Mutation Testing Results**
319
+ - **Overall Score**: 77.60% (excellent)
320
+ - **Perfect Scores (100%)**:
321
+ - `ConfigurationManager.js`
322
+ - `BreadcrumbManager.js`
323
+ - `BreadcrumbStore.js`
324
+ - `SerializationManager.js`
325
+ - `DatabaseTransactionManager.js`
326
+ - `ErrorManager.js`
327
+ - `Logger.js`
328
+
329
+ ##### **Code Quality Metrics**
330
+ - **Statements**: 92.22% covered
331
+ - **Branches**: 87.94% covered
332
+ - **Functions**: 92.24% covered
333
+ - **Lines**: 92.35% covered
334
+
335
+ #### 🛠️ **Developer Experience**
336
+
337
+ ##### **CI/CD Pipeline**
338
+ - **GitHub Actions**: Automated testing, linting, and mutation testing
339
+ - **Quality Gates**: Automated PR comments with coverage and mutation scores
340
+ - **Artifact Uploads**: Test reports and coverage data
341
+ - **Auto-Issues**: Automatic issue creation for low mutation scores
342
+
343
+ ##### **Code Quality Tools**
344
+ - **ESLint**: Comprehensive linting rules
345
+ - **Jest**: Optimized test configuration
346
+ - **Stryker**: Mutation testing with quick and full configurations
347
+ - **Codecov**: Coverage reporting and visualization
348
+
349
+ #### 📦 **Infrastructure**
350
+
351
+ ##### **Build System**
352
+ - **Rollup**: Optimized bundling configuration
353
+ - **Multiple Formats**: ES modules, CommonJS, and minified versions
354
+ - **Tree Shaking**: Improved dead code elimination
355
+
356
+ ##### **Package Management**
357
+ - **Removed NPM Release Script**: Cleaner package.json
358
+ - **Updated Dependencies**: Latest stable versions
359
+ - **Type Module**: Proper ES module configuration
360
+
361
+ #### 🔧 **Configuration & Scripts**
362
+
363
+ ##### **New NPM Scripts**
364
+ ```json
365
+ {
366
+ "test": "jest",
367
+ "test:coverage": "jest --config jest.config.coverage.cjs",
368
+ "test:mutation": "stryker run",
369
+ "test:mutation:quick": "stryker run stryker.quick.conf.json",
370
+ "lint": "eslint src --ext .js",
371
+ "lint:fix": "eslint src --ext .js --fix"
372
+ }
373
+ ```
374
+
375
+ ##### **Configuration Files**
376
+ - **Jest Configs**: Separate configs for tests and coverage
377
+ - **Stryker Configs**: Quick and full mutation testing configs
378
+ - **ESLint Config**: Comprehensive code quality rules
379
+
380
+ #### 🐛 **Bug Fixes**
381
+ - **Import Path Issues**: Fixed all import paths after refactoring
382
+ - **Test Mocking**: Improved IndexedDB and HTTP mocking
383
+ - **Timeout Issues**: Resolved test timing problems
384
+ - **Circular Dependencies**: Eliminated circular import issues
385
+
386
+ #### 📚 **Documentation**
387
+ - **Updated README**: New architecture section and updated metrics
388
+ - **API Documentation**: Improved method documentation
389
+ - **Examples**: Enhanced usage examples
390
+ - **Changelog**: Comprehensive change tracking
391
+
392
+ ### 🎯 **Breaking Changes**
393
+ - **Import Paths**: Updated import paths for refactored components
394
+ - **Configuration**: Some internal configuration methods changed
395
+ - **API**: Public API remains stable, internal structure improved
396
+
397
+ ### 🚀 **Migration Guide**
398
+ No migration required for end users. All public APIs remain unchanged.
399
+
400
+ ---
401
+
402
+ ## [0.2.2] - 2024-08-01
403
+
404
+ ### 🐛 Bug Fixes
405
+ - Fixed IndexedDB connection issues in some browsers
406
+ - Improved error handling for network failures
407
+ - Enhanced console logging for debugging
408
+
409
+ ### 📈 Performance
410
+ - Optimized memory usage for large event collections
411
+ - Improved serialization performance
412
+
413
+ ---
414
+
415
+ ## [0.2.1] - 2024-07-31
416
+
417
+ ### ✨ New Features
418
+ - Added persistent buffer for failed requests
419
+ - Implemented exponential backoff retry mechanism
420
+ - Enhanced error context collection
421
+
422
+ ### 🔧 Improvements
423
+ - Better handling of circular references in serialization
424
+ - Improved fetch interception reliability
425
+ - Enhanced breadcrumb data structure
426
+
427
+ ---
428
+
429
+ ## [0.2.0] - 2024-07-30
430
+
431
+ ### 🎉 Major Release
432
+ - Complete rewrite with modular architecture
433
+ - Improved error handling and context collection
434
+ - Enhanced configuration options
435
+ - Better browser compatibility
436
+
437
+ ### ✨ New Features
438
+ - Automatic event capture (clicks, errors, HTTP, console)
439
+ - Flexible error posting (endpoint, custom handler, console)
440
+ - Configurable event limits
441
+ - Breadcrumb system for context
442
+
443
+ ### 🔧 Technical Improvements
444
+ - ES6+ codebase
445
+ - Rollup bundling
446
+ - Comprehensive testing
447
+ - Better error messages
448
+
449
+ ---
450
+
451
+ ## [0.1.0] - 2024-07-29
452
+
453
+ ### 🎉 Initial Release
454
+ - Basic error capture functionality
455
+ - Simple configuration system
456
+ - Console logging support
457
+ - Basic documentation
458
+
459
+
460
+ ---
461
+
462
+ ## Version History
463
+
464
+ - **0.4.7**: CHANGELOG in package, README metrics & Socket transparency
465
+ - **0.4.6**: ClickInterceptor invalid selector fix, try/catch fallback for closest()
466
+ - **0.4.5**: Refactor SOLID/DIP, code i18n, bug fixes, ESLint compliance for CI
467
+ - **0.4.4**: Community health (CONTRIBUTING, SECURITY, CODE_OF_CONDUCT), .editorconfig
468
+ - **0.2.5**: Initial public release with full observability suite
469
+ - **0.2.4**: Beta release with core functionality
470
+ - **0.2.3**: Alpha release with basic error tracking
471
+ - **0.2.2**: Development version with breadcrumb system
472
+ - **0.2.1**: Early development with agent architecture
473
+ - **0.2.0**: Initial project setup and architecture design
package/NOTICE CHANGED
@@ -1,4 +1,4 @@
1
1
  SyntropyFront
2
2
  Copyright 2024-2026 Syntropysoft
3
3
 
4
- Version 0.4.6
4
+ Version 0.4.8
package/README.md CHANGED
@@ -5,274 +5,153 @@
5
5
  <h1 align="center">SyntropyFront</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>From Uncertainty to Clarity</strong>
9
- <br />
10
- The Observability Library for High-Performance Teams
8
+ <strong>Capture frontend errors and user actions. One line. ~34 KB. Zero dependencies.</strong>
11
9
  </p>
12
10
 
13
11
  <p align="center">
14
12
  <a href="https://www.npmjs.com/package/@syntropysoft/syntropyfront"><img src="https://img.shields.io/npm/v/@syntropysoft/syntropyfront.svg" alt="NPM Version"></a>
15
13
  <a href="https://github.com/Syntropysoft/syntropyfront/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@syntropysoft/syntropyfront.svg" alt="License"></a>
16
14
  <a href="#"><img src="https://img.shields.io/badge/status-ready%20for%20production-brightgreen.svg" alt="Ready for Production"></a>
17
- <a href="#"><img src="https://img.shields.io/badge/test%20coverage-89.94%25-brightgreen.svg" alt="Test Coverage"></a>
15
+ <a href="#"><img src="https://img.shields.io/badge/test%20coverage-87%25-brightgreen.svg" alt="Test Coverage"></a>
18
16
  <a href="#"><img src="https://img.shields.io/badge/bundle%20size-34%20KB-brightgreen.svg" alt="Bundle Size"></a>
19
17
  <a href="https://socket.dev/npm/package/@syntropysoft/syntropyfront"><img src="https://socket.dev/api/badge/npm/package/@syntropysoft/syntropyfront" alt="Socket Badge"></a>
20
18
  </p>
21
19
 
22
20
  ---
23
21
 
24
- 🚀 **Automatic observability capture - Just 1 line of code! Zero external dependencies.**
22
+ ## What it does
25
23
 
26
- SyntropyFront automatically captures user interactions, errors, HTTP calls, and console logs, providing a 360° view of the user experience with minimal performance impact.
24
+ When something breaks in production, you get **what broke** and **what the user did before it**. No giant platform, no per-seat pricing. One import and it starts capturing:
27
25
 
28
- ## 🧠 Our Philosophy: Observability with Purpose
26
+ - **Errors** uncaught exceptions and unhandled promise rejections
27
+ - **Clicks** — on buttons, links, and interactive elements (throttled)
28
+ - **HTTP** — `fetch` calls (URL, method; no sensitive headers)
29
+ - **Breadcrumbs** — timeline you can extend with `addBreadcrumb()`
29
30
 
30
- SyntropyFront is not just a log collector; it is a piece of engineering designed under three fundamental pillars:
31
+ Optional: PII masking, sampling, offline retry (IndexedDB), and sending to your endpoint or `onError` callback. **That’s it.** It’s not a full APM; it’s enough to stop debugging blind.
31
32
 
32
- 1. **SOLID Principles**: Each component has a single responsibility. From `QueueManager` to `RetryManager`, the system is extensible and predictable.
33
- 2. **Functional Programming**: We use declarative patterns to transform data, ensuring that error processing and PII obfuscation are pure and without unexpected side effects.
34
- 3. **Privacy by Design (Privacy-by-Default)**: Security is not optional. The system includes a sensitive data masking engine (PII) that acts before any information leaves the client.
33
+ ---
34
+
35
+ ## Why use it
35
36
 
36
- ## Key Features
37
+ | Who | What they get |
38
+ |-----|----------------|
39
+ | **Developers** | One import, no config. No excuse to ship with zero visibility. |
40
+ | **PM / Tech Lead** | Visibility from day one. No long “observability” projects. |
41
+ | **Management** | Low cost, no SaaS lock-in. Fewer outages, less firefighting. |
37
42
 
38
- - 🎯 **Smart Click Capture**: Tracks interactions on interactive elements with built-in throttling logic.
39
- - 🚨 **Global Error Management**: Captures uncaught exceptions (`window.onerror`) and promise rejections.
40
- - 🌐 **Network Monitoring**: Intercepts `fetch` calls for full API visibility.
41
- - 🛡️ **PII Masking & ANSI Cleaning**: Automatically protects sensitive data (emails, cards, tokens).
42
- - 🎲 **Probabilistic Sampling**: Controls the volume of data sent to optimize costs and traffic.
43
- - 💾 **Offline Resilience**: Retry queue with *Exponential Backoff* and persistent storage via IndexedDB.
44
- - 📦 **Native Tree Shaking**: Modular architecture that allows you to include only the interceptors you truly need.
43
+ **Network:** Data is sent only to the endpoint or callback you configure. No third parties, no telemetry. See [SECURITY.md](SECURITY.md).
45
44
 
46
- ## 🚀 Quick Start
45
+ ---
47
46
 
48
- ### Installation
47
+ ## Quick Start
49
48
 
50
49
  ```bash
51
50
  pnpm add @syntropysoft/syntropyfront
52
51
  ```
53
52
 
54
- ### Basic Usage (Zero Config)
55
-
56
- Simply import the library in your application's entry point:
53
+ In your app entry (e.g. `main.jsx` or `index.js`):
57
54
 
58
55
  ```javascript
59
56
  import syntropyFront from '@syntropysoft/syntropyfront';
60
- // Done! SyntropyFront auto-initializes and starts capturing events.
57
+ // Done. Errors and breadcrumbs go to the console by default.
61
58
  ```
62
59
 
63
- ## ⚙️ Advanced Configuration
64
-
65
- SyntropyFront is highly configurable to suit your production needs.
60
+ To send to your backend or handle in code:
66
61
 
67
62
  ```javascript
68
- import syntropyFront from '@syntropysoft/syntropyfront';
69
-
70
63
  syntropyFront.configure({
71
- // Your observability backend URL (optional, defaults to console logging)
72
- endpoint: 'https://your-api.com/v1/telemetry',
73
-
74
- // Custom headers for transmission
75
- headers: {
76
- 'Authorization': 'Bearer your-app-token',
77
- 'X-Environment': 'production'
78
- },
79
-
80
- // 🎲 SAMPLING: Only sends 10% of errors to save resources
81
- samplingRate: 0.1,
82
-
83
- // 📦 BATCHING: Batch size and timeout before sending
84
- batchSize: 10,
85
- batchTimeout: 5000,
86
-
87
- // 🛡️ SECURITY: Basic payload encryption (base64/rot13)
88
- encrypt: true,
89
-
90
- // 💾 PERSISTENCE: Enable disk storage if the user is offline
91
- usePersistentBuffer: true,
92
-
93
- // Custom callback to handle the error before it is sent
94
- onError: (payload) => {
95
- console.warn('Error captured:', payload.type);
96
- return payload; // You can modify the payload here if necessary
97
- }
64
+ endpoint: 'https://your-api.com/errors',
65
+ headers: { 'Authorization': 'Bearer YOUR_TOKEN' },
66
+ // optional: samplingRate, batchSize, batchTimeout, usePersistentBuffer, onError
98
67
  });
99
68
  ```
100
69
 
101
- ## 🕹️ Event Capture & Custom Events
102
-
103
- SyntropyFront provides both automatic tracking and manual tools to enrich your observability data.
104
-
105
- ### 🤖 Automatic Capture
106
- By default, the following interceptors are initialized:
107
- - **UI Clicks**: Captures clicks on interactive elements (buttons, links, etc.) with smart selection logic.
108
- - **Network**: Intercepts `fetch` calls, logging requests and responses (without sensitive headers).
109
- - **Errors**: Catch-all for uncaught exceptions and unhandled promise rejections.
70
+ ---
110
71
 
111
- ### 🛠️ Custom Breadcrumbs
112
- Breadcrumbs are a timeline of events that help you understand what happened before an error occurred. You can add your own milestones:
72
+ ## Main API
113
73
 
114
- ```javascript
115
- import syntropyFront from '@syntropysoft/syntropyfront';
74
+ | Method | Description |
75
+ |--------|-------------|
76
+ | `configure(config)` | Set endpoint, headers, sampling, batching, `onError`, etc. |
77
+ | `addBreadcrumb(category, message, data?)` | Add a step to the timeline. |
78
+ | `sendError(error, context?)` | Send an error manually (e.g. from `catch`). |
79
+ | `getBreadcrumbs()` | Current breadcrumbs. |
80
+ | `clearBreadcrumbs()` | Clear the list. |
81
+ | `getStats()` | Queue length, retry status. |
82
+ | `flush()` | Send pending data now. |
83
+ | `destroy()` | Stop capturing and clean up. |
116
84
 
117
- // Simple breadcrumb
118
- syntropyFront.addBreadcrumb('auth', 'User logged in successfully');
85
+ ---
119
86
 
120
- // Breadcrumb with data
121
- syntropyFront.addBreadcrumb('commerce', 'Item added to cart', {
122
- productId: 'abc-123',
123
- price: 49.99,
124
- currency: 'USD'
125
- });
126
- ```
87
+ ## Optional: PII masking
127
88
 
128
- ### 🚨 Manual Error Reporting
129
- You can manually send errors that you catch in your own `try/catch` blocks:
130
-
131
- ```javascript
132
- try {
133
- performRiskyOperation();
134
- } catch (error) {
135
- syntropyFront.sendError(error, {
136
- severity: 'critical',
137
- userId: 'user_99'
138
- });
139
- }
140
- ```
89
+ Sensitive data is masked before leaving the client (emails, tokens, cards, SSN/phone patterns). You can add custom rules via `configure({ maskingRules: [...] })`. See the [full config example](#advanced-configuration) below.
141
90
 
142
91
  ---
143
92
 
144
- ## 🛡️ Sensitive Data Protection (PII Masking)
145
-
146
- SyntropyFront automatically protects your users' privacy. The `DataMaskingManager` detects and obfuscates:
147
- - Email addresses (`j***@example.com`)
148
- - Authentication tokens and passwords
149
- - Credit card numbers (keeps only the last 4 digits)
150
- - SSN and phone numbers
93
+ ## Advanced configuration
151
94
 
152
- ### Custom Rules Configuration
153
95
  ```javascript
154
96
  syntropyFront.configure({
155
- maskingRules: [
156
- {
157
- pattern: /custom_id_\d+/i,
158
- mask: 'HIDDEN_ID'
159
- }
160
- ]
97
+ endpoint: 'https://your-api.com/v1/telemetry',
98
+ headers: { 'Authorization': 'Bearer token', 'X-Environment': 'production' },
99
+ samplingRate: 0.1, // send 10% of events
100
+ batchSize: 10,
101
+ batchTimeout: 5000,
102
+ usePersistentBuffer: true, // retry when offline (IndexedDB)
103
+ onError: (payload) => {
104
+ console.warn('Error captured:', payload.type);
105
+ return payload;
106
+ },
107
+ context: { device: true, window: ['url', 'title'], storage: false }
161
108
  });
162
109
  ```
163
110
 
164
- ## 🏗️ Modular Architecture and Tree Shaking
165
-
166
- In version 0.5.0, we have moved interceptors to independent modules. To minimize your bundle size, you can import only what you need:
167
-
168
- ```javascript
169
- // Instead of global import, use specific interceptors directly
170
- // (Coming soon in the granular export API)
171
- ```
172
-
173
- ### Core Structure
174
- The system is divided into managers with unique responsibilities:
175
- - **QueueManager**: Manages batching and output flow.
176
- - **RetryManager**: Handles smart retries with incremental waits.
177
- - **SerializationManager**: Ensures data is safe for transmission over the network.
178
- - **ContextCollector**: Collects device information and user environment context.
179
-
180
- ## 📊 Quality Metrics
181
-
182
- We take stability seriously. SyntropyFront maintains:
183
- - **Test Coverage**: **>91%** (Lines), **>81%** (Branches).
184
- - **Stryker Mutation Score**: **>71%** (Our tests truly verify logic, they don't just "pass through" it).
185
- - **Zero Dependencies**: We don't add third-party vulnerabilities to your project.
186
-
187
- ## 📖 API Reference
188
-
189
- ### `syntropyFront.configure(config)`
190
- Updates the global configuration of the agent.
111
+ **Context fields** (when enabled): `device`, `window`, `network`, `session`, `ui`, `performance`, `storage`. See docs in the repo for the full list.
191
112
 
192
- ### `syntropyFront.addBreadcrumb(category, message, data)`
193
- Adds a manual milestone to the timeline.
194
- - `category`: String (e.g., 'auth', 'ui', 'action')
195
- - `message`: Description of the event.
196
- - `data`: (Optional) Object with additional metadata.
197
-
198
- ### `syntropyFront.sendError(error, context)`
199
- Manually reports an error.
200
- - `error`: Error object or string.
201
- - `context`: (Optional) Additional data to send with this specific error.
202
-
203
- ### `syntropyFront.flush()`
204
- Forces the immediate sending of all pending events in the queue.
205
-
206
- ### `syntropyFront.getBreadcrumbs()`
207
- Returns the list of current breadcrumbs in memory.
208
-
209
- ### `syntropyFront.clearBreadcrumbs()`
210
- Clears the temporary breadcrumb history.
113
+ ---
211
114
 
212
- ### `syntropyFront.getStats()`
213
- Returns an object with library performance statistics (queue length, retry status, etc.).
115
+ ## Design (short)
214
116
 
215
- ### `syntropyFront.destroy()`
216
- Deactivates all interceptors and stops the agent.
117
+ Built to be predictable and safe: SOLID-style modules, pure functions where it matters, PII masking by default. Data goes only to your endpoint or callback—see [SECURITY.md](SECURITY.md).
217
118
 
218
119
  ---
219
120
 
220
- ## 🔍 Advanced Context Collection
121
+ ## Quality
221
122
 
222
- You can precisely control what environment data is collected when an error occurs.
123
+ - **87%** test coverage
124
+ - **Zero** runtime dependencies
125
+ - **Mutation testing** (Stryker) >71%
223
126
 
224
- ```javascript
225
- syntropyFront.configure({
226
- context: {
227
- // Collect all default fields for these types
228
- device: true,
229
- network: true,
230
-
231
- // Collect ONLY specific fields
232
- window: ['url', 'title', 'viewport'],
233
- performance: ['memory'],
234
-
235
- // Explicitly disable a type
236
- storage: false
237
- }
238
- });
239
- ```
240
-
241
- ### Available Context Fields
242
- - **`device`**: `userAgent`, `language`, `screen`, `timezone`, `cookieEnabled`.
243
- - **`window`**: `url`, `pathname`, `referrer`, `title`, `viewport`.
244
- - **`storage`**: `localStorage`, `sessionStorage` (size and keys only, no values).
245
- - **`network`**: `online`, `connection` (type, downlink).
246
- - **`ui`**: `focused`, `visibility`, `activeElement`.
247
- - **`performance`**: `memory` (heap usage), `timing`.
248
- - **`session`**: `sessionId`, `startTime`, `pageLoadTime`.
127
+ ---
249
128
 
250
- ## 🛠️ Local Development
129
+ ## Examples
251
130
 
252
- If you want to contribute or test the library locally:
131
+ **[examples/README.md](examples/README.md)** Overview and how to run each demo.
253
132
 
254
- 1. **Clone and Install**:
255
- ```bash
256
- git clone https://github.com/Syntropysoft/syntropyfront.git
257
- cd syntropyfront
258
- pnpm install
259
- ```
133
+ | Example | Description |
134
+ |---------|-------------|
135
+ | [basic-usage.html](examples/basic-usage.html) | Vanilla HTML, no build. Run `pnpm run build` then open file:// or use a static server. |
136
+ | [HTML demos](examples/README.md#examples) | More: circular-references, worker, presets, proxy-tracking, lazy-loading, lazy-initialization, custom-objects. |
137
+ | [react-example](examples/react-example/) | React 18. `cd react-example && pnpm install && pnpm start` |
138
+ | [vue-example](examples/vue-example/) | Vue 3 + Vite. `cd vue-example && pnpm install && pnpm run dev` |
139
+ | [svelte-example](examples/svelte-example/) | Svelte 4 + Vite. `cd svelte-example && pnpm install && pnpm run dev` |
260
140
 
261
- 2. **Run Tests**:
262
- ```bash
263
- npm test # Run all tests
264
- npm run test:watch # Watch mode
265
- ```
141
+ ## Contributing / local dev
266
142
 
267
- 3. **Build**:
268
- ```bash
269
- npm run build
270
- ```
143
+ ```bash
144
+ git clone https://github.com/Syntropysoft/syntropyfront.git
145
+ cd syntropyfront
146
+ pnpm install
147
+ pnpm test
148
+ pnpm run build
149
+ ```
271
150
 
272
- ## 📄 License
151
+ ---
273
152
 
274
- This project is licensed under the **Apache License 2.0**. You can freely use, modify, and distribute it in commercial projects.
153
+ ## License
275
154
 
276
- ---
155
+ **Apache-2.0** — use in commercial and open-source projects.
277
156
 
278
- **Developed with ❤️ for a clearer and more stable web.**
157
+ **Developed for a clearer and more stable web.**
package/SECURITY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Security Policy
2
2
 
3
+ ## Network Access
4
+
5
+ This package performs **outgoing HTTP requests only** to the URL that **you** configure via `configure({ endpoint })` or your `onError` callback. No requests are made to third-party servers, to the maintainers, or to any URL not under your control. No telemetry or analytics are sent by the library. You own the destination and the data.
6
+
3
7
  ## Supported Versions
4
8
 
5
9
  Only the latest version of SyntropyFront is supported for security updates.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@syntropysoft/syntropyfront",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
- "description": "🚀 Observability library with automatic capture - Just 1 line of code! Automatically captures clicks, errors, HTTP calls, and console logs with flexible error handling.",
5
+ "description": "One line of code to capture frontend errors and user actions. Low cost, no per-seat pricing. Saves time, money, and reputation.",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -17,6 +17,7 @@
17
17
  "files": [
18
18
  "dist",
19
19
  "README.md",
20
+ "CHANGELOG.md",
20
21
  "LICENSE",
21
22
  "NOTICE",
22
23
  "CONTRIBUTING.md",
@@ -49,33 +50,32 @@
49
50
  "automatic-capture",
50
51
  "click-tracking",
51
52
  "http-monitoring",
52
- "console-logging",
53
53
  "error-handling",
54
+ "crash-reporting",
55
+ "exception-handling",
56
+ "error-reporting",
54
57
  "apm",
58
+ "RUM",
59
+ "real-user-monitoring",
55
60
  "debugging",
56
- "performance-monitoring",
61
+ "production-errors",
62
+ "Sentry-alternative",
63
+ "lightweight",
64
+ "zero-dependencies",
57
65
  "vanilla-js",
58
66
  "framework-agnostic",
59
67
  "client-side",
60
- "logging",
61
- "bug-tracking",
62
- "real-user-monitoring",
63
- "RUM",
64
- "Sentry-alternative",
65
68
  "react",
66
69
  "vue",
67
70
  "svelte",
68
71
  "typescript",
69
72
  "javascript",
70
- "web-analytics",
71
- "user-behavior",
72
- "crash-reporting",
73
- "exception-handling",
73
+ "console-logging",
74
+ "logging",
75
+ "bug-tracking",
74
76
  "telemetry",
75
77
  "application-monitoring",
76
- "error-reporting",
77
- "user-experience",
78
- "web-performance"
78
+ "user-behavior"
79
79
  ],
80
80
  "author": {
81
81
  "name": "Syntropysoft",