
Security News
New CNA Scorecard Tool Ranks CVE Data Quality Across the Ecosystem
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
@syntropyfront/interceptors
Advanced tools
Official interceptors for SyntropyFront - Framework-specific interceptors for React, Vue, Angular, and more
Framework-Specific Interceptors
Seamless integration with React, Vue, Angular, and more
Official interceptors for SyntropyFront - Framework-specific interceptors that provide seamless integration with popular frontend frameworks and state management libraries.
npm install @syntropyfront/interceptors
import { SyntropyFront } from '@syntropysoft/syntropyfront';
import { ReduxInterceptor, VuexInterceptor } from '@syntropyfront/interceptors';
// Initialize SyntropyFront
await SyntropyFront.init({
preset: 'balanced',
agent: {
endpoint: 'https://api.yourapp.com/errors'
}
});
// Inject interceptors
SyntropyFront.inject('redux', ReduxInterceptor());
SyntropyFront.inject('vuex', VuexInterceptor());
// Configure stores (recommended)
const reduxInfo = SyntropyFront.getInterceptorInfo('redux');
reduxInfo?.setStore(myReduxStore);
const vuexInfo = SyntropyFront.getInterceptorInfo('vuex');
vuexInfo?.setStore(myVuexStore);
All interceptors are used with the core @syntropysoft/syntropyfront
library via the inject()
method:
import { SyntropyFront } from '@syntropysoft/syntropyfront';
import { ReduxInterceptor, VuexInterceptor } from '@syntropyfront/interceptors';
// Initialize SyntropyFront
await SyntropyFront.init({
preset: 'balanced',
agent: {
endpoint: 'https://api.yourapp.com/errors'
}
});
// Inject framework-specific interceptors
SyntropyFront.inject('redux', ReduxInterceptor());
SyntropyFront.inject('vuex', VuexInterceptor());
// Configure stores explicitly (recommended)
const reduxInfo = SyntropyFront.getInterceptorInfo('redux');
if (reduxInfo && reduxInfo.setStore) {
reduxInfo.setStore(myReduxStore);
}
const vuexInfo = SyntropyFront.getInterceptorInfo('vuex');
if (vuexInfo && vuexInfo.setStore) {
vuexInfo.setStore(myVuexStore);
}
Intercepts Redux store actions and state changes.
import { ReduxInterceptor } from '@syntropyfront/interceptors';
// Inject Redux interceptor
SyntropyFront.inject('redux', ReduxInterceptor());
// Configure the store explicitly
const reduxInfo = SyntropyFront.getInterceptorInfo('redux');
if (reduxInfo && reduxInfo.setStore) {
reduxInfo.setStore(myReduxStore);
}
// Or use auto-find (convenience method)
if (reduxInfo && reduxInfo.autoFindStore) {
reduxInfo.autoFindStore();
}
// The interceptor will:
// - Track Redux actions
// - Monitor state changes
// - Add breadcrumbs for state mutations
Intercepts Vuex store mutations and actions.
import { VuexInterceptor } from '@syntropyfront/interceptors';
// Inject Vuex interceptor
SyntropyFront.inject('vuex', VuexInterceptor());
// Configure the store explicitly
const vuexInfo = SyntropyFront.getInterceptorInfo('vuex');
if (vuexInfo && vuexInfo.setStore) {
vuexInfo.setStore(myVuexStore);
}
// Or use auto-find (convenience method)
if (vuexInfo && vuexInfo.autoFindStore) {
vuexInfo.autoFindStore();
}
// The interceptor will:
// - Track Vuex mutations
// - Monitor actions
// - Add breadcrumbs for state changes
For tracking any JavaScript object (not just framework stores), use the built-in ProxyObjectTracker from the core library:
import { SyntropyFront } from 'syntropylogfront';
// Track any object reactively
const myObject = { name: 'test', data: [] };
const trackedObject = SyntropyFront.addProxyObject('myObject', myObject, {
trackNested: true,
trackArrays: true,
maxStates: 10
});
// Every change is captured automatically
trackedObject.name = 'updated';
trackedObject.data.push('new item');
trackedObject.nested = { value: 42 };
// Get history of changes
const history = SyntropyFront.getProxyObjectHistory('myObject');
Traditional interceptors automatically search for stores in global variables:
// ❌ PROBLEM: Interceptor searches for store
if (window.reduxStore) {
this.store = window.reduxStore;
} else if (window.store) {
this.store = window.store;
}
In real applications, stores are created after init()
:
// ❌ PROBLEM: Incorrect order
SyntropyFront.init(); // Interceptor looks for store
// ... time later ...
const store = createStore(); // Store created late
Interceptors implement lazy initialization that waits for stores to be created:
// Interceptors automatically search for stores with retry
// Redux: searches in window.reduxStore, window.store, etc.
// Vuex: searches in window.vuexStore, window.store, etc.
// If store is not found immediately, retries 5 times every 500ms
console.log('SyntropyFront: Searching for Redux store... (5 attempts remaining)');
console.log('SyntropyFront: Searching for Redux store... (4 attempts remaining)');
// ... until found or attempts exhausted
// If store is found automatically
console.log('SyntropyFront: Redux store found and configured automatically.');
// If not found after all attempts
console.warn('SyntropyFront: Redux store not found after several attempts. Use setStore() to configure it manually.');
// ✅ SOLUTION: User explicitly provides the store
const reduxInfo = SyntropyFront.getInterceptorInfo('redux');
reduxInfo.setStore(myReduxStore);
You can create custom interceptors for any framework or library using the secure API:
// MyCustomInterceptor.js
export default function MyCustomInterceptor() {
return {
name: 'myCustom',
init(api) {
// api is a secure facade with only safe methods
console.log('My custom interceptor initialized');
// Add breadcrumbs
api.addBreadcrumb('custom', 'My interceptor started', { data: 'example' });
// Send data to backend
api.sendError({ message: 'Custom error' });
// Get context
const context = api.getContext({ device: true });
// Get timestamp
const timestamp = api.getTimestamp();
},
destroy() {
// Cleanup your interceptor
console.log('My custom interceptor destroyed');
}
};
}
// Usage
import MyCustomInterceptor from './MyCustomInterceptor.js';
syntropyFront.injectCustomInterceptor('myCustom', MyCustomInterceptor);
The interceptor receives a secure API object with these methods:
addBreadcrumb(category, message, data?)
Adds a breadcrumb to the history.
sendError(errorPayload, context?)
Sends an error to the backend.
sendBreadcrumbs(breadcrumbs)
Sends breadcrumbs to the backend.
getContext(contextConfig?)
Gets browser context data.
getTimestamp()
Gets current timestamp in ISO format.
api.apiVersion
- API versionapi.availableMethods
- List of available methodsEach interceptor receives a secure API object with access to safe SyntropyFront methods:
{
addBreadcrumb, // Add breadcrumbs safely
sendError, // Send errors to backend
sendBreadcrumbs, // Send breadcrumbs to backend
getContext, // Get context data
getTimestamp, // Get current timestamp
apiVersion, // API version
availableMethods // List of available methods
}
See the examples directory for complete usage examples.
Apache 2.0
FAQs
Official interceptors for SyntropyFront - Framework-specific interceptors for React, Vue, Angular, and more
The npm package @syntropyfront/interceptors receives a total of 0 weekly downloads. As such, @syntropyfront/interceptors popularity was classified as not popular.
We found that @syntropyfront/interceptors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.