Skip to content

Commit 904932f

Browse files
authored
feat(core)!: Remove BaseClient (#17071)
`BaseClient` was deprecated in v9, use `Client` as a direct replacement.
1 parent 6811760 commit 904932f

File tree

4 files changed

+15
-40
lines changed

4 files changed

+15
-40
lines changed

MIGRATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Updates and fixes for version 9 will be published as `SentryNodeServerlessSDKv9`
3636

3737
### `@sentry/core` / All SDKs
3838

39-
- TODO: fill in removed APIs
39+
- `BaseClient` was removed, use `Client` as a direct replacement.
4040

4141
## No Version Support Timeline
4242

packages/core/src/client.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,18 +1246,6 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
12461246
): PromiseLike<Event>;
12471247
}
12481248

1249-
/**
1250-
* @deprecated Use `Client` instead. This alias may be removed in a future major version.
1251-
*/
1252-
// TODO(v10): Remove
1253-
export type BaseClient = Client;
1254-
1255-
/**
1256-
* @deprecated Use `Client` instead. This alias may be removed in a future major version.
1257-
*/
1258-
// TODO(v10): Remove
1259-
export const BaseClient = Client;
1260-
12611249
/**
12621250
* Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.
12631251
*/

packages/core/src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ export { Scope } from './scope';
4949
export type { CaptureContext, ScopeContext, ScopeData } from './scope';
5050
export { notifyEventProcessors } from './eventProcessors';
5151
export { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint } from './api';
52-
export {
53-
Client,
54-
// eslint-disable-next-line deprecation/deprecation
55-
BaseClient,
56-
} from './client';
52+
export { Client } from './client';
5753
export { ServerRuntimeClient } from './server-runtime-client';
5854
export { initAndBind, setCurrentClient } from './sdk';
5955
export { createTransport } from './transports/base';

packages/core/test/lib/client.test.ts

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
SyncPromise,
1212
withMonitor,
1313
} from '../../src';
14-
import type { BaseClient, Client } from '../../src/client';
1514
import * as integrationModule from '../../src/integration';
1615
import type { Envelope } from '../../src/types-hoist/envelope';
1716
import type { ErrorEvent, Event, TransactionEvent } from '../../src/types-hoist/event';
@@ -2107,30 +2106,22 @@ describe('Client', () => {
21072106
describe('hooks', () => {
21082107
const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN });
21092108

2110-
// Make sure types work for both Client & BaseClient
2111-
const scenarios = [
2112-
// eslint-disable-next-line deprecation/deprecation
2113-
['BaseClient', new TestClient(options) as BaseClient],
2114-
['Client', new TestClient(options) as Client],
2115-
] as const;
2116-
2117-
describe.each(scenarios)('with client %s', (_, client) => {
2118-
it('should call a beforeEnvelope hook', () => {
2119-
expect.assertions(1);
2120-
2121-
const mockEnvelope = [
2122-
{
2123-
event_id: '12345',
2124-
},
2125-
{},
2126-
] as Envelope;
2109+
it('should call a beforeEnvelope hook', () => {
2110+
const client = new TestClient(options);
2111+
expect.assertions(1);
21272112

2128-
client.on('beforeEnvelope', envelope => {
2129-
expect(envelope).toEqual(mockEnvelope);
2130-
});
2113+
const mockEnvelope = [
2114+
{
2115+
event_id: '12345',
2116+
},
2117+
{},
2118+
] as Envelope;
21312119

2132-
client.emit('beforeEnvelope', mockEnvelope);
2120+
client.on('beforeEnvelope', envelope => {
2121+
expect(envelope).toEqual(mockEnvelope);
21332122
});
2123+
2124+
client.emit('beforeEnvelope', mockEnvelope);
21342125
});
21352126
});
21362127

0 commit comments

Comments
 (0)