Skip to content

Commit 14a46fc

Browse files
committed
feat(v8/integrations): Remove deprecated exports
- Remove class based exports - Delete `Transaction` integration
1 parent f8c1637 commit 14a46fc

19 files changed

+297
-638
lines changed

packages/integrations/src/captureconsole.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
import {
2-
captureException,
3-
captureMessage,
4-
convertIntegrationFnToClass,
5-
defineIntegration,
6-
getClient,
7-
withScope,
8-
} from '@sentry/core';
9-
import type { CaptureContext, Client, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
1+
import { captureException, captureMessage, defineIntegration, getClient, withScope } from '@sentry/core';
2+
import type { CaptureContext, IntegrationFn } from '@sentry/types';
103
import {
114
CONSOLE_LEVELS,
125
GLOBAL_OBJ,
@@ -45,19 +38,10 @@ const _captureConsoleIntegration = ((options: CaptureConsoleOptions = {}) => {
4538
};
4639
}) satisfies IntegrationFn;
4740

48-
export const captureConsoleIntegration = defineIntegration(_captureConsoleIntegration);
49-
5041
/**
5142
* Send Console API calls as Sentry Events.
52-
* @deprecated Use `captureConsoleIntegration()` instead.
5343
*/
54-
// eslint-disable-next-line deprecation/deprecation
55-
export const CaptureConsole = convertIntegrationFnToClass(
56-
INTEGRATION_NAME,
57-
captureConsoleIntegration,
58-
) as IntegrationClass<Integration & { setup: (client: Client) => void }> & {
59-
new (options?: { levels?: string[] }): Integration;
60-
};
44+
export const captureConsoleIntegration = defineIntegration(_captureConsoleIntegration);
6145

6246
function consoleHandler(args: unknown[], level: string): void {
6347
const captureContext: CaptureContext = {

packages/integrations/src/contextlines.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
2-
import type { Event, Integration, IntegrationClass, IntegrationFn, StackFrame } from '@sentry/types';
1+
import { defineIntegration } from '@sentry/core';
2+
import type { Event, IntegrationFn, StackFrame } from '@sentry/types';
33
import { GLOBAL_OBJ, addContextToFrame, stripUrlQueryAndFragment } from '@sentry/utils';
44

55
const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
@@ -31,8 +31,6 @@ const _contextLinesIntegration = ((options: ContextLinesOptions = {}) => {
3131
};
3232
}) satisfies IntegrationFn;
3333

34-
export const contextLinesIntegration = defineIntegration(_contextLinesIntegration);
35-
3634
/**
3735
* Collects source context lines around the lines of stackframes pointing to JS embedded in
3836
* the current page's HTML.
@@ -43,13 +41,8 @@ export const contextLinesIntegration = defineIntegration(_contextLinesIntegratio
4341
*
4442
* Use this integration if you have inline JS code in HTML pages that can't be accessed
4543
* by our backend (e.g. due to a login-protected page).
46-
*
47-
* @deprecated Use `contextLinesIntegration()` instead.
4844
*/
49-
// eslint-disable-next-line deprecation/deprecation
50-
export const ContextLines = convertIntegrationFnToClass(INTEGRATION_NAME, contextLinesIntegration) as IntegrationClass<
51-
Integration & { processEvent: (event: Event) => Event }
52-
> & { new (options?: { frameContextLines?: number }): Integration };
45+
export const contextLinesIntegration = defineIntegration(_contextLinesIntegration);
5346

5447
/**
5548
* Processes an event and adds context lines.

packages/integrations/src/debug.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
2-
import type { Client, Event, EventHint, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
1+
import { defineIntegration } from '@sentry/core';
2+
import type { Event, EventHint, IntegrationFn } from '@sentry/types';
33
import { consoleSandbox } from '@sentry/utils';
44

55
const INTEGRATION_NAME = 'Debug';
@@ -11,6 +11,10 @@ interface DebugOptions {
1111
debugger?: boolean;
1212
}
1313

14+
/**
15+
* Integration to debug sent Sentry events.
16+
* This integration should not be used in production.
17+
*/
1418
const _debugIntegration = ((options: DebugOptions = {}) => {
1519
const _options = {
1620
debugger: false,
@@ -50,19 +54,3 @@ const _debugIntegration = ((options: DebugOptions = {}) => {
5054
}) satisfies IntegrationFn;
5155

5256
export const debugIntegration = defineIntegration(_debugIntegration);
53-
54-
/**
55-
* Integration to debug sent Sentry events.
56-
* This integration should not be used in production.
57-
*
58-
* @deprecated Use `debugIntegration()` instead.
59-
*/
60-
// eslint-disable-next-line deprecation/deprecation
61-
export const Debug = convertIntegrationFnToClass(INTEGRATION_NAME, debugIntegration) as IntegrationClass<
62-
Integration & { setup: (client: Client) => void }
63-
> & {
64-
new (options?: {
65-
stringify?: boolean;
66-
debugger?: boolean;
67-
}): Integration;
68-
};

packages/integrations/src/dedupe.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
2-
import type { Event, Exception, Integration, IntegrationClass, IntegrationFn, StackFrame } from '@sentry/types';
1+
import { defineIntegration } from '@sentry/core';
2+
import type { Event, Exception, IntegrationFn, StackFrame } from '@sentry/types';
33
import { logger } from '@sentry/utils';
44

55
import { DEBUG_BUILD } from './debug-build';
@@ -33,16 +33,10 @@ const _dedupeIntegration = (() => {
3333
};
3434
}) satisfies IntegrationFn;
3535

36-
export const dedupeIntegration = defineIntegration(_dedupeIntegration);
37-
3836
/**
3937
* Deduplication filter.
40-
* @deprecated Use `dedupeIntegration()` instead.
4138
*/
42-
// eslint-disable-next-line deprecation/deprecation
43-
export const Dedupe = convertIntegrationFnToClass(INTEGRATION_NAME, dedupeIntegration) as IntegrationClass<
44-
Integration & { processEvent: (event: Event) => Event }
45-
>;
39+
export const dedupeIntegration = defineIntegration(_dedupeIntegration);
4640

4741
/** only exported for tests. */
4842
export function _shouldDropEvent(currentEvent: Event, previousEvent?: Event): boolean {

packages/integrations/src/extraerrordata.ts

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
2-
import type {
3-
Contexts,
4-
Event,
5-
EventHint,
6-
ExtendedError,
7-
Integration,
8-
IntegrationClass,
9-
IntegrationFn,
10-
} from '@sentry/types';
1+
import { defineIntegration } from '@sentry/core';
2+
import type { Contexts, Event, EventHint, ExtendedError, IntegrationFn } from '@sentry/types';
113
import { addNonEnumerableProperty, isError, isPlainObject, logger, normalize } from '@sentry/utils';
124

135
import { DEBUG_BUILD } from './debug-build';
@@ -21,19 +13,18 @@ interface ExtraErrorDataOptions {
2113
depth: number;
2214

2315
/**
24-
* Whether to capture error causes.
16+
* Whether to capture error causes. Defaults to true.
2517
*
2618
* More information: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause
2719
*/
2820
captureErrorCause: boolean;
2921
}
3022

23+
/**
24+
* Extract additional data for from original exceptions.
25+
*/
3126
const _extraErrorDataIntegration = ((options: Partial<ExtraErrorDataOptions> = {}) => {
32-
const depth = options.depth || 3;
33-
34-
// TODO(v8): Flip the default for this option to true
35-
const captureErrorCause = options.captureErrorCause || false;
36-
27+
const { depth = 3, captureErrorCause = true } = options;
3728
return {
3829
name: INTEGRATION_NAME,
3930
// TODO v8: Remove this
@@ -46,23 +37,6 @@ const _extraErrorDataIntegration = ((options: Partial<ExtraErrorDataOptions> = {
4637

4738
export const extraErrorDataIntegration = defineIntegration(_extraErrorDataIntegration);
4839

49-
/**
50-
* Extract additional data for from original exceptions.
51-
* @deprecated Use `extraErrorDataIntegration()` instead.
52-
*/
53-
// eslint-disable-next-line deprecation/deprecation
54-
export const ExtraErrorData = convertIntegrationFnToClass(
55-
INTEGRATION_NAME,
56-
extraErrorDataIntegration,
57-
) as IntegrationClass<Integration & { processEvent: (event: Event, hint: EventHint) => Event }> & {
58-
new (
59-
options?: Partial<{
60-
depth: number;
61-
captureErrorCause: boolean;
62-
}>,
63-
): Integration;
64-
};
65-
6640
function _enhanceEventWithErrorData(
6741
event: Event,
6842
hint: EventHint = {},

packages/integrations/src/httpclient.ts

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
1-
import {
2-
captureEvent,
3-
convertIntegrationFnToClass,
4-
defineIntegration,
5-
getClient,
6-
isSentryRequestUrl,
7-
} from '@sentry/core';
8-
import type {
9-
Client,
10-
Event as SentryEvent,
11-
Integration,
12-
IntegrationClass,
13-
IntegrationFn,
14-
SentryWrappedXMLHttpRequest,
15-
} from '@sentry/types';
1+
import { captureEvent, defineIntegration, getClient, isSentryRequestUrl } from '@sentry/core';
2+
import type { Client, Event as SentryEvent, IntegrationFn, SentryWrappedXMLHttpRequest } from '@sentry/types';
163
import {
174
GLOBAL_OBJ,
185
SENTRY_XHR_DATA_KEY,
@@ -69,21 +56,10 @@ const _httpClientIntegration = ((options: Partial<HttpClientOptions> = {}) => {
6956
};
7057
}) satisfies IntegrationFn;
7158

72-
export const httpClientIntegration = defineIntegration(_httpClientIntegration);
73-
7459
/**
7560
* Create events for failed client side HTTP requests.
76-
* @deprecated Use `httpClientIntegration()` instead.
7761
*/
78-
// eslint-disable-next-line deprecation/deprecation
79-
export const HttpClient = convertIntegrationFnToClass(INTEGRATION_NAME, httpClientIntegration) as IntegrationClass<
80-
Integration & { setup: (client: Client) => void }
81-
> & {
82-
new (options?: {
83-
failedRequestStatusCodes: HttpStatusCodeRange[];
84-
failedRequestTargets: HttpRequestTarget[];
85-
}): Integration;
86-
};
62+
export const httpClientIntegration = defineIntegration(_httpClientIntegration);
8763

8864
/**
8965
* Interceptor function for fetch requests

packages/integrations/src/index.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
/* eslint-disable deprecation/deprecation */
2-
export { CaptureConsole, captureConsoleIntegration } from './captureconsole';
3-
export { Debug, debugIntegration } from './debug';
4-
export { Dedupe, dedupeIntegration } from './dedupe';
5-
export { ExtraErrorData, extraErrorDataIntegration } from './extraerrordata';
6-
export { ReportingObserver, reportingObserverIntegration } from './reportingobserver';
7-
export { RewriteFrames, rewriteFramesIntegration } from './rewriteframes';
8-
export { SessionTiming, sessionTimingIntegration } from './sessiontiming';
9-
export { Transaction } from './transaction';
10-
export { HttpClient, httpClientIntegration } from './httpclient';
11-
export { ContextLines, contextLinesIntegration } from './contextlines';
1+
export { captureConsoleIntegration } from './captureconsole';
2+
export { debugIntegration } from './debug';
3+
export { dedupeIntegration } from './dedupe';
4+
export { extraErrorDataIntegration } from './extraerrordata';
5+
export { reportingObserverIntegration } from './reportingobserver';
6+
export { rewriteFramesIntegration } from './rewriteframes';
7+
export { sessionTimingIntegration } from './sessiontiming';
8+
export { httpClientIntegration } from './httpclient';
9+
export { contextLinesIntegration } from './contextlines';

packages/integrations/src/reportingobserver.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { captureMessage, convertIntegrationFnToClass, defineIntegration, getClient, withScope } from '@sentry/core';
2-
import type { Client, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
1+
import { captureMessage, defineIntegration, getClient, withScope } from '@sentry/core';
2+
import type { Client, IntegrationFn } from '@sentry/types';
33
import { GLOBAL_OBJ, supportsReportingObserver } from '@sentry/utils';
44

55
const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
@@ -115,18 +115,7 @@ const _reportingObserverIntegration = ((options: ReportingObserverOptions = {})
115115
};
116116
}) satisfies IntegrationFn;
117117

118-
export const reportingObserverIntegration = defineIntegration(_reportingObserverIntegration);
119-
120118
/**
121119
* Reporting API integration - https://w3c.github.io/reporting/
122-
* @deprecated Use `reportingObserverIntegration()` instead.
123120
*/
124-
// eslint-disable-next-line deprecation/deprecation
125-
export const ReportingObserver = convertIntegrationFnToClass(
126-
INTEGRATION_NAME,
127-
reportingObserverIntegration,
128-
) as IntegrationClass<Integration & { setup: (client: Client) => void }> & {
129-
new (options?: {
130-
types?: ReportTypes[];
131-
}): Integration;
132-
};
121+
export const reportingObserverIntegration = defineIntegration(_reportingObserverIntegration);

packages/integrations/src/rewriteframes.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
2-
import type { Event, Integration, IntegrationClass, IntegrationFn, StackFrame, Stacktrace } from '@sentry/types';
1+
import { defineIntegration } from '@sentry/core';
2+
import type { Event, IntegrationFn, StackFrame, Stacktrace } from '@sentry/types';
33
import { basename, relative } from '@sentry/utils';
44

55
type StackFrameIteratee = (frame: StackFrame) => StackFrame;
@@ -85,16 +85,7 @@ const _rewriteFramesIntegration = ((options: RewriteFramesOptions = {}) => {
8585
};
8686
}) satisfies IntegrationFn;
8787

88-
export const rewriteFramesIntegration = defineIntegration(_rewriteFramesIntegration);
89-
9088
/**
9189
* Rewrite event frames paths.
92-
* @deprecated Use `rewriteFramesIntegration()` instead.
9390
*/
94-
// eslint-disable-next-line deprecation/deprecation
95-
export const RewriteFrames = convertIntegrationFnToClass(
96-
INTEGRATION_NAME,
97-
rewriteFramesIntegration,
98-
) as IntegrationClass<Integration & { processEvent: (event: Event) => Event }> & {
99-
new (options?: { root?: string; prefix?: string; iteratee?: StackFrameIteratee }): Integration;
100-
};
91+
export const rewriteFramesIntegration = defineIntegration(_rewriteFramesIntegration);

packages/integrations/src/sessiontiming.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
2-
import type { Event, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
1+
import { defineIntegration } from '@sentry/core';
2+
import type { IntegrationFn } from '@sentry/types';
33

44
const INTEGRATION_NAME = 'SessionTiming';
55

@@ -26,14 +26,8 @@ const _sessionTimingIntegration = (() => {
2626
};
2727
}) satisfies IntegrationFn;
2828

29-
export const sessionTimingIntegration = defineIntegration(_sessionTimingIntegration);
30-
3129
/**
32-
* This function adds duration since Sentry was initialized till the time event was sent.
33-
* @deprecated Use `sessionTimingIntegration()` instead.
30+
* This function adds duration since the sessionTimingIntegration was initialized
31+
* till the time event was sent.
3432
*/
35-
// eslint-disable-next-line deprecation/deprecation
36-
export const SessionTiming = convertIntegrationFnToClass(
37-
INTEGRATION_NAME,
38-
sessionTimingIntegration,
39-
) as IntegrationClass<Integration & { processEvent: (event: Event) => Event }>;
33+
export const sessionTimingIntegration = defineIntegration(_sessionTimingIntegration);

packages/integrations/src/transaction.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)