Skip to content

Commit 716f779

Browse files
committed
feat(v8/core): Remove deprecated client.setupIntegrations method
1 parent a99f260 commit 716f779

File tree

4 files changed

+2
-90
lines changed

4 files changed

+2
-90
lines changed

packages/core/src/baseclient.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
100100
/** Array of set up integrations. */
101101
protected _integrations: IntegrationIndex;
102102

103-
/** Indicates whether this client's integrations have been set up. */
104-
protected _integrationsInitialized: boolean;
105-
106103
/** Number of calls being processed */
107104
protected _numProcessing: number;
108105

@@ -122,7 +119,6 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
122119
protected constructor(options: O) {
123120
this._options = options;
124121
this._integrations = {};
125-
this._integrationsInitialized = false;
126122
this._numProcessing = 0;
127123
this._outcomes = {};
128124
this._hooks = {};
@@ -303,16 +299,6 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
303299
this._eventProcessors.push(eventProcessor);
304300
}
305301

306-
/**
307-
* This is an internal function to setup all integrations that should run on the client.
308-
* @deprecated Use `client.init()` instead.
309-
*/
310-
public setupIntegrations(forceInitialize?: boolean): void {
311-
if ((forceInitialize && !this._integrationsInitialized) || (this._isEnabled() && !this._integrationsInitialized)) {
312-
this._setupIntegrations();
313-
}
314-
}
315-
316302
/** @inheritdoc */
317303
public init(): void {
318304
if (this._isEnabled()) {
@@ -533,9 +519,6 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
533519
const { integrations } = this._options;
534520
this._integrations = setupIntegrations(this, integrations);
535521
afterSetupIntegrations(this, integrations);
536-
537-
// TODO v8: We don't need this flag anymore
538-
this._integrationsInitialized = true;
539522
}
540523

541524
/** Updates existing session based on the provided event */

packages/core/src/hub.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,8 @@ export class Hub implements HubInterface {
165165
const top = this.getStackTop();
166166
top.client = client;
167167
top.scope.setClient(client);
168-
// eslint-disable-next-line deprecation/deprecation
169-
if (client && client.setupIntegrations) {
170-
// eslint-disable-next-line deprecation/deprecation
171-
client.setupIntegrations();
168+
if (client) {
169+
client.init();
172170
}
173171
}
174172

packages/core/test/lib/base.test.ts

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,18 +1471,6 @@ describe('BaseClient', () => {
14711471
global.__SENTRY__ = {};
14721472
});
14731473

1474-
test('sets up each integration on `setupIntegrations` call', () => {
1475-
expect.assertions(2);
1476-
1477-
const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, integrations: [new TestIntegration()] });
1478-
const client = new TestClient(options);
1479-
// eslint-disable-next-line deprecation/deprecation
1480-
client.setupIntegrations();
1481-
1482-
expect(Object.keys((client as any)._integrations).length).toEqual(1);
1483-
expect(client.getIntegrationByName(TestIntegration.id)).toBeTruthy();
1484-
});
1485-
14861474
test('sets up each integration on `init` call', () => {
14871475
expect.assertions(2);
14881476

@@ -1494,18 +1482,6 @@ describe('BaseClient', () => {
14941482
expect(client.getIntegrationByName(TestIntegration.id)).toBeTruthy();
14951483
});
14961484

1497-
test('skips installation for `setupIntegrations()` if DSN is not provided', () => {
1498-
expect.assertions(2);
1499-
1500-
const options = getDefaultTestClientOptions({ integrations: [new TestIntegration()] });
1501-
const client = new TestClient(options);
1502-
// eslint-disable-next-line deprecation/deprecation
1503-
client.setupIntegrations();
1504-
1505-
expect(Object.keys((client as any)._integrations).length).toEqual(0);
1506-
expect(client.getIntegrationByName(TestIntegration.id)).toBeFalsy();
1507-
});
1508-
15091485
test('skips installation for `init()` if DSN is not provided', () => {
15101486
expect.assertions(2);
15111487

@@ -1517,22 +1493,6 @@ describe('BaseClient', () => {
15171493
expect(client.getIntegrationByName(TestIntegration.id)).toBeFalsy();
15181494
});
15191495

1520-
test('skips installation for `setupIntegrations()` if `enabled` is set to `false`', () => {
1521-
expect.assertions(2);
1522-
1523-
const options = getDefaultTestClientOptions({
1524-
dsn: PUBLIC_DSN,
1525-
enabled: false,
1526-
integrations: [new TestIntegration()],
1527-
});
1528-
const client = new TestClient(options);
1529-
// eslint-disable-next-line deprecation/deprecation
1530-
client.setupIntegrations();
1531-
1532-
expect(Object.keys((client as any)._integrations).length).toEqual(0);
1533-
expect(client.getIntegrationByName(TestIntegration.id)).toBeFalsy();
1534-
});
1535-
15361496
test('skips installation for `init()` if `enabled` is set to `false`', () => {
15371497
expect.assertions(2);
15381498

@@ -1548,29 +1508,6 @@ describe('BaseClient', () => {
15481508
expect(client.getIntegrationByName(TestIntegration.id)).toBeFalsy();
15491509
});
15501510

1551-
test('skips installation if integrations are already installed', () => {
1552-
expect.assertions(4);
1553-
1554-
const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, integrations: [new TestIntegration()] });
1555-
const client = new TestClient(options);
1556-
// note: not the `Client` method `setupIntegrations`, but the free-standing function which that method calls
1557-
const setupIntegrationsHelper = jest.spyOn(integrationModule, 'setupIntegrations');
1558-
1559-
// it should install the first time, because integrations aren't yet installed...
1560-
// eslint-disable-next-line deprecation/deprecation
1561-
client.setupIntegrations();
1562-
1563-
expect(Object.keys((client as any)._integrations).length).toEqual(1);
1564-
expect(client.getIntegrationByName(TestIntegration.id)).toBeTruthy();
1565-
expect(setupIntegrationsHelper).toHaveBeenCalledTimes(1);
1566-
1567-
// ...but it shouldn't try to install a second time
1568-
// eslint-disable-next-line deprecation/deprecation
1569-
client.setupIntegrations();
1570-
1571-
expect(setupIntegrationsHelper).toHaveBeenCalledTimes(1);
1572-
});
1573-
15741511
test('does not add integrations twice when calling `init` multiple times', () => {
15751512
const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, integrations: [new TestIntegration()] });
15761513
const client = new TestClient(options);

packages/types/src/client.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,6 @@ export interface Client<O extends ClientOptions = ClientOptions> {
139139
* */
140140
addIntegration(integration: Integration): void;
141141

142-
/**
143-
* This is an internal function to setup all integrations that should run on the client.
144-
* @deprecated Use `client.init()` instead.
145-
*/
146-
setupIntegrations(forceInitialize?: boolean): void;
147-
148142
/**
149143
* Initialize this client.
150144
* Call this after the client was set on a scope.

0 commit comments

Comments
 (0)