@proliferate_ai/sdk
v0.2.0
Published
Proliferate Error Monitoring SDK for JavaScript with Session Replay
Maintainers
Readme
@proliferate/sdk
JavaScript SDK for Proliferate Error Monitoring.
Installation
npm install @proliferate/sdkQuick Start
import Proliferate from '@proliferate/sdk';
// Initialize the SDK
Proliferate.init({
endpoint: 'https://your-api.com/api/v1/errors',
apiKey: 'pk_your_api_key',
environment: 'production',
release: '1.0.0',
});
// Set user context (optional)
Proliferate.setUser({
id: 'user_123',
email: '[email protected]',
});
// Set account context (optional)
Proliferate.setAccount({
id: 'acct_456',
name: 'Acme Corp',
});Automatic Error Capture
After initialization, the SDK automatically captures:
- Uncaught exceptions (
window.onerror) - Unhandled promise rejections (
window.onunhandledrejection)
Manual Error Capture
// Capture an exception
try {
riskyOperation();
} catch (error) {
Proliferate.captureException(error, {
extra: { orderId: 'order_789' },
});
}
// Capture a message
Proliferate.captureMessage('User attempted invalid action', {
level: 'warning',
extra: { action: 'delete_admin' },
});API
Proliferate.init(options)
Initialize the SDK.
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| endpoint | string | Yes | API endpoint URL |
| apiKey | string | Yes | Project API key (format: pk_{project_slug}_{random}) |
| environment | string | No | Environment name |
| release | string | No | Release version |
API Key Notes:
- API keys are project-scoped. Each project can have multiple API keys.
- Keys follow the format
pk_{project_slug}_{random_hex}(e.g.,pk_my-app-default_a1b2c3d4e5f6) - Revoked keys will return a
401 Unauthorizederror with message "API key has been revoked" - You can manage API keys from the dashboard under Project Settings > API Keys
Proliferate.setUser(user)
Set user context for error reports.
Proliferate.setUser({ id: 'user_123', email: '[email protected]' });
Proliferate.setUser(null); // Clear user contextProliferate.setAccount(account)
Set account context for error reports.
Proliferate.setAccount({ id: 'acct_456', name: 'Acme Corp' });
Proliferate.setAccount(null); // Clear account contextProliferate.captureException(error, options?)
Manually capture an exception.
Proliferate.captureException(new Error('Something went wrong'), {
extra: { additionalData: 'value' },
});Proliferate.captureMessage(message, options?)
Capture a message (not an exception).
Proliferate.captureMessage('Something happened', {
level: 'warning', // 'error' | 'warning' | 'info'
extra: { context: 'value' },
});Browser Support
- Chrome, Firefox, Safari, Edge (modern versions)
- Uses
fetchwithkeepalivefor reliable delivery - Falls back to
navigator.sendBeaconif needed
