@sentry/core
Advanced tools
Comparing version 8.0.0 to 8.1.0
@@ -477,2 +477,6 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
if (!event.type) { | ||
isolationScope.setLastEventId(event.event_id || hint.event_id); | ||
} | ||
return prepareEvent.prepareEvent(options, event, hint, currentScope, this, isolationScope).then(evt => { | ||
@@ -479,0 +483,0 @@ if (evt === null) { |
@@ -108,2 +108,17 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/** | ||
* The last error event id of the isolation scope. | ||
* | ||
* Warning: This function really returns the last recorded error event id on the current | ||
* isolation scope. If you call this function after handling a certain error and another error | ||
* is captured in between, the last one is returned instead of the one you might expect. | ||
* Also, ids of events that were never sent to Sentry (for example because | ||
* they were dropped in `beforeSend`) could be returned. | ||
* | ||
* @returns The last event id of the isolation scope. | ||
*/ | ||
function lastEventId() { | ||
return currentScopes.getIsolationScope().lastEventId(); | ||
} | ||
/** | ||
* Create a cron monitor check in and send it to Sentry. | ||
@@ -215,2 +230,8 @@ * | ||
/** If the SDK is initialized & enabled. */ | ||
function isEnabled() { | ||
const client = currentScopes.getClient(); | ||
return !!client && client.getOptions().enabled !== false && !!client.getTransport(); | ||
} | ||
/** | ||
@@ -330,3 +351,5 @@ * Add an event processor. | ||
exports.flush = flush; | ||
exports.isEnabled = isEnabled; | ||
exports.isInitialized = isInitialized; | ||
exports.lastEventId = lastEventId; | ||
exports.setContext = setContext; | ||
@@ -333,0 +356,0 @@ exports.setExtra = setExtra; |
@@ -116,3 +116,5 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.flush = exports$1.flush; | ||
exports.isEnabled = exports$1.isEnabled; | ||
exports.isInitialized = exports$1.isInitialized; | ||
exports.lastEventId = exports$1.lastEventId; | ||
exports.setContext = exports$1.setContext; | ||
@@ -119,0 +121,0 @@ exports.setExtra = exports$1.setExtra; |
@@ -58,2 +58,4 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/** Contains the last event id of a captured event. */ | ||
// NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method. | ||
@@ -95,2 +97,3 @@ | ||
newScope._client = this._client; | ||
newScope._lastEventId = this._lastEventId; | ||
@@ -112,2 +115,9 @@ spanOnScope._setSpanForScope(newScope, spanOnScope._getSpanForScope(this)); | ||
*/ | ||
setLastEventId(lastEventId) { | ||
this._lastEventId = lastEventId; | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
getClient() { | ||
@@ -120,2 +130,9 @@ return this._client ; | ||
*/ | ||
lastEventId() { | ||
return this._lastEventId; | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
addScopeListener(callback) { | ||
@@ -122,0 +139,0 @@ this._scopeListeners.push(callback); |
@@ -19,3 +19,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const rate = typeof sampleRate === 'string' ? parseFloat(sampleRate) : sampleRate; | ||
if (typeof rate !== 'number' || isNaN(rate)) { | ||
if (typeof rate !== 'number' || isNaN(rate) || rate < 0 || rate > 1) { | ||
debugBuild.DEBUG_BUILD && | ||
@@ -30,8 +30,2 @@ utils.logger.warn( | ||
if (rate < 0 || rate > 1) { | ||
debugBuild.DEBUG_BUILD && | ||
utils.logger.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${rate}.`); | ||
return undefined; | ||
} | ||
return rate; | ||
@@ -38,0 +32,0 @@ } |
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const SDK_VERSION = '8.0.0'; | ||
const SDK_VERSION = '8.1.0'; | ||
exports.SDK_VERSION = SDK_VERSION; | ||
//# sourceMappingURL=version.js.map |
@@ -475,2 +475,6 @@ import { makeDsn, logger, uuid4, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, dropUndefinedKeys, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils'; | ||
if (!event.type) { | ||
isolationScope.setLastEventId(event.event_id || hint.event_id); | ||
} | ||
return prepareEvent(options, event, hint, currentScope, this, isolationScope).then(evt => { | ||
@@ -477,0 +481,0 @@ if (evt === null) { |
@@ -106,2 +106,17 @@ import { logger, uuid4, timestampInSeconds, isThenable, GLOBAL_OBJ } from '@sentry/utils'; | ||
/** | ||
* The last error event id of the isolation scope. | ||
* | ||
* Warning: This function really returns the last recorded error event id on the current | ||
* isolation scope. If you call this function after handling a certain error and another error | ||
* is captured in between, the last one is returned instead of the one you might expect. | ||
* Also, ids of events that were never sent to Sentry (for example because | ||
* they were dropped in `beforeSend`) could be returned. | ||
* | ||
* @returns The last event id of the isolation scope. | ||
*/ | ||
function lastEventId() { | ||
return getIsolationScope().lastEventId(); | ||
} | ||
/** | ||
* Create a cron monitor check in and send it to Sentry. | ||
@@ -213,2 +228,8 @@ * | ||
/** If the SDK is initialized & enabled. */ | ||
function isEnabled() { | ||
const client = getClient(); | ||
return !!client && client.getOptions().enabled !== false && !!client.getTransport(); | ||
} | ||
/** | ||
@@ -319,3 +340,3 @@ * Add an event processor. | ||
export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isInitialized, setContext, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor }; | ||
export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setContext, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor }; | ||
//# sourceMappingURL=exports.js.map |
@@ -15,3 +15,3 @@ export { registerSpanErrorInstrumentation } from './tracing/errors.js'; | ||
export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope.js'; | ||
export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isInitialized, setContext, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor } from './exports.js'; | ||
export { addEventProcessor, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, endSession, flush, isEnabled, isInitialized, lastEventId, setContext, setExtra, setExtras, setTag, setTags, setUser, startSession, withMonitor } from './exports.js'; | ||
export { getClient, getCurrentScope, getDefaultCurrentScope, getDefaultIsolationScope, getGlobalScope, getIsolationScope, withIsolationScope, withScope } from './currentScopes.js'; | ||
@@ -18,0 +18,0 @@ export { setAsyncContextStrategy } from './asyncContext/index.js'; |
@@ -56,2 +56,4 @@ import { isPlainObject, dateTimestampInSeconds, uuid4, logger } from '@sentry/utils'; | ||
/** Contains the last event id of a captured event. */ | ||
// NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method. | ||
@@ -93,2 +95,3 @@ | ||
newScope._client = this._client; | ||
newScope._lastEventId = this._lastEventId; | ||
@@ -110,2 +113,9 @@ _setSpanForScope(newScope, _getSpanForScope(this)); | ||
*/ | ||
setLastEventId(lastEventId) { | ||
this._lastEventId = lastEventId; | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
getClient() { | ||
@@ -118,2 +128,9 @@ return this._client ; | ||
*/ | ||
lastEventId() { | ||
return this._lastEventId; | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
addScopeListener(callback) { | ||
@@ -120,0 +137,0 @@ this._scopeListeners.push(callback); |
@@ -17,3 +17,3 @@ import { logger } from '@sentry/utils'; | ||
const rate = typeof sampleRate === 'string' ? parseFloat(sampleRate) : sampleRate; | ||
if (typeof rate !== 'number' || isNaN(rate)) { | ||
if (typeof rate !== 'number' || isNaN(rate) || rate < 0 || rate > 1) { | ||
DEBUG_BUILD && | ||
@@ -28,8 +28,2 @@ logger.warn( | ||
if (rate < 0 || rate > 1) { | ||
DEBUG_BUILD && | ||
logger.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${rate}.`); | ||
return undefined; | ||
} | ||
return rate; | ||
@@ -36,0 +30,0 @@ } |
@@ -1,4 +0,4 @@ | ||
const SDK_VERSION = '8.0.0'; | ||
const SDK_VERSION = '8.1.0'; | ||
export { SDK_VERSION }; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@sentry/core", | ||
"version": "8.0.0", | ||
"version": "8.1.0", | ||
"description": "Base implementation for all Sentry JavaScript SDKs", | ||
@@ -45,4 +45,4 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/types": "8.0.0", | ||
"@sentry/utils": "8.0.0" | ||
"@sentry/types": "8.1.0", | ||
"@sentry/utils": "8.1.0" | ||
}, | ||
@@ -49,0 +49,0 @@ "madge": { |
@@ -69,2 +69,14 @@ import { CaptureContext, CheckIn, Event, EventHint, EventProcessor, Extra, Extras, MonitorConfig, Primitive, Session, SessionContext, SeverityLevel, User } from '@sentry/types'; | ||
/** | ||
* The last error event id of the isolation scope. | ||
* | ||
* Warning: This function really returns the last recorded error event id on the current | ||
* isolation scope. If you call this function after handling a certain error and another error | ||
* is captured in between, the last one is returned instead of the one you might expect. | ||
* Also, ids of events that were never sent to Sentry (for example because | ||
* they were dropped in `beforeSend`) could be returned. | ||
* | ||
* @returns The last event id of the isolation scope. | ||
*/ | ||
export declare function lastEventId(): string | undefined; | ||
/** | ||
* Create a cron monitor check in and send it to Sentry. | ||
@@ -107,2 +119,4 @@ * | ||
export declare function isInitialized(): boolean; | ||
/** If the SDK is initialized & enabled. */ | ||
export declare function isEnabled(): boolean; | ||
/** | ||
@@ -109,0 +123,0 @@ * Add an event processor. |
@@ -11,3 +11,3 @@ export { ClientClass } from './sdk'; | ||
export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope'; | ||
export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, close, flush, setContext, setExtra, setExtras, setTag, setTags, setUser, isInitialized, startSession, endSession, captureSession, addEventProcessor, } from './exports'; | ||
export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, lastEventId, close, flush, setContext, setExtra, setExtras, setTag, setTags, setUser, isInitialized, isEnabled, startSession, endSession, captureSession, addEventProcessor, } from './exports'; | ||
export { getCurrentScope, getIsolationScope, getGlobalScope, withScope, withIsolationScope, getClient, getDefaultCurrentScope, getDefaultIsolationScope, } from './currentScopes'; | ||
@@ -14,0 +14,0 @@ export { setAsyncContextStrategy } from './asyncContext'; |
@@ -52,2 +52,4 @@ import { Attachment, Breadcrumb, CaptureContext, Client, Context, Contexts, Event, EventHint, EventProcessor, Extra, Extras, Primitive, PropagationContext, RequestSession, Scope as ScopeInterface, ScopeData, Session, SeverityLevel, User } from '@sentry/types'; | ||
protected _client?: Client; | ||
/** Contains the last event id of a captured event. */ | ||
protected _lastEventId?: string; | ||
constructor(); | ||
@@ -65,2 +67,6 @@ /** | ||
*/ | ||
setLastEventId(lastEventId: string | undefined): void; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
getClient<C extends Client>(): C | undefined; | ||
@@ -70,2 +76,6 @@ /** | ||
*/ | ||
lastEventId(): string | undefined; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
addScopeListener(callback: (scope: Scope) => void): void; | ||
@@ -72,0 +82,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
export declare const SDK_VERSION = "8.0.0"; | ||
export declare const SDK_VERSION = "8.1.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -69,2 +69,14 @@ import type { CaptureContext, CheckIn, Event, EventHint, EventProcessor, Extra, Extras, MonitorConfig, Primitive, Session, SessionContext, SeverityLevel, User } from '@sentry/types'; | ||
/** | ||
* The last error event id of the isolation scope. | ||
* | ||
* Warning: This function really returns the last recorded error event id on the current | ||
* isolation scope. If you call this function after handling a certain error and another error | ||
* is captured in between, the last one is returned instead of the one you might expect. | ||
* Also, ids of events that were never sent to Sentry (for example because | ||
* they were dropped in `beforeSend`) could be returned. | ||
* | ||
* @returns The last event id of the isolation scope. | ||
*/ | ||
export declare function lastEventId(): string | undefined; | ||
/** | ||
* Create a cron monitor check in and send it to Sentry. | ||
@@ -107,2 +119,4 @@ * | ||
export declare function isInitialized(): boolean; | ||
/** If the SDK is initialized & enabled. */ | ||
export declare function isEnabled(): boolean; | ||
/** | ||
@@ -109,0 +123,0 @@ * Add an event processor. |
@@ -11,3 +11,3 @@ export type { ClientClass } from './sdk'; | ||
export { createEventEnvelope, createSessionEnvelope, createSpanEnvelope } from './envelope'; | ||
export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, close, flush, setContext, setExtra, setExtras, setTag, setTags, setUser, isInitialized, startSession, endSession, captureSession, addEventProcessor, } from './exports'; | ||
export { captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, lastEventId, close, flush, setContext, setExtra, setExtras, setTag, setTags, setUser, isInitialized, isEnabled, startSession, endSession, captureSession, addEventProcessor, } from './exports'; | ||
export { getCurrentScope, getIsolationScope, getGlobalScope, withScope, withIsolationScope, getClient, getDefaultCurrentScope, getDefaultIsolationScope, } from './currentScopes'; | ||
@@ -14,0 +14,0 @@ export { setAsyncContextStrategy } from './asyncContext'; |
@@ -52,2 +52,4 @@ import type { Attachment, Breadcrumb, CaptureContext, Client, Context, Contexts, Event, EventHint, EventProcessor, Extra, Extras, Primitive, PropagationContext, RequestSession, Scope as ScopeInterface, ScopeData, Session, SeverityLevel, User } from '@sentry/types'; | ||
protected _client?: Client; | ||
/** Contains the last event id of a captured event. */ | ||
protected _lastEventId?: string; | ||
constructor(); | ||
@@ -65,2 +67,6 @@ /** | ||
*/ | ||
setLastEventId(lastEventId: string | undefined): void; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
getClient<C extends Client>(): C | undefined; | ||
@@ -70,2 +76,6 @@ /** | ||
*/ | ||
lastEventId(): string | undefined; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
addScopeListener(callback: (scope: Scope) => void): void; | ||
@@ -72,0 +82,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
export declare const SDK_VERSION = "8.0.0"; | ||
export declare const SDK_VERSION = "8.1.0"; | ||
//# sourceMappingURL=version.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1787925
19577
+ Added@sentry/types@8.1.0(transitive)
+ Added@sentry/utils@8.1.0(transitive)
- Removed@sentry/types@8.0.0(transitive)
- Removed@sentry/utils@8.0.0(transitive)
Updated@sentry/types@8.1.0
Updated@sentry/utils@8.1.0