Skip to content

Commit b8fc724

Browse files
committed
types: Move DSN related types/interfaces to @types
1 parent 7cb255d commit b8fc724

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

packages/core/src/dsn.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,9 @@
1+
import { DSNComponents, DSNLike, DSNProtocol } from '@sentry/types';
12
import { SentryError } from './error';
23

34
/** Regular expression used to parse a DSN. */
45
const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w\.-]+)(?::(\d+))?\/(.+)/;
56

6-
/** Supported Sentry transport protocols in a DSN. */
7-
export type DSNProtocol = 'http' | 'https';
8-
9-
/** Primitive components of a DSN. */
10-
export interface DSNComponents {
11-
/** Protocol used to connect to Sentry. */
12-
protocol: DSNProtocol;
13-
/** Public authorization key. */
14-
user: string;
15-
/** Private authorization key (deprecated, optional). */
16-
pass?: string;
17-
/** Hostname of the Sentry instance. */
18-
host: string;
19-
/** Port of the Sentry instance. */
20-
port?: string;
21-
/** Project path */
22-
path: string;
23-
}
24-
25-
/** Anything that can be parsed into a DSN. */
26-
export type DSNLike = string | DSNComponents;
27-
287
/** The Sentry DSN, identifying a Sentry instance and project. */
298
export class DSN implements DSNComponents {
309
/** Protocol used to connect to Sentry. */

packages/core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export {
55
} from '@sentry/minimal';
66
export { Hub, Scope } from '@sentry/hub';
77
export { BackendClass, BaseClient } from './base';
8-
export { DSN, DSNComponents, DSNLike, DSNProtocol } from './dsn';
8+
export { DSN } from './dsn';
99
export { SentryError } from './error';
1010
export { Backend, Client, LogLevel, Options } from './interfaces';
1111
export { initAndBind, ClientClass } from './sdk';

packages/types/src/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/** Supported Sentry transport protocols in a DSN. */
2+
export type DSNProtocol = 'http' | 'https';
3+
4+
/** Primitive components of a DSN. */
5+
export interface DSNComponents {
6+
/** Protocol used to connect to Sentry. */
7+
protocol: DSNProtocol;
8+
/** Public authorization key. */
9+
user: string;
10+
/** Private authorization key (deprecated, optional). */
11+
pass?: string;
12+
/** Hostname of the Sentry instance. */
13+
host: string;
14+
/** Port of the Sentry instance. */
15+
port?: string;
16+
/** Project path */
17+
path: string;
18+
}
19+
20+
/** Anything that can be parsed into a DSN. */
21+
export type DSNLike = string | DSNComponents;
22+
123
/** TODO */
224
export enum Severity {
325
/** TODO */

0 commit comments

Comments
 (0)