Skip to content

Commit 4bbb853

Browse files
authored
feat(v8/core): Remove deprecated integration classes (#11132)
Removes exports for `ModuleMetadata` and `RequestData`
1 parent 425b114 commit 4bbb853

File tree

8 files changed

+13
-86
lines changed

8 files changed

+13
-86
lines changed

packages/browser/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ export {
7575
getSpanStatusFromHttpCode,
7676
setHttpStatus,
7777
makeMultiplexedTransport,
78-
// eslint-disable-next-line deprecation/deprecation
79-
ModuleMetadata,
8078
moduleMetadataIntegration,
8179
} from '@sentry/core';
8280
export type { Span } from '@sentry/types';

packages/core/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ export {
9494
} from './utils/spanUtils';
9595
export { applySdkMetadata } from './utils/sdkMetadata';
9696
export { DEFAULT_ENVIRONMENT } from './constants';
97-
/* eslint-disable deprecation/deprecation */
98-
export { ModuleMetadata } from './integrations/metadata';
99-
export { RequestData } from './integrations/requestdata';
10097
export { addBreadcrumb } from './breadcrumbs';
10198
export { functionToStringIntegration } from './integrations/functiontostring';
10299
export { inboundFiltersIntegration } from './integrations/inboundfilters';

packages/core/src/integrations/functiontostring.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { Client, Integration, IntegrationClass, IntegrationFn, WrappedFunction } from '@sentry/types';
1+
import type { Client, IntegrationFn, WrappedFunction } from '@sentry/types';
22
import { getOriginalFunction } from '@sentry/utils';
33
import { getClient } from '../currentScopes';
4-
import { convertIntegrationFnToClass, defineIntegration } from '../integration';
4+
import { defineIntegration } from '../integration';
55

66
let originalFunctionToString: () => void;
77

@@ -48,17 +48,3 @@ const _functionToStringIntegration = (() => {
4848
* ```
4949
*/
5050
export const functionToStringIntegration = defineIntegration(_functionToStringIntegration);
51-
52-
/**
53-
* Patch toString calls to return proper name for wrapped functions.
54-
*
55-
* @deprecated Use `functionToStringIntegration()` instead.
56-
*/
57-
// eslint-disable-next-line deprecation/deprecation
58-
export const FunctionToString = convertIntegrationFnToClass(
59-
INTEGRATION_NAME,
60-
functionToStringIntegration,
61-
) as IntegrationClass<Integration & { setupOnce: () => void }>;
62-
63-
// eslint-disable-next-line deprecation/deprecation
64-
export type FunctionToString = typeof FunctionToString;

packages/core/src/integrations/metadata.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { Client, Event, EventHint, EventItem, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
1+
import type { EventItem, IntegrationFn } from '@sentry/types';
22
import { forEachEnvelopeItem } from '@sentry/utils';
3-
import { convertIntegrationFnToClass, defineIntegration } from '../integration';
3+
import { defineIntegration } from '../integration';
44

55
import { addMetadataToStackFrames, stripMetadataFromStackFrames } from '../metadata';
66

@@ -33,8 +33,6 @@ const _moduleMetadataIntegration = (() => {
3333
};
3434
}) satisfies IntegrationFn;
3535

36-
export const moduleMetadataIntegration = defineIntegration(_moduleMetadataIntegration);
37-
3836
/**
3937
* Adds module metadata to stack frames.
4038
*
@@ -43,16 +41,5 @@ export const moduleMetadataIntegration = defineIntegration(_moduleMetadataIntegr
4341
* When this integration is added, the metadata passed to the bundler plugin is added to the stack frames of all events
4442
* under the `module_metadata` property. This can be used to help in tagging or routing of events from different teams
4543
* our sources
46-
*
47-
* @deprecated Use `moduleMetadataIntegration()` instead.
4844
*/
49-
// eslint-disable-next-line deprecation/deprecation
50-
export const ModuleMetadata = convertIntegrationFnToClass(
51-
INTEGRATION_NAME,
52-
moduleMetadataIntegration,
53-
) as IntegrationClass<
54-
Integration & {
55-
setup: (client: Client) => void;
56-
processEvent: (event: Event, hint: EventHint, client: Client) => Event;
57-
}
58-
>;
45+
export const moduleMetadataIntegration = defineIntegration(_moduleMetadataIntegration);

packages/core/src/integrations/requestdata.ts

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
import type {
2-
Client,
3-
Event,
4-
EventHint,
5-
Integration,
6-
IntegrationClass,
7-
IntegrationFn,
8-
Transaction,
9-
} from '@sentry/types';
1+
import type { Client, IntegrationFn, Transaction } from '@sentry/types';
102
import type { AddRequestDataToEventOptions, TransactionNamingScheme } from '@sentry/utils';
113
import { addRequestDataToEvent, extractPathForTransaction } from '@sentry/utils';
12-
import { convertIntegrationFnToClass, defineIntegration } from '../integration';
4+
import { defineIntegration } from '../integration';
135
import { spanToJSON } from '../utils/spanUtils';
146

157
export type RequestDataIntegrationOptions = {
@@ -127,41 +119,11 @@ const _requestDataIntegration = ((options: RequestDataIntegrationOptions = {}) =
127119
};
128120
}) satisfies IntegrationFn;
129121

130-
export const requestDataIntegration = defineIntegration(_requestDataIntegration);
131-
132122
/**
133123
* Add data about a request to an event. Primarily for use in Node-based SDKs, but included in `@sentry/core`
134124
* so it can be used in cross-platform SDKs like `@sentry/nextjs`.
135-
* @deprecated Use `requestDataIntegration()` instead.
136125
*/
137-
// eslint-disable-next-line deprecation/deprecation
138-
export const RequestData = convertIntegrationFnToClass(INTEGRATION_NAME, requestDataIntegration) as IntegrationClass<
139-
Integration & { processEvent: (event: Event, hint: EventHint, client: Client) => Event }
140-
> & {
141-
new (options?: {
142-
/**
143-
* Controls what data is pulled from the request and added to the event
144-
*/
145-
include?: {
146-
cookies?: boolean;
147-
data?: boolean;
148-
headers?: boolean;
149-
ip?: boolean;
150-
query_string?: boolean;
151-
url?: boolean;
152-
user?:
153-
| boolean
154-
| {
155-
id?: boolean;
156-
username?: boolean;
157-
email?: boolean;
158-
};
159-
};
160-
161-
/** Whether to identify transactions by parameterized path, parameterized path with method, or handler name */
162-
transactionNamingScheme?: TransactionNamingScheme;
163-
}): Integration;
164-
};
126+
export const requestDataIntegration = defineIntegration(_requestDataIntegration);
165127

166128
/** Convert this integration's options to match what `addRequestDataToEvent` expects */
167129
/** TODO: Can possibly be deleted once https://github.com/getsentry/sentry-javascript/issues/5718 is fixed */

packages/core/test/lib/integrations/metadata.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Event } from '@sentry/types';
22
import { GLOBAL_OBJ, createStackParser, nodeStackLineParser, parseEnvelope } from '@sentry/utils';
33

4-
import { ModuleMetadata, captureException, createTransport, setCurrentClient } from '../../../src';
4+
import { captureException, createTransport, moduleMetadataIntegration, setCurrentClient } from '../../../src';
55
import { TestClient, getDefaultTestClientOptions } from '../../mocks/client';
66

77
const stackParser = createStackParser(nodeStackLineParser());
@@ -26,8 +26,7 @@ describe('ModuleMetadata integration', () => {
2626
dsn: 'https://username@domain/123',
2727
enableSend: true,
2828
stackParser,
29-
// eslint-disable-next-line deprecation/deprecation
30-
integrations: [new ModuleMetadata()],
29+
integrations: [moduleMetadataIntegration()],
3130
beforeSend: (event, _hint) => {
3231
// copy the frames since reverse in in-place
3332
const lastFrame = [...(event.exception?.values?.[0].stacktrace?.frames || [])].reverse()[0];

packages/core/test/lib/integrations/requestdata.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { IncomingMessage } from 'http';
22
import type { Event, EventProcessor } from '@sentry/types';
33
import * as sentryUtils from '@sentry/utils';
44
import type { RequestDataIntegrationOptions } from '../../../src';
5-
import { RequestData, setCurrentClient } from '../../../src';
5+
import { requestDataIntegration, setCurrentClient } from '../../../src';
66

77
import { TestClient, getDefaultTestClientOptions } from '../../mocks/client';
88

@@ -16,15 +16,14 @@ const path = '/by/the/trees/';
1616
const queryString = 'chase=me&please=thankyou';
1717

1818
function initWithRequestDataIntegrationOptions(integrationOptions: RequestDataIntegrationOptions): EventProcessor {
19-
// eslint-disable-next-line deprecation/deprecation
20-
const requestDataIntegration = new RequestData({
19+
const integration = requestDataIntegration({
2120
...integrationOptions,
2221
});
2322

2423
const client = new TestClient(
2524
getDefaultTestClientOptions({
2625
dsn: 'https://dogsarebadatkeepingsecrets@squirrelchasers.ingest.sentry.io/12312012',
27-
integrations: [requestDataIntegration],
26+
integrations: [integration],
2827
}),
2928
);
3029

packages/node/src/integrations/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export { OnUncaughtException } from './onuncaughtexception';
55
export { OnUnhandledRejection } from './onunhandledrejection';
66
export { Modules } from './modules';
77
export { Context } from './context';
8-
export { RequestData } from '@sentry/core';
98
export { Undici } from './undici';
109
export { Spotlight } from './spotlight';
1110
export { Hapi } from './hapi';

0 commit comments

Comments
 (0)