Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x 1x 1x 5x 5x 5x 2x 2x 3x 3x 3x 3x 3x 3x 3x 3x 3x 5x 2x 2x 5x 1x 1x 2x 2x 1x 1x | import type { DSNInfo } from '../types';
export function parseDSN(dsn: string): DSNInfo {
try {
const match = dsn.match(/^(https?):\/\/([^@]+)@([^/]+)\/(.+)$/);
if (!match) {
throw new Error('Invalid DSN format');
}
const [, protocol, publicKey, host, projectId] = match;
return {
protocol,
publicKey,
host,
projectId,
};
} catch (e) {
throw new Error(`Failed to parse DSN: ${(e as Error).message}`);
}
}
export function getEnvelopeUrl(dsn: DSNInfo): string {
return `${dsn.protocol}://${dsn.host}/api/${dsn.projectId}/envelope/?sentry_key=${dsn.publicKey}`;
}
export function getStoreUrl(dsn: DSNInfo): string {
return `${dsn.protocol}://${dsn.host}/api/${dsn.projectId}/store/?sentry_key=${dsn.publicKey}`;
}
|