group.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874
  1. import type {SearchGroup} from 'sentry/components/smartSearchBar/types';
  2. import type {FieldKind} from 'sentry/utils/fields';
  3. import type {Actor, TimeseriesValue} from './core';
  4. import type {Event, EventMetadata, EventOrGroupType, Level} from './event';
  5. import type {Commit, PullRequest, Repository} from './integrations';
  6. import type {Team} from './organization';
  7. import type {PlatformKey, Project} from './project';
  8. import type {AvatarUser, User} from './user';
  9. export type EntryData = Record<string, any | Array<any>>;
  10. /**
  11. * Saved issues searches
  12. */
  13. export type RecentSearch = {
  14. dateCreated: string;
  15. id: string;
  16. lastSeen: string;
  17. organizationId: string;
  18. query: string;
  19. type: SavedSearchType;
  20. };
  21. // XXX: Deprecated Sentry 9 attributes are not included here.
  22. export type SavedSearch = {
  23. dateCreated: string;
  24. id: string;
  25. isGlobal: boolean;
  26. isPinned: boolean;
  27. name: string;
  28. query: string;
  29. sort: string;
  30. type: SavedSearchType;
  31. visibility: SavedSearchVisibility;
  32. };
  33. export enum SavedSearchVisibility {
  34. ORGANIZATION = 'organization',
  35. OWNER = 'owner',
  36. OWNER_PINNED = 'owner_pinned',
  37. }
  38. export enum SavedSearchType {
  39. ISSUE = 0,
  40. EVENT = 1,
  41. SESSION = 2,
  42. REPLAY = 3,
  43. METRIC = 4,
  44. }
  45. export enum IssueCategory {
  46. PERFORMANCE = 'performance',
  47. ERROR = 'error',
  48. CRON = 'cron',
  49. PROFILE = 'profile',
  50. }
  51. export enum IssueType {
  52. // Error
  53. ERROR = 'error',
  54. // Performance
  55. PERFORMANCE_CONSECUTIVE_DB_QUERIES = 'performance_consecutive_db_queries',
  56. PERFORMANCE_CONSECUTIVE_HTTP = 'performance_consecutive_http',
  57. PERFORMANCE_FILE_IO_MAIN_THREAD = 'performance_file_io_main_thread',
  58. PERFORMANCE_DB_MAIN_THREAD = 'performance_db_main_thread',
  59. PERFORMANCE_N_PLUS_ONE_API_CALLS = 'performance_n_plus_one_api_calls',
  60. PERFORMANCE_N_PLUS_ONE_DB_QUERIES = 'performance_n_plus_one_db_queries',
  61. PERFORMANCE_SLOW_DB_QUERY = 'performance_slow_db_query',
  62. PERFORMANCE_RENDER_BLOCKING_ASSET = 'performance_render_blocking_asset_span',
  63. PERFORMANCE_UNCOMPRESSED_ASSET = 'performance_uncompressed_assets',
  64. PERFORMANCE_LARGE_HTTP_PAYLOAD = 'performance_large_http_payload',
  65. PERFORMANCE_HTTP_OVERHEAD = 'performance_http_overhead',
  66. PERFORMANCE_DURATION_REGRESSION = 'performance_duration_regression',
  67. PERFORMANCE_ENDPOINT_REGRESSION = 'performance_p95_endpoint_regression',
  68. // Profile
  69. PROFILE_FILE_IO_MAIN_THREAD = 'profile_file_io_main_thread',
  70. PROFILE_IMAGE_DECODE_MAIN_THREAD = 'profile_image_decode_main_thread',
  71. PROFILE_JSON_DECODE_MAIN_THREAD = 'profile_json_decode_main_thread',
  72. PROFILE_REGEX_MAIN_THREAD = 'profile_regex_main_thread',
  73. PROFILE_FRAME_DROP = 'profile_frame_drop',
  74. PROFILE_FRAME_DROP_EXPERIMENTAL = 'profile_frame_drop_experimental',
  75. PROFILE_FUNCTION_REGRESSION = 'profile_function_regression',
  76. PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL = 'profile_function_regression_exp',
  77. }
  78. export enum IssueTitle {
  79. PERFORMANCE_CONSECUTIVE_DB_QUERIES = 'Consecutive DB Queries',
  80. PERFORMANCE_CONSECUTIVE_HTTP = 'Consecutive HTTP',
  81. PERFORMANCE_FILE_IO_MAIN_THREAD = 'File IO on Main Thread',
  82. PERFORMANCE_DB_MAIN_THREAD = 'DB on Main Thread',
  83. PERFORMANCE_N_PLUS_ONE_API_CALLS = 'N+1 API Call',
  84. PERFORMANCE_N_PLUS_ONE_DB_QUERIES = 'N+1 Query',
  85. PERFORMANCE_SLOW_DB_QUERY = 'Slow DB Query',
  86. PERFORMANCE_RENDER_BLOCKING_ASSET = 'Large Render Blocking Asset',
  87. PERFORMANCE_UNCOMPRESSED_ASSET = 'Uncompressed Asset',
  88. PERFORMANCE_LARGE_HTTP_PAYLOAD = 'Large HTTP payload',
  89. PERFORMANCE_HTTP_OVERHEAD = 'HTTP/1.1 Overhead',
  90. PERFORMANCE_DURATION_REGRESSION = 'Duration Regression',
  91. }
  92. const OCCURRENCE_TYPE_TO_ISSUE_TYPE = {
  93. 1001: IssueType.PERFORMANCE_SLOW_DB_QUERY,
  94. 1004: IssueType.PERFORMANCE_RENDER_BLOCKING_ASSET,
  95. 1006: IssueType.PERFORMANCE_N_PLUS_ONE_DB_QUERIES,
  96. 1007: IssueType.PERFORMANCE_CONSECUTIVE_DB_QUERIES,
  97. 1008: IssueType.PERFORMANCE_FILE_IO_MAIN_THREAD,
  98. 1009: IssueType.PERFORMANCE_CONSECUTIVE_HTTP,
  99. 1010: IssueType.PERFORMANCE_N_PLUS_ONE_API_CALLS,
  100. 1012: IssueType.PERFORMANCE_UNCOMPRESSED_ASSET,
  101. 1013: IssueType.PERFORMANCE_DB_MAIN_THREAD,
  102. 1015: IssueType.PERFORMANCE_LARGE_HTTP_PAYLOAD,
  103. 1016: IssueType.PERFORMANCE_HTTP_OVERHEAD,
  104. 1017: IssueType.PERFORMANCE_DURATION_REGRESSION,
  105. 1018: IssueType.PERFORMANCE_ENDPOINT_REGRESSION,
  106. 2001: IssueType.PROFILE_FILE_IO_MAIN_THREAD,
  107. 2002: IssueType.PROFILE_IMAGE_DECODE_MAIN_THREAD,
  108. 2003: IssueType.PROFILE_JSON_DECODE_MAIN_THREAD,
  109. 2007: IssueType.PROFILE_REGEX_MAIN_THREAD,
  110. 2008: IssueType.PROFILE_FRAME_DROP,
  111. 2009: IssueType.PROFILE_FRAME_DROP_EXPERIMENTAL,
  112. 2010: IssueType.PROFILE_FUNCTION_REGRESSION,
  113. 2011: IssueType.PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL,
  114. };
  115. const PERFORMANCE_REGRESSION_TYPE_IDS = new Set([1017, 1018, 2010, 2011]);
  116. export function getIssueTypeFromOccurrenceType(
  117. typeId: number | undefined
  118. ): IssueType | null {
  119. if (!typeId) {
  120. return null;
  121. }
  122. return OCCURRENCE_TYPE_TO_ISSUE_TYPE[typeId] ?? null;
  123. }
  124. export function isTransactionBased(typeId: number | undefined): boolean {
  125. if (!typeId) {
  126. return false;
  127. }
  128. // the 1xxx type ids are transaction based performance issues
  129. return typeId >= 1000 && typeId < 2000;
  130. }
  131. export function isOccurrenceBased(typeId: number | undefined): boolean {
  132. if (!typeId) {
  133. return false;
  134. }
  135. // these are regression type performance issues
  136. return !PERFORMANCE_REGRESSION_TYPE_IDS.has(typeId);
  137. }
  138. // endpoint: /api/0/issues/:issueId/attachments/?limit=50
  139. export type IssueAttachment = {
  140. dateCreated: string;
  141. event_id: string;
  142. headers: object;
  143. id: string;
  144. mimetype: string;
  145. name: string;
  146. sha1: string;
  147. size: number;
  148. type: string;
  149. };
  150. // endpoint: /api/0/projects/:orgSlug/:projSlug/events/:eventId/attachments/
  151. export type EventAttachment = IssueAttachment;
  152. /**
  153. * Issue Tags
  154. */
  155. export type Tag = {
  156. key: string;
  157. name: string;
  158. isInput?: boolean;
  159. kind?: FieldKind;
  160. /**
  161. * How many values should be suggested in autocomplete.
  162. * Overrides SmartSearchBar's `maxSearchItems` prop.
  163. */
  164. maxSuggestedValues?: number;
  165. predefined?: boolean;
  166. totalValues?: number;
  167. /**
  168. * Usually values are strings, but a predefined tag can define its SearchGroups
  169. */
  170. values?: string[] | SearchGroup[];
  171. };
  172. export type TagCollection = Record<string, Tag>;
  173. export type TagValue = {
  174. count: number;
  175. firstSeen: string;
  176. lastSeen: string;
  177. name: string;
  178. value: string;
  179. email?: string;
  180. identifier?: string;
  181. ipAddress?: string;
  182. key?: string;
  183. query?: string;
  184. username?: string;
  185. } & AvatarUser;
  186. type Topvalue = {
  187. count: number;
  188. firstSeen: string;
  189. key: string;
  190. lastSeen: string;
  191. name: string;
  192. value: string;
  193. // Might not actually exist.
  194. query?: string;
  195. readable?: string;
  196. };
  197. export type TagWithTopValues = {
  198. key: string;
  199. name: string;
  200. topValues: Array<Topvalue>;
  201. totalValues: number;
  202. uniqueValues: number;
  203. canDelete?: boolean;
  204. };
  205. /**
  206. * Inbox, issue owners and Activity
  207. */
  208. export type InboxReasonDetails = {
  209. count?: number | null;
  210. until?: string | null;
  211. user_count?: number | null;
  212. user_window?: number | null;
  213. window?: number | null;
  214. };
  215. export const enum GroupInboxReason {
  216. NEW = 0,
  217. UNIGNORED = 1,
  218. REGRESSION = 2,
  219. MANUAL = 3,
  220. REPROCESSED = 4,
  221. ESCALATING = 5,
  222. ONGOING = 6,
  223. }
  224. export type InboxDetails = {
  225. date_added?: string;
  226. reason?: GroupInboxReason;
  227. reason_details?: InboxReasonDetails | null;
  228. };
  229. export type SuggestedOwnerReason =
  230. | 'suspectCommit'
  231. | 'ownershipRule'
  232. | 'projectOwnership'
  233. // TODO: codeowners may no longer exist
  234. | 'codeowners';
  235. // Received from the backend to denote suggested owners of an issue
  236. export type SuggestedOwner = {
  237. date_added: string;
  238. owner: string;
  239. type: SuggestedOwnerReason;
  240. };
  241. export interface ParsedOwnershipRule {
  242. matcher: {pattern: string; type: string};
  243. owners: Actor[];
  244. }
  245. export type IssueOwnership = {
  246. autoAssignment:
  247. | 'Auto Assign to Suspect Commits'
  248. | 'Auto Assign to Issue Owner'
  249. | 'Turn off Auto-Assignment';
  250. codeownersAutoSync: boolean;
  251. dateCreated: string | null;
  252. fallthrough: boolean;
  253. isActive: boolean;
  254. lastUpdated: string | null;
  255. raw: string | null;
  256. schema?: {rules: ParsedOwnershipRule[]; version: number};
  257. };
  258. export enum GroupActivityType {
  259. NOTE = 'note',
  260. SET_RESOLVED = 'set_resolved',
  261. SET_RESOLVED_BY_AGE = 'set_resolved_by_age',
  262. SET_RESOLVED_IN_RELEASE = 'set_resolved_in_release',
  263. SET_RESOLVED_IN_COMMIT = 'set_resolved_in_commit',
  264. SET_RESOLVED_IN_PULL_REQUEST = 'set_resolved_in_pull_request',
  265. SET_UNRESOLVED = 'set_unresolved',
  266. SET_IGNORED = 'set_ignored',
  267. SET_PUBLIC = 'set_public',
  268. SET_PRIVATE = 'set_private',
  269. SET_REGRESSION = 'set_regression',
  270. CREATE_ISSUE = 'create_issue',
  271. UNMERGE_SOURCE = 'unmerge_source',
  272. UNMERGE_DESTINATION = 'unmerge_destination',
  273. FIRST_SEEN = 'first_seen',
  274. ASSIGNED = 'assigned',
  275. UNASSIGNED = 'unassigned',
  276. MERGE = 'merge',
  277. REPROCESS = 'reprocess',
  278. MARK_REVIEWED = 'mark_reviewed',
  279. AUTO_SET_ONGOING = 'auto_set_ongoing',
  280. SET_ESCALATING = 'set_escalating',
  281. SET_PRIORITY = 'set_priority',
  282. }
  283. interface GroupActivityBase {
  284. dateCreated: string;
  285. id: string;
  286. project: Project;
  287. assignee?: string;
  288. issue?: Group;
  289. user?: null | User;
  290. }
  291. export interface GroupActivityNote extends GroupActivityBase {
  292. data: {
  293. text: string;
  294. };
  295. type: GroupActivityType.NOTE;
  296. }
  297. interface GroupActivitySetResolved extends GroupActivityBase {
  298. data: Record<string, unknown>;
  299. type: GroupActivityType.SET_RESOLVED;
  300. }
  301. /**
  302. * An integration marks an issue as resolved
  303. */
  304. interface GroupActivitySetResolvedIntegration extends GroupActivityBase {
  305. data: {
  306. integration_id: number;
  307. /**
  308. * Human readable name of the integration
  309. */
  310. provider: string;
  311. /**
  312. * The key of the integration
  313. */
  314. provider_key: string;
  315. };
  316. type: GroupActivityType.SET_RESOLVED;
  317. }
  318. interface GroupActivitySetUnresolved extends GroupActivityBase {
  319. data: Record<string, unknown>;
  320. type: GroupActivityType.SET_UNRESOLVED;
  321. }
  322. interface GroupActivitySetUnresolvedForecast extends GroupActivityBase {
  323. data: {
  324. forecast: number;
  325. };
  326. type: GroupActivityType.SET_UNRESOLVED;
  327. }
  328. /**
  329. * An integration marks an issue as unresolved
  330. */
  331. interface GroupActivitySetUnresolvedIntegration extends GroupActivityBase {
  332. data: {
  333. integration_id: number;
  334. /**
  335. * Human readable name of the integration
  336. */
  337. provider: string;
  338. /**
  339. * The key of the integration
  340. */
  341. provider_key: string;
  342. };
  343. type: GroupActivityType.SET_UNRESOLVED;
  344. }
  345. interface GroupActivitySetPublic extends GroupActivityBase {
  346. data: Record<string, any>;
  347. type: GroupActivityType.SET_PUBLIC;
  348. }
  349. interface GroupActivitySetPrivate extends GroupActivityBase {
  350. data: Record<string, any>;
  351. type: GroupActivityType.SET_PRIVATE;
  352. }
  353. interface GroupActivitySetByAge extends GroupActivityBase {
  354. data: Record<string, any>;
  355. type: GroupActivityType.SET_RESOLVED_BY_AGE;
  356. }
  357. interface GroupActivityUnassigned extends GroupActivityBase {
  358. data: Record<string, any>;
  359. type: GroupActivityType.UNASSIGNED;
  360. }
  361. interface GroupActivityFirstSeen extends GroupActivityBase {
  362. data: Record<string, any>;
  363. type: GroupActivityType.FIRST_SEEN;
  364. }
  365. interface GroupActivityMarkReviewed extends GroupActivityBase {
  366. data: Record<string, any>;
  367. type: GroupActivityType.MARK_REVIEWED;
  368. }
  369. interface GroupActivityRegression extends GroupActivityBase {
  370. data: {
  371. /**
  372. * True if the project is using semver to decide if the event is a regression.
  373. * Available when the issue was resolved in a release.
  374. */
  375. follows_semver?: boolean;
  376. /**
  377. * The version that the issue was previously resolved in.
  378. * Available when the issue was resolved in a release.
  379. */
  380. resolved_in_version?: string;
  381. version?: string;
  382. };
  383. type: GroupActivityType.SET_REGRESSION;
  384. }
  385. export interface GroupActivitySetByResolvedInNextSemverRelease extends GroupActivityBase {
  386. data: {
  387. // Set for semver releases
  388. current_release_version: string;
  389. };
  390. type: GroupActivityType.SET_RESOLVED_IN_RELEASE;
  391. }
  392. export interface GroupActivitySetByResolvedInRelease extends GroupActivityBase {
  393. data: {
  394. version?: string;
  395. };
  396. type: GroupActivityType.SET_RESOLVED_IN_RELEASE;
  397. }
  398. interface GroupActivitySetByResolvedInCommit extends GroupActivityBase {
  399. data: {
  400. commit?: Commit;
  401. };
  402. type: GroupActivityType.SET_RESOLVED_IN_COMMIT;
  403. }
  404. interface GroupActivitySetByResolvedInPullRequest extends GroupActivityBase {
  405. data: {
  406. pullRequest?: PullRequest;
  407. };
  408. type: GroupActivityType.SET_RESOLVED_IN_PULL_REQUEST;
  409. }
  410. export interface GroupActivitySetIgnored extends GroupActivityBase {
  411. data: {
  412. ignoreCount?: number;
  413. ignoreDuration?: number;
  414. ignoreUntil?: string;
  415. /** Archived until escalating */
  416. ignoreUntilEscalating?: boolean;
  417. ignoreUserCount?: number;
  418. ignoreUserWindow?: number;
  419. ignoreWindow?: number;
  420. };
  421. type: GroupActivityType.SET_IGNORED;
  422. }
  423. export interface GroupActivityReprocess extends GroupActivityBase {
  424. data: {
  425. eventCount: number;
  426. newGroupId: number;
  427. oldGroupId: number;
  428. };
  429. type: GroupActivityType.REPROCESS;
  430. }
  431. interface GroupActivityUnmergeDestination extends GroupActivityBase {
  432. data: {
  433. fingerprints: Array<string>;
  434. source?: {
  435. id: string;
  436. shortId: string;
  437. };
  438. };
  439. type: GroupActivityType.UNMERGE_DESTINATION;
  440. }
  441. interface GroupActivityUnmergeSource extends GroupActivityBase {
  442. data: {
  443. fingerprints: Array<string>;
  444. destination?: {
  445. id: string;
  446. shortId: string;
  447. };
  448. };
  449. type: GroupActivityType.UNMERGE_SOURCE;
  450. }
  451. interface GroupActivityMerge extends GroupActivityBase {
  452. data: {
  453. issues: Array<any>;
  454. };
  455. type: GroupActivityType.MERGE;
  456. }
  457. interface GroupActivityAutoSetOngoing extends GroupActivityBase {
  458. data: {
  459. afterDays?: number;
  460. };
  461. type: GroupActivityType.AUTO_SET_ONGOING;
  462. }
  463. export interface GroupActivitySetEscalating extends GroupActivityBase {
  464. data: {
  465. expired_snooze?: {
  466. count: number | null;
  467. until: Date | null;
  468. user_count: number | null;
  469. user_window: number | null;
  470. window: number | null;
  471. };
  472. forecast?: number;
  473. };
  474. type: GroupActivityType.SET_ESCALATING;
  475. }
  476. export interface GroupActivitySetPriority extends GroupActivityBase {
  477. data: {
  478. priority: PriorityLevel;
  479. reason: string;
  480. };
  481. type: GroupActivityType.SET_PRIORITY;
  482. }
  483. export interface GroupActivityAssigned extends GroupActivityBase {
  484. data: {
  485. assignee: string;
  486. assigneeType: string;
  487. user: Team | User;
  488. assigneeEmail?: string;
  489. /**
  490. * If the user was assigned via an integration
  491. */
  492. integration?: 'projectOwnership' | 'codeowners' | 'slack' | 'msteams';
  493. /** Codeowner or Project owner rule as a string */
  494. rule?: string;
  495. };
  496. type: GroupActivityType.ASSIGNED;
  497. }
  498. export interface GroupActivityCreateIssue extends GroupActivityBase {
  499. data: {
  500. location: string;
  501. provider: string;
  502. title: string;
  503. };
  504. type: GroupActivityType.CREATE_ISSUE;
  505. }
  506. export type GroupActivity =
  507. | GroupActivityNote
  508. | GroupActivitySetResolved
  509. | GroupActivitySetResolvedIntegration
  510. | GroupActivitySetUnresolved
  511. | GroupActivitySetUnresolvedForecast
  512. | GroupActivitySetUnresolvedIntegration
  513. | GroupActivitySetIgnored
  514. | GroupActivitySetByAge
  515. | GroupActivitySetByResolvedInRelease
  516. | GroupActivitySetByResolvedInNextSemverRelease
  517. | GroupActivitySetByResolvedInCommit
  518. | GroupActivitySetByResolvedInPullRequest
  519. | GroupActivityFirstSeen
  520. | GroupActivityMerge
  521. | GroupActivityReprocess
  522. | GroupActivityUnassigned
  523. | GroupActivityMarkReviewed
  524. | GroupActivityUnmergeDestination
  525. | GroupActivitySetPublic
  526. | GroupActivitySetPrivate
  527. | GroupActivityRegression
  528. | GroupActivityUnmergeSource
  529. | GroupActivityAssigned
  530. | GroupActivityCreateIssue
  531. | GroupActivityAutoSetOngoing
  532. | GroupActivitySetEscalating
  533. | GroupActivitySetPriority;
  534. export type Activity = GroupActivity;
  535. interface GroupFiltered {
  536. count: string;
  537. firstSeen: string;
  538. lastSeen: string;
  539. stats: Record<string, TimeseriesValue[]>;
  540. userCount: number;
  541. }
  542. export interface GroupStats extends GroupFiltered {
  543. filtered: GroupFiltered | null;
  544. id: string;
  545. isUnhandled?: boolean;
  546. // for issue alert previews, the last time a group triggered a rule
  547. lastTriggered?: string;
  548. lifetime?: GroupFiltered;
  549. sessionCount?: string | null;
  550. }
  551. export interface IgnoredStatusDetails {
  552. actor?: AvatarUser;
  553. ignoreCount?: number;
  554. // Sent in requests. ignoreUntil is used in responses.
  555. ignoreDuration?: number;
  556. ignoreUntil?: string;
  557. ignoreUntilEscalating?: boolean;
  558. ignoreUserCount?: number;
  559. ignoreUserWindow?: number;
  560. ignoreWindow?: number;
  561. }
  562. export interface ResolvedStatusDetails {
  563. actor?: AvatarUser;
  564. autoResolved?: boolean;
  565. inCommit?: {
  566. commit?: string;
  567. dateCreated?: string;
  568. id?: string;
  569. repository?: string | Repository;
  570. };
  571. inNextRelease?: boolean;
  572. inRelease?: string;
  573. repository?: string;
  574. }
  575. interface ReprocessingStatusDetails {
  576. info: {
  577. dateCreated: string;
  578. totalEvents: number;
  579. } | null;
  580. pendingEvents: number;
  581. }
  582. export interface UserParticipant extends User {
  583. type: 'user';
  584. }
  585. export interface TeamParticipant extends Team {
  586. type: 'team';
  587. }
  588. /**
  589. * The payload sent when marking reviewed
  590. */
  591. export interface MarkReviewed {
  592. inbox: false;
  593. }
  594. /**
  595. * The payload sent when updating a group's status
  596. */
  597. export interface GroupStatusResolution {
  598. status: GroupStatus.RESOLVED | GroupStatus.UNRESOLVED | GroupStatus.IGNORED;
  599. statusDetails: ResolvedStatusDetails | IgnoredStatusDetails | {};
  600. substatus?: GroupSubstatus | null;
  601. }
  602. export const enum GroupStatus {
  603. RESOLVED = 'resolved',
  604. UNRESOLVED = 'unresolved',
  605. IGNORED = 'ignored',
  606. REPROCESSING = 'reprocessing',
  607. }
  608. export const enum GroupSubstatus {
  609. ARCHIVED_UNTIL_ESCALATING = 'archived_until_escalating',
  610. ARCHIVED_UNTIL_CONDITION_MET = 'archived_until_condition_met',
  611. ARCHIVED_FOREVER = 'archived_forever',
  612. ESCALATING = 'escalating',
  613. ONGOING = 'ongoing',
  614. REGRESSED = 'regressed',
  615. NEW = 'new',
  616. }
  617. export const enum PriorityLevel {
  618. HIGH = 'high',
  619. MEDIUM = 'medium',
  620. LOW = 'low',
  621. }
  622. // TODO(ts): incomplete
  623. export interface BaseGroup {
  624. activity: GroupActivity[];
  625. annotations: string[];
  626. assignedTo: Actor | null;
  627. culprit: string;
  628. firstSeen: string;
  629. hasSeen: boolean;
  630. id: string;
  631. isBookmarked: boolean;
  632. isPublic: boolean;
  633. isSubscribed: boolean;
  634. issueCategory: IssueCategory;
  635. issueType: IssueType;
  636. lastSeen: string;
  637. level: Level;
  638. logger: string | null;
  639. metadata: EventMetadata;
  640. numComments: number;
  641. participants: Array<UserParticipant | TeamParticipant>;
  642. permalink: string;
  643. platform: PlatformKey;
  644. pluginActions: any[]; // TODO(ts)
  645. pluginContexts: any[]; // TODO(ts)
  646. pluginIssues: any[]; // TODO(ts)
  647. project: Project;
  648. seenBy: User[];
  649. shareId: string;
  650. shortId: string;
  651. status: GroupStatus;
  652. statusDetails: IgnoredStatusDetails | ResolvedStatusDetails | ReprocessingStatusDetails;
  653. subscriptionDetails: {disabled?: boolean; reason?: string} | null;
  654. title: string;
  655. type: EventOrGroupType;
  656. userReportCount: number;
  657. inbox?: InboxDetails | null | false;
  658. latestEvent?: Event;
  659. owners?: SuggestedOwner[] | null;
  660. substatus?: GroupSubstatus | null;
  661. }
  662. export interface GroupReprocessing extends BaseGroup, GroupStats {
  663. status: GroupStatus.REPROCESSING;
  664. statusDetails: ReprocessingStatusDetails;
  665. }
  666. export interface GroupResolved extends BaseGroup, GroupStats {
  667. status: GroupStatus.RESOLVED;
  668. statusDetails: ResolvedStatusDetails;
  669. }
  670. export interface GroupIgnored extends BaseGroup, GroupStats {
  671. status: GroupStatus.IGNORED;
  672. statusDetails: IgnoredStatusDetails;
  673. }
  674. export interface GroupUnresolved extends BaseGroup, GroupStats {
  675. status: GroupStatus.UNRESOLVED;
  676. statusDetails: {};
  677. }
  678. export type Group = GroupUnresolved | GroupResolved | GroupIgnored | GroupReprocessing;
  679. export interface GroupTombstone {
  680. actor: AvatarUser;
  681. culprit: string;
  682. id: string;
  683. level: Level;
  684. metadata: EventMetadata;
  685. type: EventOrGroupType;
  686. title?: string;
  687. }
  688. export interface GroupTombstoneHelper extends GroupTombstone {
  689. isTombstone: true;
  690. }
  691. export type ProcessingIssueItem = {
  692. checksum: string;
  693. data: {
  694. // TODO(ts) This type is likely incomplete, but this is what
  695. // project processing issues settings uses.
  696. _scope: string;
  697. image_arch: string;
  698. image_path: string;
  699. image_uuid: string;
  700. dist?: string;
  701. release?: string;
  702. };
  703. id: string;
  704. lastSeen: string;
  705. numEvents: number;
  706. type: string;
  707. };
  708. export type ProcessingIssue = {
  709. hasIssues: boolean;
  710. hasMoreResolveableIssues: boolean;
  711. issuesProcessing: number;
  712. lastSeen: string;
  713. numIssues: number;
  714. project: string;
  715. resolveableIssues: number;
  716. signedLink: string;
  717. issues?: ProcessingIssueItem[];
  718. };
  719. /**
  720. * Datascrubbing
  721. */
  722. export type Meta = {
  723. chunks: Array<ChunkType>;
  724. err: Array<MetaError>;
  725. len: number;
  726. rem: Array<MetaRemark>;
  727. };
  728. export type MetaError = string | [string, any];
  729. export type MetaRemark = Array<string | number>;
  730. export type ChunkType = {
  731. rule_id: string | number;
  732. text: string;
  733. type: string;
  734. remark?: string | number;
  735. };
  736. /**
  737. * User Feedback
  738. */
  739. export type UserReport = {
  740. comments: string;
  741. dateCreated: string;
  742. email: string;
  743. event: {eventID: string; id: string};
  744. eventID: string;
  745. id: string;
  746. issue: Group;
  747. name: string;
  748. user: User;
  749. };
  750. export type KeyValueListDataItem = {
  751. key: string;
  752. subject: string;
  753. actionButton?: React.ReactNode;
  754. isContextData?: boolean;
  755. isMultiValue?: boolean;
  756. meta?: Meta;
  757. subjectDataTestId?: string;
  758. subjectIcon?: React.ReactNode;
  759. value?: React.ReactNode;
  760. };
  761. export type KeyValueListData = KeyValueListDataItem[];
  762. // Response from ShortIdLookupEndpoint
  763. // /organizations/${orgId}/shortids/${query}/
  764. export type ShortIdResponse = {
  765. group: Group;
  766. groupId: string;
  767. organizationSlug: string;
  768. projectSlug: string;
  769. shortId: string;
  770. };
  771. /**
  772. * Note used in Group Activity and Alerts for users to comment
  773. */
  774. export type Note = {
  775. /**
  776. * Array of [id, display string] tuples used for @-mentions
  777. */
  778. mentions: [string, string][];
  779. /**
  780. * Note contents (markdown allowed)
  781. */
  782. text: string;
  783. };