Comparing version 3.4.0 to 4.0.0
'use strict'; | ||
var utils = require('@sentry/utils'); | ||
var integrations = require('@sentry/integrations'); | ||
var core = require('@sentry/core'); | ||
@@ -103,5 +102,3 @@ | ||
const normalizeDepth = client && client.getOptions().normalizeDepth; | ||
sdk?.configureScope((scope) => { | ||
scope.setExtra('__serialized__', utils.normalizeToSize(exception, normalizeDepth)); | ||
}); | ||
sdk?.setExtra('__serialized__', utils.normalizeToSize(exception, normalizeDepth)); | ||
ex = (hint && hint.syntheticException) || new Error(message); | ||
@@ -159,23 +156,10 @@ ex.message = message; | ||
const DEFAULT_LIMIT = 5; | ||
class LinkedErrors { | ||
static id = 'LinkedErrors'; | ||
name = LinkedErrors.id; | ||
limit; | ||
constructor(options = {}) { | ||
this.limit = options.limit || DEFAULT_LIMIT; | ||
} | ||
setupOnce(addGlobalEventProcessor, getCurrentHub) { | ||
const client = getCurrentHub().getClient(); | ||
if (!client) { | ||
return; | ||
} | ||
addGlobalEventProcessor((event, hint) => { | ||
const self = getCurrentHub().getIntegration(LinkedErrors); | ||
if (!self) { | ||
return event; | ||
} | ||
return handler(client.getOptions().stackParser, self.limit, event, hint); | ||
}); | ||
} | ||
} | ||
const linkedErrorsIntegration = core.defineIntegration((options = { limit: DEFAULT_LIMIT }) => { | ||
return { | ||
name: 'LinkedErrors', | ||
processEvent: (event, hint, client) => { | ||
return handler(client.getOptions().stackParser, options.limit, event, hint); | ||
}, | ||
}; | ||
}); | ||
function handler(parser, limit, event, hint) { | ||
@@ -206,18 +190,9 @@ if (!event.exception || | ||
}; | ||
class RequestData { | ||
static id = 'RequestData'; | ||
name = RequestData.id; | ||
#options; | ||
constructor(options = {}) { | ||
this.#options = { ...defaultRequestDataOptions, ...options }; | ||
} | ||
setupOnce(addGlobalEventProcessor, getCurrentHub) { | ||
const client = getCurrentHub().getClient(); | ||
if (!client) { | ||
return; | ||
} | ||
addGlobalEventProcessor((event) => { | ||
const requestDataIntegration = core.defineIntegration((userOptions = {}) => { | ||
const options = { ...defaultRequestDataOptions, ...userOptions }; | ||
return { | ||
name: 'RequestData', | ||
preprocessEvent: (event) => { | ||
const { sdkProcessingMetadata } = event; | ||
const self = getCurrentHub().getIntegration(RequestData); | ||
if (!self || !sdkProcessingMetadata) { | ||
if (!sdkProcessingMetadata) { | ||
return event; | ||
@@ -227,4 +202,4 @@ } | ||
sdkProcessingMetadata.request instanceof Request) { | ||
event.request = toEventRequest(sdkProcessingMetadata.request, this.#options); | ||
event.user = toEventUser(event.user ?? {}, sdkProcessingMetadata.request, this.#options); | ||
event.request = toEventRequest(sdkProcessingMetadata.request, options); | ||
event.user = toEventUser(event.user ?? {}, sdkProcessingMetadata.request, options); | ||
} | ||
@@ -242,5 +217,5 @@ if ('requestData' in sdkProcessingMetadata) { | ||
return event; | ||
}); | ||
} | ||
} | ||
}, | ||
}; | ||
}); | ||
/** | ||
@@ -431,5 +406,25 @@ * Applies allowlists on existing user object. | ||
integrationIndex[integration.name] = integration; | ||
integration.setupOnce((callback) => { | ||
sdk.getScope()?.addEventProcessor(callback); | ||
}, () => sdk); | ||
// `setupOnce` is only called the first time | ||
if (typeof integration.setupOnce === 'function') { | ||
integration.setupOnce(); | ||
} | ||
const client = sdk.getClient(); | ||
if (!client) { | ||
return; | ||
} | ||
// `setup` is run for each client | ||
if (typeof integration.setup === 'function') { | ||
integration.setup(client); | ||
} | ||
if (typeof integration.preprocessEvent === 'function') { | ||
const callback = integration.preprocessEvent.bind(integration); | ||
client.on('preprocessEvent', (event, hint) => callback(event, hint, client)); | ||
} | ||
if (typeof integration.processEvent === 'function') { | ||
const callback = integration.processEvent.bind(integration); | ||
const processor = Object.assign((event, hint) => callback(event, hint, client), { | ||
id: integration.name, | ||
}); | ||
client.addEventProcessor(processor); | ||
} | ||
}); | ||
@@ -444,3 +439,3 @@ return integrationIndex; | ||
/** | ||
* Some functions need to access the Hub (Toucan instance) this client is bound to, | ||
* Some functions need to access the scope (Toucan instance) this client is bound to, | ||
* but calling 'getCurrentHub()' is unsafe because it uses globals. | ||
@@ -450,2 +445,3 @@ * So we store a reference to the Hub after binding to it and provide it to methods that need it. | ||
#sdk = null; | ||
#integrationsInitialized = false; | ||
/** | ||
@@ -462,6 +458,6 @@ * Creates a new Toucan SDK instance. | ||
name: 'npm:' + 'toucan-js', | ||
version: '3.4.0', | ||
version: '4.0.0', | ||
}, | ||
], | ||
version: '3.4.0', | ||
version: '4.0.0', | ||
}; | ||
@@ -474,5 +470,5 @@ super(options); | ||
setupIntegrations() { | ||
if (this._isEnabled() && !this._integrationsInitialized && this.#sdk) { | ||
if (this._isEnabled() && !this.#integrationsInitialized && this.#sdk) { | ||
this._integrations = setupIntegrations(this._options.integrations, this.#sdk); | ||
this._integrationsInitialized = true; | ||
this.#integrationsInitialized = true; | ||
} | ||
@@ -609,4 +605,6 @@ } | ||
*/ | ||
class Toucan extends core.Hub { | ||
class Toucan extends core.Scope { | ||
#options; | ||
constructor(options) { | ||
super(); | ||
options.defaultIntegrations = | ||
@@ -619,4 +617,4 @@ options.defaultIntegrations === false | ||
: [ | ||
new RequestData(options.requestDataOptions), | ||
new LinkedErrors(), | ||
requestDataIntegration(options.requestDataOptions), | ||
linkedErrorsIntegration(), | ||
]), | ||
@@ -630,13 +628,20 @@ ]; | ||
} | ||
this.#options = options; | ||
this.attachNewClient(); | ||
} | ||
/** | ||
* Creates new ToucanClient and links it to this instance. | ||
*/ | ||
attachNewClient() { | ||
const client = new ToucanClient({ | ||
...options, | ||
...this.#options, | ||
transport: makeFetchTransport, | ||
integrations: core.getIntegrationsToSetup(options), | ||
stackParser: utils.stackParserFromStackParserOptions(options.stackParser || defaultStackParser), | ||
integrations: core.getIntegrationsToSetup(this.#options), | ||
stackParser: utils.stackParserFromStackParserOptions(this.#options.stackParser || defaultStackParser), | ||
transportOptions: { | ||
...options.transportOptions, | ||
context: options.context, | ||
...this.#options.transportOptions, | ||
context: this.#options.context, | ||
}, | ||
}); | ||
super(client); | ||
this.setClient(client); | ||
client.setSdk(this); | ||
@@ -678,26 +683,66 @@ client.setupIntegrations(); | ||
} | ||
/** | ||
* Add a breadcrumb to the current scope. | ||
*/ | ||
addBreadcrumb(breadcrumb, maxBreadcrumbs = 100) { | ||
const client = this.getClient(); | ||
const max = client.getOptions().maxBreadcrumbs || maxBreadcrumbs; | ||
return super.addBreadcrumb(breadcrumb, max); | ||
} | ||
/** | ||
* Clone all data from this instance into a new Toucan instance. | ||
* | ||
* @override | ||
* @returns New Toucan instance. | ||
*/ | ||
clone() { | ||
// Create new scope using the same options | ||
const toucan = new Toucan({ ...this.#options }); | ||
// And copy all the scope data | ||
toucan._breadcrumbs = [...this._breadcrumbs]; | ||
toucan._tags = { ...this._tags }; | ||
toucan._extra = { ...this._extra }; | ||
toucan._contexts = { ...this._contexts }; | ||
toucan._user = this._user; | ||
toucan._level = this._level; | ||
toucan._session = this._session; | ||
toucan._transactionName = this._transactionName; | ||
toucan._fingerprint = this._fingerprint; | ||
toucan._eventProcessors = [...this._eventProcessors]; | ||
toucan._requestSession = this._requestSession; | ||
toucan._attachments = [...this._attachments]; | ||
toucan._sdkProcessingMetadata = { ...this._sdkProcessingMetadata }; | ||
toucan._propagationContext = { ...this._propagationContext }; | ||
toucan._lastEventId = this._lastEventId; | ||
return toucan; | ||
} | ||
/** | ||
* Creates a new scope with and executes the given operation within. | ||
* The scope is automatically removed once the operation | ||
* finishes or throws. | ||
*/ | ||
withScope(callback) { | ||
const toucan = this.clone(); | ||
return callback(toucan); | ||
} | ||
} | ||
Object.defineProperty(exports, 'Dedupe', { | ||
Object.defineProperty(exports, 'dedupeIntegration', { | ||
enumerable: true, | ||
get: function () { return integrations.Dedupe; } | ||
get: function () { return core.dedupeIntegration; } | ||
}); | ||
Object.defineProperty(exports, 'ExtraErrorData', { | ||
Object.defineProperty(exports, 'extraErrorDataIntegration', { | ||
enumerable: true, | ||
get: function () { return integrations.ExtraErrorData; } | ||
get: function () { return core.extraErrorDataIntegration; } | ||
}); | ||
Object.defineProperty(exports, 'RewriteFrames', { | ||
Object.defineProperty(exports, 'rewriteFramesIntegration', { | ||
enumerable: true, | ||
get: function () { return integrations.RewriteFrames; } | ||
get: function () { return core.rewriteFramesIntegration; } | ||
}); | ||
Object.defineProperty(exports, 'SessionTiming', { | ||
Object.defineProperty(exports, 'sessionTimingIntegration', { | ||
enumerable: true, | ||
get: function () { return integrations.SessionTiming; } | ||
get: function () { return core.sessionTimingIntegration; } | ||
}); | ||
Object.defineProperty(exports, 'Transaction', { | ||
enumerable: true, | ||
get: function () { return integrations.Transaction; } | ||
}); | ||
exports.LinkedErrors = LinkedErrors; | ||
exports.RequestData = RequestData; | ||
exports.Toucan = Toucan; | ||
exports.linkedErrorsIntegration = linkedErrorsIntegration; | ||
exports.requestDataIntegration = requestDataIntegration; |
@@ -1,2 +0,2 @@ | ||
export { LinkedErrors, RequestData, Dedupe, ExtraErrorData, RewriteFrames, SessionTiming, Transaction, } from './integrations'; | ||
export { linkedErrorsIntegration, requestDataIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, } from './integrations'; | ||
export type { LinkedErrorsOptions, RequestDataOptions } from './integrations'; | ||
@@ -3,0 +3,0 @@ export { Toucan } from './sdk'; |
import { GLOBAL_OBJ, isError, isPlainObject, extractExceptionKeysForMessage, normalizeToSize, addExceptionTypeValue, addExceptionMechanism, isInstanceOf, resolvedSyncPromise, createStackParser, nodeStackLineParser, basename, rejectedSyncPromise, stackParserFromStackParserOptions } from '@sentry/utils'; | ||
export { Dedupe, ExtraErrorData, RewriteFrames, SessionTiming, Transaction } from '@sentry/integrations'; | ||
import { ServerRuntimeClient, createTransport, Hub, getIntegrationsToSetup } from '@sentry/core'; | ||
import { defineIntegration, ServerRuntimeClient, createTransport, Scope, getIntegrationsToSetup } from '@sentry/core'; | ||
export { dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration } from '@sentry/core'; | ||
@@ -101,5 +101,3 @@ function isObject(value) { | ||
const normalizeDepth = client && client.getOptions().normalizeDepth; | ||
sdk?.configureScope((scope) => { | ||
scope.setExtra('__serialized__', normalizeToSize(exception, normalizeDepth)); | ||
}); | ||
sdk?.setExtra('__serialized__', normalizeToSize(exception, normalizeDepth)); | ||
ex = (hint && hint.syntheticException) || new Error(message); | ||
@@ -157,23 +155,10 @@ ex.message = message; | ||
const DEFAULT_LIMIT = 5; | ||
class LinkedErrors { | ||
static id = 'LinkedErrors'; | ||
name = LinkedErrors.id; | ||
limit; | ||
constructor(options = {}) { | ||
this.limit = options.limit || DEFAULT_LIMIT; | ||
} | ||
setupOnce(addGlobalEventProcessor, getCurrentHub) { | ||
const client = getCurrentHub().getClient(); | ||
if (!client) { | ||
return; | ||
} | ||
addGlobalEventProcessor((event, hint) => { | ||
const self = getCurrentHub().getIntegration(LinkedErrors); | ||
if (!self) { | ||
return event; | ||
} | ||
return handler(client.getOptions().stackParser, self.limit, event, hint); | ||
}); | ||
} | ||
} | ||
const linkedErrorsIntegration = defineIntegration((options = { limit: DEFAULT_LIMIT }) => { | ||
return { | ||
name: 'LinkedErrors', | ||
processEvent: (event, hint, client) => { | ||
return handler(client.getOptions().stackParser, options.limit, event, hint); | ||
}, | ||
}; | ||
}); | ||
function handler(parser, limit, event, hint) { | ||
@@ -204,18 +189,9 @@ if (!event.exception || | ||
}; | ||
class RequestData { | ||
static id = 'RequestData'; | ||
name = RequestData.id; | ||
#options; | ||
constructor(options = {}) { | ||
this.#options = { ...defaultRequestDataOptions, ...options }; | ||
} | ||
setupOnce(addGlobalEventProcessor, getCurrentHub) { | ||
const client = getCurrentHub().getClient(); | ||
if (!client) { | ||
return; | ||
} | ||
addGlobalEventProcessor((event) => { | ||
const requestDataIntegration = defineIntegration((userOptions = {}) => { | ||
const options = { ...defaultRequestDataOptions, ...userOptions }; | ||
return { | ||
name: 'RequestData', | ||
preprocessEvent: (event) => { | ||
const { sdkProcessingMetadata } = event; | ||
const self = getCurrentHub().getIntegration(RequestData); | ||
if (!self || !sdkProcessingMetadata) { | ||
if (!sdkProcessingMetadata) { | ||
return event; | ||
@@ -225,4 +201,4 @@ } | ||
sdkProcessingMetadata.request instanceof Request) { | ||
event.request = toEventRequest(sdkProcessingMetadata.request, this.#options); | ||
event.user = toEventUser(event.user ?? {}, sdkProcessingMetadata.request, this.#options); | ||
event.request = toEventRequest(sdkProcessingMetadata.request, options); | ||
event.user = toEventUser(event.user ?? {}, sdkProcessingMetadata.request, options); | ||
} | ||
@@ -240,5 +216,5 @@ if ('requestData' in sdkProcessingMetadata) { | ||
return event; | ||
}); | ||
} | ||
} | ||
}, | ||
}; | ||
}); | ||
/** | ||
@@ -429,5 +405,25 @@ * Applies allowlists on existing user object. | ||
integrationIndex[integration.name] = integration; | ||
integration.setupOnce((callback) => { | ||
sdk.getScope()?.addEventProcessor(callback); | ||
}, () => sdk); | ||
// `setupOnce` is only called the first time | ||
if (typeof integration.setupOnce === 'function') { | ||
integration.setupOnce(); | ||
} | ||
const client = sdk.getClient(); | ||
if (!client) { | ||
return; | ||
} | ||
// `setup` is run for each client | ||
if (typeof integration.setup === 'function') { | ||
integration.setup(client); | ||
} | ||
if (typeof integration.preprocessEvent === 'function') { | ||
const callback = integration.preprocessEvent.bind(integration); | ||
client.on('preprocessEvent', (event, hint) => callback(event, hint, client)); | ||
} | ||
if (typeof integration.processEvent === 'function') { | ||
const callback = integration.processEvent.bind(integration); | ||
const processor = Object.assign((event, hint) => callback(event, hint, client), { | ||
id: integration.name, | ||
}); | ||
client.addEventProcessor(processor); | ||
} | ||
}); | ||
@@ -442,3 +438,3 @@ return integrationIndex; | ||
/** | ||
* Some functions need to access the Hub (Toucan instance) this client is bound to, | ||
* Some functions need to access the scope (Toucan instance) this client is bound to, | ||
* but calling 'getCurrentHub()' is unsafe because it uses globals. | ||
@@ -448,2 +444,3 @@ * So we store a reference to the Hub after binding to it and provide it to methods that need it. | ||
#sdk = null; | ||
#integrationsInitialized = false; | ||
/** | ||
@@ -460,6 +457,6 @@ * Creates a new Toucan SDK instance. | ||
name: 'npm:' + 'toucan-js', | ||
version: '3.4.0', | ||
version: '4.0.0', | ||
}, | ||
], | ||
version: '3.4.0', | ||
version: '4.0.0', | ||
}; | ||
@@ -472,5 +469,5 @@ super(options); | ||
setupIntegrations() { | ||
if (this._isEnabled() && !this._integrationsInitialized && this.#sdk) { | ||
if (this._isEnabled() && !this.#integrationsInitialized && this.#sdk) { | ||
this._integrations = setupIntegrations(this._options.integrations, this.#sdk); | ||
this._integrationsInitialized = true; | ||
this.#integrationsInitialized = true; | ||
} | ||
@@ -607,4 +604,6 @@ } | ||
*/ | ||
class Toucan extends Hub { | ||
class Toucan extends Scope { | ||
#options; | ||
constructor(options) { | ||
super(); | ||
options.defaultIntegrations = | ||
@@ -617,4 +616,4 @@ options.defaultIntegrations === false | ||
: [ | ||
new RequestData(options.requestDataOptions), | ||
new LinkedErrors(), | ||
requestDataIntegration(options.requestDataOptions), | ||
linkedErrorsIntegration(), | ||
]), | ||
@@ -628,13 +627,20 @@ ]; | ||
} | ||
this.#options = options; | ||
this.attachNewClient(); | ||
} | ||
/** | ||
* Creates new ToucanClient and links it to this instance. | ||
*/ | ||
attachNewClient() { | ||
const client = new ToucanClient({ | ||
...options, | ||
...this.#options, | ||
transport: makeFetchTransport, | ||
integrations: getIntegrationsToSetup(options), | ||
stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser), | ||
integrations: getIntegrationsToSetup(this.#options), | ||
stackParser: stackParserFromStackParserOptions(this.#options.stackParser || defaultStackParser), | ||
transportOptions: { | ||
...options.transportOptions, | ||
context: options.context, | ||
...this.#options.transportOptions, | ||
context: this.#options.context, | ||
}, | ||
}); | ||
super(client); | ||
this.setClient(client); | ||
client.setSdk(this); | ||
@@ -676,4 +682,48 @@ client.setupIntegrations(); | ||
} | ||
/** | ||
* Add a breadcrumb to the current scope. | ||
*/ | ||
addBreadcrumb(breadcrumb, maxBreadcrumbs = 100) { | ||
const client = this.getClient(); | ||
const max = client.getOptions().maxBreadcrumbs || maxBreadcrumbs; | ||
return super.addBreadcrumb(breadcrumb, max); | ||
} | ||
/** | ||
* Clone all data from this instance into a new Toucan instance. | ||
* | ||
* @override | ||
* @returns New Toucan instance. | ||
*/ | ||
clone() { | ||
// Create new scope using the same options | ||
const toucan = new Toucan({ ...this.#options }); | ||
// And copy all the scope data | ||
toucan._breadcrumbs = [...this._breadcrumbs]; | ||
toucan._tags = { ...this._tags }; | ||
toucan._extra = { ...this._extra }; | ||
toucan._contexts = { ...this._contexts }; | ||
toucan._user = this._user; | ||
toucan._level = this._level; | ||
toucan._session = this._session; | ||
toucan._transactionName = this._transactionName; | ||
toucan._fingerprint = this._fingerprint; | ||
toucan._eventProcessors = [...this._eventProcessors]; | ||
toucan._requestSession = this._requestSession; | ||
toucan._attachments = [...this._attachments]; | ||
toucan._sdkProcessingMetadata = { ...this._sdkProcessingMetadata }; | ||
toucan._propagationContext = { ...this._propagationContext }; | ||
toucan._lastEventId = this._lastEventId; | ||
return toucan; | ||
} | ||
/** | ||
* Creates a new scope with and executes the given operation within. | ||
* The scope is automatically removed once the operation | ||
* finishes or throws. | ||
*/ | ||
withScope(callback) { | ||
const toucan = this.clone(); | ||
return callback(toucan); | ||
} | ||
} | ||
export { LinkedErrors, RequestData, Toucan }; | ||
export { Toucan, linkedErrorsIntegration, requestDataIntegration }; |
export * from './linkedErrors'; | ||
export * from './requestData'; | ||
export { Dedupe, ExtraErrorData, RewriteFrames, SessionTiming, Transaction, } from '@sentry/integrations'; | ||
export { dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, sessionTimingIntegration, } from '@sentry/core'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,14 +0,7 @@ | ||
import { EventProcessor, Exception, ExtendedError, Integration, StackParser } from '@sentry/types'; | ||
import { Toucan } from '../sdk'; | ||
import { Exception, ExtendedError, StackParser } from '@sentry/types'; | ||
export type LinkedErrorsOptions = { | ||
limit: number; | ||
}; | ||
export declare class LinkedErrors implements Integration { | ||
static id: string; | ||
readonly name: string; | ||
private readonly limit; | ||
constructor(options?: Partial<LinkedErrorsOptions>); | ||
setupOnce(addGlobalEventProcessor: (eventProcessor: EventProcessor) => void, getCurrentHub: () => Toucan): void; | ||
} | ||
export declare const linkedErrorsIntegration: (options?: LinkedErrorsOptions | undefined) => import("@sentry/types").Integration; | ||
export declare function walkErrorTree(parser: StackParser, limit: number, error: ExtendedError, stack?: Exception[]): Exception[]; | ||
//# sourceMappingURL=linkedErrors.d.ts.map |
@@ -1,3 +0,1 @@ | ||
import { EventProcessor, Integration } from '@sentry/types'; | ||
import { Toucan } from '../sdk'; | ||
type Allowlist = string[] | RegExp | boolean; | ||
@@ -10,10 +8,4 @@ export type RequestDataOptions = { | ||
}; | ||
export declare class RequestData implements Integration { | ||
#private; | ||
static id: string; | ||
readonly name: string; | ||
constructor(options?: RequestDataOptions); | ||
setupOnce(addGlobalEventProcessor: (eventProcessor: EventProcessor) => void, getCurrentHub: () => Toucan): void; | ||
} | ||
export declare const requestDataIntegration: (userOptions?: RequestDataOptions | undefined) => import("@sentry/types").Integration; | ||
export {}; | ||
//# sourceMappingURL=requestData.d.ts.map |
@@ -1,10 +0,15 @@ | ||
import { Hub, Scope } from '@sentry/core'; | ||
import { Scope } from '@sentry/core'; | ||
import type { Options } from './types'; | ||
import { CheckIn, MonitorConfig } from '@sentry/types'; | ||
import type { Breadcrumb, CheckIn, MonitorConfig } from '@sentry/types'; | ||
/** | ||
* The Cloudflare Workers SDK. | ||
*/ | ||
export declare class Toucan extends Hub { | ||
export declare class Toucan extends Scope { | ||
#private; | ||
constructor(options: Options); | ||
/** | ||
* Creates new ToucanClient and links it to this instance. | ||
*/ | ||
protected attachNewClient(): void; | ||
/** | ||
* Sets the request body context on all future events. | ||
@@ -32,3 +37,20 @@ * | ||
captureCheckIn(checkIn: CheckIn, monitorConfig?: MonitorConfig, scope?: Scope): string; | ||
/** | ||
* Add a breadcrumb to the current scope. | ||
*/ | ||
addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this; | ||
/** | ||
* Clone all data from this instance into a new Toucan instance. | ||
* | ||
* @override | ||
* @returns New Toucan instance. | ||
*/ | ||
clone(): Toucan; | ||
/** | ||
* Creates a new scope with and executes the given operation within. | ||
* The scope is automatically removed once the operation | ||
* finishes or throws. | ||
*/ | ||
withScope<T>(callback: (scope: Toucan) => T): T; | ||
} | ||
//# sourceMappingURL=sdk.d.ts.map |
{ | ||
"name": "toucan-js", | ||
"sideEffects": false, | ||
"version": "3.4.0", | ||
"version": "4.0.0", | ||
"description": "Cloudflare Workers client for Sentry", | ||
@@ -32,6 +32,5 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"@sentry/core": "7.112.2", | ||
"@sentry/utils": "7.112.2", | ||
"@sentry/types": "7.112.2", | ||
"@sentry/integrations": "7.112.2" | ||
"@sentry/core": "8.9.2", | ||
"@sentry/utils": "8.9.2", | ||
"@sentry/types": "8.9.2" | ||
}, | ||
@@ -38,0 +37,0 @@ "devDependencies": { |
@@ -19,3 +19,3 @@ <p align="center"> | ||
This SDK provides all options and methods of [Hub](https://github.com/getsentry/sentry-javascript/blob/master/packages/core/src/hub.ts) and additionally: | ||
This SDK provides all options and methods of [ScopeClass](https://github.com/getsentry/sentry-javascript/blob/master/packages/core/src/scope.ts) and additionally: | ||
@@ -48,20 +48,18 @@ ### Additional constructor options | ||
You can use custom integrations to enhance `toucan-js` as you would any other Sentry SDK. Some integrations are provided in [@sentry/integrations](https://github.com/getsentry/sentry-javascript/tree/master/packages/integrations) package, and you can also write your own! To ensure an integration will work properly in `toucan-js`, it must: | ||
You can use custom integrations to enhance `toucan-js` as you would any other Sentry SDK. Some integrations are provided in various [Sentry packages](https://github.com/getsentry/sentry-javascript/tree/develop/packages), and you can also write your own! To ensure an integration will work properly in `toucan-js`, it must: | ||
- not use global `getCurrentHub` from `@sentry/core`. | ||
- not enhance or wrap global runtime methods (such as `console.log`). | ||
- not use runtime APIs that aren't available in Cloudflare Workers (NodeJS runtime functions, `window` object, etc...). | ||
Supported integrations from [@sentry/integrations](https://github.com/getsentry/sentry-javascript/tree/master/packages/integrations) are re-exported from `toucan-js`: | ||
Supported integrations from [@sentry/core](https://github.com/getsentry/sentry-javascript/tree/develop/packages/core) are re-exported from `toucan-js`: | ||
- [Dedupe](https://github.com/getsentry/sentry-javascript/blob/master/packages/integrations/src/dedupe.ts) | ||
- [ExtraErrorData](https://github.com/getsentry/sentry-javascript/blob/master/packages/integrations/src/extraerrordata.ts) | ||
- [RewriteFrames](https://github.com/getsentry/sentry-javascript/blob/master/packages/integrations/src/rewriteframes.ts) | ||
- [SessionTiming](https://github.com/getsentry/sentry-javascript/blob/master/packages/integrations/src/sessiontiming.ts) | ||
- [Transaction](https://github.com/getsentry/sentry-javascript/blob/master/packages/integrations/src/transaction.ts) | ||
- [dedupeIntegration](https://github.com/getsentry/sentry-javascript/blob/master/packages/integrations/src/dedupe.ts) | ||
- [extraErrorDataIntegration](https://github.com/getsentry/sentry-javascript/blob/master/packages/integrations/src/extraerrordata.ts) | ||
- [rewriteFramesIntegration](https://github.com/getsentry/sentry-javascript/blob/master/packages/integrations/src/rewriteframes.ts) | ||
- [sessionTimingIntegration](https://github.com/getsentry/sentry-javascript/blob/master/packages/integrations/src/sessiontiming.ts) | ||
`toucan-js` also provides 2 integrations that are enabled by default, but are provided if you need to reconfigure them: | ||
- [LinkedErrors](src/integrations/linkedErrors.ts) | ||
- [RequestData](src/integrations/requestData.ts) | ||
- [linkedErrorsIntegration](src/integrations/linkedErrors.ts) | ||
- [requestDataIntegration](src/integrations/requestData.ts) | ||
@@ -71,4 +69,3 @@ ### Custom integration example: | ||
```ts | ||
import { Toucan } from 'toucan-js'; | ||
import { RewriteFrames } from '@sentry/integrations'; | ||
import { Toucan, rewriteFramesIntegration } from 'toucan-js'; | ||
@@ -85,3 +82,3 @@ type Env = { | ||
request, | ||
integrations: [new RewriteFrames({ root: '/' })], | ||
integrations: [rewriteFramesIntegration({ root: '/' })], | ||
}); | ||
@@ -88,0 +85,0 @@ |
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
75508
3
1653
107
+ Added@sentry/core@8.9.2(transitive)
+ Added@sentry/types@8.9.2(transitive)
+ Added@sentry/utils@8.9.2(transitive)
- Removed@sentry/integrations@7.112.2
- Removed@sentry/core@7.112.2(transitive)
- Removed@sentry/integrations@7.112.2(transitive)
- Removed@sentry/types@7.112.2(transitive)
- Removed@sentry/utils@7.112.2(transitive)
- Removedimmediate@3.0.6(transitive)
- Removedlie@3.1.1(transitive)
- Removedlocalforage@1.10.0(transitive)
Updated@sentry/core@8.9.2
Updated@sentry/types@8.9.2
Updated@sentry/utils@8.9.2