Skip to content

Commit 9cc9195

Browse files
committed
feat: Delete API Details
1 parent f028f92 commit 9cc9195

File tree

4 files changed

+10
-48
lines changed

4 files changed

+10
-48
lines changed

packages/core/src/api.ts

+1-25
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,8 @@
1-
import { DsnComponents, DsnLike, SdkMetadata } from '@sentry/types';
1+
import { DsnComponents, DsnLike } from '@sentry/types';
22
import { dsnToString, makeDsn, urlEncode } from '@sentry/utils';
33

44
const SENTRY_API_VERSION = '7';
55

6-
/**
7-
* Stores details about a Sentry SDK
8-
*/
9-
export interface APIDetails {
10-
/** The DSN as passed to Sentry.init() */
11-
initDsn: DsnLike;
12-
/** Metadata about the SDK (name, version, etc) for inclusion in envelope headers */
13-
metadata: SdkMetadata;
14-
/** The internally used Dsn object. */
15-
readonly dsn: DsnComponents;
16-
/** The envelope tunnel to use. */
17-
readonly tunnel?: string;
18-
}
19-
20-
/** Initializes API Details */
21-
export function initAPIDetails(dsn: DsnLike, metadata?: SdkMetadata, tunnel?: string): APIDetails {
22-
return {
23-
initDsn: dsn,
24-
metadata: metadata || {},
25-
dsn: makeDsn(dsn),
26-
tunnel,
27-
} as APIDetails;
28-
}
29-
306
/** Returns the prefix to construct Sentry ingestion API endpoints. */
317
function getBaseApiEndpoint(dsn: DsnComponents): string {
328
const protocol = dsn.protocol ? `${dsn.protocol}:` : '';

packages/core/src/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export type { APIDetails } from './api';
21
export type { ClientClass } from './sdk';
32

43
export {
@@ -17,7 +16,7 @@ export {
1716
withScope,
1817
} from '@sentry/minimal';
1918
export { addGlobalEventProcessor, getCurrentHub, getHubFromCarrier, Hub, makeMain, Scope, Session } from '@sentry/hub';
20-
export { getEnvelopeEndpointWithUrlEncodedAuth, initAPIDetails, getReportDialogEndpoint } from './api';
19+
export { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint } from './api';
2120
export { BaseClient } from './baseclient';
2221
export { initAndBind } from './sdk';
2322
export { createTransport } from './transports/base';

packages/core/test/lib/api.test.ts

+8-17
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
/* eslint-disable deprecation/deprecation */
21
import { makeDsn } from '@sentry/utils';
32

4-
import { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint, initAPIDetails } from '../../src/api';
3+
import { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint } from '../../src/api';
54

65
const ingestDsn = 'https://[email protected]:1234/subpath/123';
76
const dsnPublic = 'https://[email protected]:1234/subpath/123';
87
const legacyDsn = 'https://abc:[email protected]:1234/subpath/123';
98
const tunnel = 'https://hello.com/world';
109

11-
const ingestDsnAPI = initAPIDetails(ingestDsn);
12-
const dsnPublicAPI = initAPIDetails(dsnPublic);
10+
const ingestDsnComponents = makeDsn(ingestDsn);
11+
const dsnPublicComponents = makeDsn(dsnPublic);
1312

1413
describe('API', () => {
1514
test('getEnvelopeEndpoint', () => {
16-
expect(getEnvelopeEndpointWithUrlEncodedAuth(dsnPublicAPI.dsn)).toEqual(
15+
expect(getEnvelopeEndpointWithUrlEncodedAuth(dsnPublicComponents)).toEqual(
1716
'https://sentry.io:1234/subpath/api/123/envelope/?sentry_key=abc&sentry_version=7',
1817
);
19-
const dsnPublicAPIWithTunnel = initAPIDetails(dsnPublic, {}, tunnel);
20-
expect(getEnvelopeEndpointWithUrlEncodedAuth(dsnPublicAPIWithTunnel.dsn, tunnel)).toEqual(tunnel);
18+
});
19+
20+
test('getEnvelopeEndpoint with tunnel', () => {
21+
expect(getEnvelopeEndpointWithUrlEncodedAuth(dsnPublicComponents, tunnel)).toEqual(tunnel);
2122
});
2223

2324
describe('getReportDialogEndpoint', () => {
@@ -99,14 +100,4 @@ describe('API', () => {
99100
},
100101
);
101102
});
102-
103-
test('initAPIDetails dsn', () => {
104-
expect(dsnPublicAPI.dsn.host).toEqual(makeDsn(dsnPublic).host);
105-
expect(dsnPublicAPI.dsn.path).toEqual(makeDsn(dsnPublic).path);
106-
expect(dsnPublicAPI.dsn.pass).toEqual(makeDsn(dsnPublic).pass);
107-
expect(dsnPublicAPI.dsn.port).toEqual(makeDsn(dsnPublic).port);
108-
expect(dsnPublicAPI.dsn.protocol).toEqual(makeDsn(dsnPublic).protocol);
109-
expect(dsnPublicAPI.dsn.projectId).toEqual(makeDsn(dsnPublic).projectId);
110-
expect(dsnPublicAPI.dsn.publicKey).toEqual(makeDsn(dsnPublic).publicKey);
111-
});
112103
});

packages/node/test/transports/http.test.ts

-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import { EventEnvelope, EventItem } from '@sentry/types';
33
import { createEnvelope, serializeEnvelope } from '@sentry/utils';
44
import * as http from 'http';
55

6-
<<<<<<< HEAD
76
import { makeNodeTransport } from '../../src/transports';
8-
=======
9-
import { makeNodeTransport } from '../../../src/transports';
10-
>>>>>>> 817a118ac (feat: Delete old transports)
117

128
jest.mock('@sentry/core', () => {
139
const actualCore = jest.requireActual('@sentry/core');

0 commit comments

Comments
 (0)