123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- import type {Color} from 'sentry/utils/theme';
- export enum BreadcrumbLevelType {
- FATAL = 'fatal',
- ERROR = 'error',
- WARNING = 'warning',
- INFO = 'info',
- DEBUG = 'debug',
- UNDEFINED = 'undefined',
- LOG = 'log',
- }
- export enum BreadcrumbType {
- INFO = 'info',
- DEBUG = 'debug',
- MESSAGE = 'message',
- QUERY = 'query',
- UI = 'ui',
- USER = 'user',
- EXCEPTION = 'exception',
- WARNING = 'warning',
- ERROR = 'error',
- DEFAULT = 'default',
- HTTP = 'http',
- NAVIGATION = 'navigation',
- SYSTEM = 'system',
- SESSION = 'session',
- TRANSACTION = 'transaction',
- INIT = 'init',
- }
- type BreadcrumbTypeBase = {
- level: BreadcrumbLevelType;
- // it's recommended
- category?: string | null;
- event_id?: string | null;
- message?: string;
- timestamp?: string;
- };
- export type BreadcrumbTypeSystem = {
- action: string;
- extras: Record<string, any>;
- type: BreadcrumbType.SYSTEM;
- } & BreadcrumbTypeBase;
- export type BreadcrumbTypeSession = {
- action: string;
- extras: Record<string, any>;
- type: BreadcrumbType.SESSION;
- } & BreadcrumbTypeBase;
- export type BreadcrumbTypeNavigation = {
- type: BreadcrumbType.NAVIGATION;
- data?: null | {
- from?: string;
- to?: string;
- };
- } & BreadcrumbTypeBase;
- export type BreadcrumbTypeHTTP = {
- type: BreadcrumbType.HTTP;
- data?: null | {
- method?:
- | 'POST'
- | 'PUT'
- | 'GET'
- | 'HEAD'
- | 'DELETE'
- | 'CONNECT'
- | 'OPTIONS'
- | 'TRACE'
- | 'PATCH';
- reason?: string;
- status_code?: number;
- url?: string;
- };
- } & BreadcrumbTypeBase;
- export type BreadcrumbTypeDefault = {
- type:
- | BreadcrumbType.INFO
- | BreadcrumbType.DEBUG
- | BreadcrumbType.QUERY
- | BreadcrumbType.UI
- | BreadcrumbType.USER
- | BreadcrumbType.EXCEPTION
- | BreadcrumbType.WARNING
- | BreadcrumbType.ERROR
- | BreadcrumbType.DEFAULT
- | BreadcrumbType.INIT
- | BreadcrumbType.SESSION
- | BreadcrumbType.SYSTEM
- | BreadcrumbType.TRANSACTION;
- data?: Record<string, any> | null;
- } & BreadcrumbTypeBase;
- export type RawCrumb =
- | BreadcrumbTypeNavigation
- | BreadcrumbTypeHTTP
- | BreadcrumbTypeDefault;
- export type Crumb = RawCrumb & {
- color: Color;
- description: string;
- id: number;
- };
- export function isBreadcrumbTypeDefault(
- breadcrumb: RawCrumb
- ): breadcrumb is BreadcrumbTypeDefault {
- return ![BreadcrumbType.HTTP, BreadcrumbType.NAVIGATION].includes(breadcrumb.type);
- }
|