Skip to content

Commit a146349

Browse files
Lms24lobsterkatie
authored andcommitted
ref(backend): Delete Backend classes (#4919)
Delete the Backend classes. Specifically the following classes and files are removed: * `Backend (interface)` * `BaseBackend`* * `BrowserBackend` * `NodeBackend` * `TestBackend`* *`Options` interfaces in these files were moved to the respective Client files Additionally, * delete (the previously ported) `NoopTransport` test in packages/browser/test/unit/backend.test.ts. * adjust a few remaining Backend references in tests to use Client classes * adjust `BaseBackend` documentation to no longer include Backend information
1 parent cd46d3c commit a146349

File tree

16 files changed

+56
-483
lines changed

16 files changed

+56
-483
lines changed

Diff for: packages/browser/src/backend.ts

-83
This file was deleted.

Diff for: packages/browser/src/client.ts

+23-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
11
import { BaseClient, getEnvelopeEndpointWithUrlEncodedAuth, initAPIDetails, Scope, SDK_VERSION } from '@sentry/core';
2-
import { Event, EventHint, Severity, Transport, TransportOptions } from '@sentry/types';
2+
import { Event, EventHint, Options, Severity, Transport, TransportOptions } from '@sentry/types';
33
import { getGlobalObject, logger, supportsFetch } from '@sentry/utils';
44

5-
import { BrowserBackend, BrowserOptions } from './backend';
65
import { eventFromException, eventFromMessage } from './eventbuilder';
76
import { IS_DEBUG_BUILD } from './flags';
87
import { injectReportDialog, ReportDialogOptions } from './helpers';
98
import { Breadcrumbs } from './integrations';
109
import { FetchTransport, makeNewFetchTransport, makeNewXHRTransport, XHRTransport } from './transports';
1110

11+
/**
12+
* Configuration options for the Sentry Browser SDK.
13+
* @see BrowserClient for more information.
14+
*/
15+
export interface BrowserOptions extends Options {
16+
/**
17+
* A pattern for error URLs which should exclusively be sent to Sentry.
18+
* This is the opposite of {@link Options.denyUrls}.
19+
* By default, all errors will be sent.
20+
*/
21+
allowUrls?: Array<string | RegExp>;
22+
23+
/**
24+
* A pattern for error URLs which should not be sent to Sentry.
25+
* To allow certain errors instead, use {@link Options.allowUrls}.
26+
* By default, all errors will be sent.
27+
*/
28+
denyUrls?: Array<string | RegExp>;
29+
}
30+
1231
/**
1332
* The Sentry Browser SDK Client.
1433
*
1534
* @see BrowserOptions for documentation on configuration options.
1635
* @see SentryClient for usage documentation.
17-
* TODO(v7): remove BrowserBackend
1836
*/
19-
export class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
37+
export class BrowserClient extends BaseClient<BrowserOptions> {
2038
/**
2139
* Creates a new Browser SDK instance.
2240
*
@@ -35,8 +53,7 @@ export class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
3553
version: SDK_VERSION,
3654
};
3755

38-
// TODO(v7): remove BrowserBackend param
39-
super(BrowserBackend, options);
56+
super(options);
4057
}
4158

4259
/**

Diff for: packages/browser/src/exports.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ export {
4141
withScope,
4242
} from '@sentry/core';
4343

44-
// TODO(v7): refactor to use client here!
45-
export { BrowserOptions } from './backend';
46-
export { BrowserClient } from './client';
44+
export { BrowserClient, BrowserOptions } from './client';
4745
export { injectReportDialog, ReportDialogOptions } from './helpers';
4846
export { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog, flush, close, wrap } from './sdk';
4947
export { SDK_NAME } from './version';

Diff for: packages/browser/src/sdk.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { getCurrentHub, initAndBind, Integrations as CoreIntegrations } from '@s
22
import { Hub } from '@sentry/types';
33
import { addInstrumentationHandler, getGlobalObject, logger, resolvedSyncPromise } from '@sentry/utils';
44

5-
import { BrowserOptions } from './backend';
6-
import { BrowserClient } from './client';
5+
import { BrowserClient, BrowserOptions } from './client';
76
import { IS_DEBUG_BUILD } from './flags';
87
import { ReportDialogOptions, wrap as internalWrap } from './helpers';
98
import { Breadcrumbs, Dedupe, GlobalHandlers, LinkedErrors, TryCatch, UserAgent } from './integrations';

Diff for: packages/browser/test/unit/backend.test.ts

-14
This file was deleted.

Diff for: packages/browser/test/unit/integrations/linkederrors.test.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ExtendedError } from '@sentry/types';
22

3-
import { BrowserBackend } from '../../../src/backend';
3+
import { BrowserClient } from '../../../src/client';
44
import * as LinkedErrorsModule from '../../../src/integrations/linkederrors';
55

66
describe('LinkedErrors', () => {
@@ -34,9 +34,8 @@ describe('LinkedErrors', () => {
3434
one.cause = two;
3535

3636
const originalException = one;
37-
// TODO(v7): refactor to use client here!
38-
const backend = new BrowserBackend({});
39-
return backend.eventFromException(originalException).then(event => {
37+
const client = new BrowserClient({});
38+
return client.eventFromException(originalException).then(event => {
4039
const result = LinkedErrorsModule._handler('cause', 5, event, {
4140
originalException,
4241
});
@@ -65,9 +64,8 @@ describe('LinkedErrors', () => {
6564
one.reason = two;
6665

6766
const originalException = one;
68-
const backend = new BrowserBackend({});
69-
// TODO(v7): refactor to use client here!
70-
return backend.eventFromException(originalException).then(event => {
67+
const client = new BrowserClient({});
68+
return client.eventFromException(originalException).then(event => {
7169
const result = LinkedErrorsModule._handler('reason', 5, event, {
7270
originalException,
7371
});
@@ -92,10 +90,9 @@ describe('LinkedErrors', () => {
9290
one.cause = two;
9391
two.cause = three;
9492

95-
const backend = new BrowserBackend({});
93+
const client = new BrowserClient({});
9694
const originalException = one;
97-
// TODO(v7): refactor to use client here!
98-
return backend.eventFromException(originalException).then(event => {
95+
return client.eventFromException(originalException).then(event => {
9996
const result = LinkedErrorsModule._handler('cause', 2, event, {
10097
originalException,
10198
});

Diff for: packages/core/src/basebackend.ts

-161
This file was deleted.

0 commit comments

Comments
 (0)