group.tsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  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. }
  282. interface GroupActivityBase {
  283. dateCreated: string;
  284. id: string;
  285. project: Project;
  286. assignee?: string;
  287. issue?: Group;
  288. user?: null | User;
  289. }
  290. export interface GroupActivityNote extends GroupActivityBase {
  291. data: {
  292. text: string;
  293. };
  294. type: GroupActivityType.NOTE;
  295. }
  296. interface GroupActivitySetResolved extends GroupActivityBase {
  297. data: Record<string, unknown>;
  298. type: GroupActivityType.SET_RESOLVED;
  299. }
  300. /**
  301. * An integration marks an issue as resolved
  302. */
  303. interface GroupActivitySetResolvedIntegration extends GroupActivityBase {
  304. data: {
  305. integration_id: number;
  306. /**
  307. * Human readable name of the integration
  308. */
  309. provider: string;
  310. /**
  311. * The key of the integration
  312. */
  313. provider_key: string;
  314. };
  315. type: GroupActivityType.SET_RESOLVED;
  316. }
  317. interface GroupActivitySetUnresolved extends GroupActivityBase {
  318. data: Record<string, unknown>;
  319. type: GroupActivityType.SET_UNRESOLVED;
  320. }
  321. interface GroupActivitySetUnresolvedForecast extends GroupActivityBase {
  322. data: {
  323. forecast: number;
  324. };
  325. type: GroupActivityType.SET_UNRESOLVED;
  326. }
  327. /**
  328. * An integration marks an issue as unresolved
  329. */
  330. interface GroupActivitySetUnresolvedIntegration extends GroupActivityBase {
  331. data: {
  332. integration_id: number;
  333. /**
  334. * Human readable name of the integration
  335. */
  336. provider: string;
  337. /**
  338. * The key of the integration
  339. */
  340. provider_key: string;
  341. };
  342. type: GroupActivityType.SET_UNRESOLVED;
  343. }
  344. interface GroupActivitySetPublic extends GroupActivityBase {
  345. data: Record<string, any>;
  346. type: GroupActivityType.SET_PUBLIC;
  347. }
  348. interface GroupActivitySetPrivate extends GroupActivityBase {
  349. data: Record<string, any>;
  350. type: GroupActivityType.SET_PRIVATE;
  351. }
  352. interface GroupActivitySetByAge extends GroupActivityBase {
  353. data: Record<string, any>;
  354. type: GroupActivityType.SET_RESOLVED_BY_AGE;
  355. }
  356. interface GroupActivityUnassigned extends GroupActivityBase {
  357. data: Record<string, any>;
  358. type: GroupActivityType.UNASSIGNED;
  359. }
  360. interface GroupActivityFirstSeen extends GroupActivityBase {
  361. data: Record<string, any>;
  362. type: GroupActivityType.FIRST_SEEN;
  363. }
  364. interface GroupActivityMarkReviewed extends GroupActivityBase {
  365. data: Record<string, any>;
  366. type: GroupActivityType.MARK_REVIEWED;
  367. }
  368. interface GroupActivityRegression extends GroupActivityBase {
  369. data: {
  370. /**
  371. * True if the project is using semver to decide if the event is a regression.
  372. * Available when the issue was resolved in a release.
  373. */
  374. follows_semver?: boolean;
  375. /**
  376. * The version that the issue was previously resolved in.
  377. * Available when the issue was resolved in a release.
  378. */
  379. resolved_in_version?: string;
  380. version?: string;
  381. };
  382. type: GroupActivityType.SET_REGRESSION;
  383. }
  384. export interface GroupActivitySetByResolvedInNextSemverRelease extends GroupActivityBase {
  385. data: {
  386. // Set for semver releases
  387. current_release_version: string;
  388. };
  389. type: GroupActivityType.SET_RESOLVED_IN_RELEASE;
  390. }
  391. export interface GroupActivitySetByResolvedInRelease extends GroupActivityBase {
  392. data: {
  393. version?: string;
  394. };
  395. type: GroupActivityType.SET_RESOLVED_IN_RELEASE;
  396. }
  397. interface GroupActivitySetByResolvedInCommit extends GroupActivityBase {
  398. data: {
  399. commit?: Commit;
  400. };
  401. type: GroupActivityType.SET_RESOLVED_IN_COMMIT;
  402. }
  403. interface GroupActivitySetByResolvedInPullRequest extends GroupActivityBase {
  404. data: {
  405. pullRequest?: PullRequest;
  406. };
  407. type: GroupActivityType.SET_RESOLVED_IN_PULL_REQUEST;
  408. }
  409. export interface GroupActivitySetIgnored extends GroupActivityBase {
  410. data: {
  411. ignoreCount?: number;
  412. ignoreDuration?: number;
  413. ignoreUntil?: string;
  414. /** Archived until escalating */
  415. ignoreUntilEscalating?: boolean;
  416. ignoreUserCount?: number;
  417. ignoreUserWindow?: number;
  418. ignoreWindow?: number;
  419. };
  420. type: GroupActivityType.SET_IGNORED;
  421. }
  422. export interface GroupActivityReprocess extends GroupActivityBase {
  423. data: {
  424. eventCount: number;
  425. newGroupId: number;
  426. oldGroupId: number;
  427. };
  428. type: GroupActivityType.REPROCESS;
  429. }
  430. interface GroupActivityUnmergeDestination extends GroupActivityBase {
  431. data: {
  432. fingerprints: Array<string>;
  433. source?: {
  434. id: string;
  435. shortId: string;
  436. };
  437. };
  438. type: GroupActivityType.UNMERGE_DESTINATION;
  439. }
  440. interface GroupActivityUnmergeSource extends GroupActivityBase {
  441. data: {
  442. fingerprints: Array<string>;
  443. destination?: {
  444. id: string;
  445. shortId: string;
  446. };
  447. };
  448. type: GroupActivityType.UNMERGE_SOURCE;
  449. }
  450. interface GroupActivityMerge extends GroupActivityBase {
  451. data: {
  452. issues: Array<any>;
  453. };
  454. type: GroupActivityType.MERGE;
  455. }
  456. interface GroupActivityAutoSetOngoing extends GroupActivityBase {
  457. data: {
  458. afterDays?: number;
  459. };
  460. type: GroupActivityType.AUTO_SET_ONGOING;
  461. }
  462. export interface GroupActivitySetEscalating extends GroupActivityBase {
  463. data: {
  464. expired_snooze?: {
  465. count: number | null;
  466. until: Date | null;
  467. user_count: number | null;
  468. user_window: number | null;
  469. window: number | null;
  470. };
  471. forecast?: number;
  472. };
  473. type: GroupActivityType.SET_ESCALATING;
  474. }
  475. export interface GroupActivityAssigned extends GroupActivityBase {
  476. data: {
  477. assignee: string;
  478. assigneeType: string;
  479. user: Team | User;
  480. assigneeEmail?: string;
  481. /**
  482. * If the user was assigned via an integration
  483. */
  484. integration?: 'projectOwnership' | 'codeowners' | 'slack' | 'msteams';
  485. /** Codeowner or Project owner rule as a string */
  486. rule?: string;
  487. };
  488. type: GroupActivityType.ASSIGNED;
  489. }
  490. export interface GroupActivityCreateIssue extends GroupActivityBase {
  491. data: {
  492. location: string;
  493. provider: string;
  494. title: string;
  495. };
  496. type: GroupActivityType.CREATE_ISSUE;
  497. }
  498. export type GroupActivity =
  499. | GroupActivityNote
  500. | GroupActivitySetResolved
  501. | GroupActivitySetResolvedIntegration
  502. | GroupActivitySetUnresolved
  503. | GroupActivitySetUnresolvedForecast
  504. | GroupActivitySetUnresolvedIntegration
  505. | GroupActivitySetIgnored
  506. | GroupActivitySetByAge
  507. | GroupActivitySetByResolvedInRelease
  508. | GroupActivitySetByResolvedInNextSemverRelease
  509. | GroupActivitySetByResolvedInCommit
  510. | GroupActivitySetByResolvedInPullRequest
  511. | GroupActivityFirstSeen
  512. | GroupActivityMerge
  513. | GroupActivityReprocess
  514. | GroupActivityUnassigned
  515. | GroupActivityMarkReviewed
  516. | GroupActivityUnmergeDestination
  517. | GroupActivitySetPublic
  518. | GroupActivitySetPrivate
  519. | GroupActivityRegression
  520. | GroupActivityUnmergeSource
  521. | GroupActivityAssigned
  522. | GroupActivityCreateIssue
  523. | GroupActivityAutoSetOngoing
  524. | GroupActivitySetEscalating;
  525. export type Activity = GroupActivity;
  526. interface GroupFiltered {
  527. count: string;
  528. firstSeen: string;
  529. lastSeen: string;
  530. stats: Record<string, TimeseriesValue[]>;
  531. userCount: number;
  532. }
  533. export interface GroupStats extends GroupFiltered {
  534. filtered: GroupFiltered | null;
  535. id: string;
  536. isUnhandled?: boolean;
  537. // for issue alert previews, the last time a group triggered a rule
  538. lastTriggered?: string;
  539. lifetime?: GroupFiltered;
  540. sessionCount?: string | null;
  541. }
  542. export interface IgnoredStatusDetails {
  543. actor?: AvatarUser;
  544. ignoreCount?: number;
  545. // Sent in requests. ignoreUntil is used in responses.
  546. ignoreDuration?: number;
  547. ignoreUntil?: string;
  548. ignoreUntilEscalating?: boolean;
  549. ignoreUserCount?: number;
  550. ignoreUserWindow?: number;
  551. ignoreWindow?: number;
  552. }
  553. export interface ResolvedStatusDetails {
  554. actor?: AvatarUser;
  555. autoResolved?: boolean;
  556. inCommit?: {
  557. commit?: string;
  558. dateCreated?: string;
  559. id?: string;
  560. repository?: string | Repository;
  561. };
  562. inNextRelease?: boolean;
  563. inRelease?: string;
  564. repository?: string;
  565. }
  566. interface ReprocessingStatusDetails {
  567. info: {
  568. dateCreated: string;
  569. totalEvents: number;
  570. } | null;
  571. pendingEvents: number;
  572. }
  573. export interface UserParticipant extends User {
  574. type: 'user';
  575. }
  576. export interface TeamParticipant extends Team {
  577. type: 'team';
  578. }
  579. /**
  580. * The payload sent when marking reviewed
  581. */
  582. export interface MarkReviewed {
  583. inbox: false;
  584. }
  585. /**
  586. * The payload sent when updating a group's status
  587. */
  588. export interface GroupStatusResolution {
  589. status: GroupStatus.RESOLVED | GroupStatus.UNRESOLVED | GroupStatus.IGNORED;
  590. statusDetails: ResolvedStatusDetails | IgnoredStatusDetails | {};
  591. substatus?: GroupSubstatus | null;
  592. }
  593. export const enum GroupStatus {
  594. RESOLVED = 'resolved',
  595. UNRESOLVED = 'unresolved',
  596. IGNORED = 'ignored',
  597. REPROCESSING = 'reprocessing',
  598. }
  599. export const enum GroupSubstatus {
  600. ARCHIVED_UNTIL_ESCALATING = 'archived_until_escalating',
  601. ARCHIVED_UNTIL_CONDITION_MET = 'archived_until_condition_met',
  602. ARCHIVED_FOREVER = 'archived_forever',
  603. ESCALATING = 'escalating',
  604. ONGOING = 'ongoing',
  605. REGRESSED = 'regressed',
  606. NEW = 'new',
  607. }
  608. // TODO(ts): incomplete
  609. export interface BaseGroup {
  610. activity: GroupActivity[];
  611. annotations: string[];
  612. assignedTo: Actor | null;
  613. culprit: string;
  614. firstSeen: string;
  615. hasSeen: boolean;
  616. id: string;
  617. isBookmarked: boolean;
  618. isPublic: boolean;
  619. isSubscribed: boolean;
  620. issueCategory: IssueCategory;
  621. issueType: IssueType;
  622. lastSeen: string;
  623. level: Level;
  624. logger: string | null;
  625. metadata: EventMetadata;
  626. numComments: number;
  627. participants: Array<UserParticipant | TeamParticipant>;
  628. permalink: string;
  629. platform: PlatformKey;
  630. pluginActions: any[]; // TODO(ts)
  631. pluginContexts: any[]; // TODO(ts)
  632. pluginIssues: any[]; // TODO(ts)
  633. project: Project;
  634. seenBy: User[];
  635. shareId: string;
  636. shortId: string;
  637. status: GroupStatus;
  638. statusDetails: IgnoredStatusDetails | ResolvedStatusDetails | ReprocessingStatusDetails;
  639. subscriptionDetails: {disabled?: boolean; reason?: string} | null;
  640. title: string;
  641. type: EventOrGroupType;
  642. userReportCount: number;
  643. inbox?: InboxDetails | null | false;
  644. latestEvent?: Event;
  645. owners?: SuggestedOwner[] | null;
  646. substatus?: GroupSubstatus | null;
  647. }
  648. export interface GroupReprocessing extends BaseGroup, GroupStats {
  649. status: GroupStatus.REPROCESSING;
  650. statusDetails: ReprocessingStatusDetails;
  651. }
  652. export interface GroupResolved extends BaseGroup, GroupStats {
  653. status: GroupStatus.RESOLVED;
  654. statusDetails: ResolvedStatusDetails;
  655. }
  656. export interface GroupIgnored extends BaseGroup, GroupStats {
  657. status: GroupStatus.IGNORED;
  658. statusDetails: IgnoredStatusDetails;
  659. }
  660. export interface GroupUnresolved extends BaseGroup, GroupStats {
  661. status: GroupStatus.UNRESOLVED;
  662. statusDetails: {};
  663. }
  664. export type Group = GroupUnresolved | GroupResolved | GroupIgnored | GroupReprocessing;
  665. export interface GroupTombstone {
  666. actor: AvatarUser;
  667. culprit: string;
  668. id: string;
  669. level: Level;
  670. metadata: EventMetadata;
  671. type: EventOrGroupType;
  672. title?: string;
  673. }
  674. export interface GroupTombstoneHelper extends GroupTombstone {
  675. isTombstone: true;
  676. }
  677. export type ProcessingIssueItem = {
  678. checksum: string;
  679. data: {
  680. // TODO(ts) This type is likely incomplete, but this is what
  681. // project processing issues settings uses.
  682. _scope: string;
  683. image_arch: string;
  684. image_path: string;
  685. image_uuid: string;
  686. dist?: string;
  687. release?: string;
  688. };
  689. id: string;
  690. lastSeen: string;
  691. numEvents: number;
  692. type: string;
  693. };
  694. export type ProcessingIssue = {
  695. hasIssues: boolean;
  696. hasMoreResolveableIssues: boolean;
  697. issuesProcessing: number;
  698. lastSeen: string;
  699. numIssues: number;
  700. project: string;
  701. resolveableIssues: number;
  702. signedLink: string;
  703. issues?: ProcessingIssueItem[];
  704. };
  705. /**
  706. * Datascrubbing
  707. */
  708. export type Meta = {
  709. chunks: Array<ChunkType>;
  710. err: Array<MetaError>;
  711. len: number;
  712. rem: Array<MetaRemark>;
  713. };
  714. export type MetaError = string | [string, any];
  715. export type MetaRemark = Array<string | number>;
  716. export type ChunkType = {
  717. rule_id: string | number;
  718. text: string;
  719. type: string;
  720. remark?: string | number;
  721. };
  722. /**
  723. * User Feedback
  724. */
  725. export type UserReport = {
  726. comments: string;
  727. dateCreated: string;
  728. email: string;
  729. event: {eventID: string; id: string};
  730. eventID: string;
  731. id: string;
  732. issue: Group;
  733. name: string;
  734. user: User;
  735. };
  736. export type KeyValueListDataItem = {
  737. key: string;
  738. subject: string;
  739. actionButton?: React.ReactNode;
  740. isContextData?: boolean;
  741. isMultiValue?: boolean;
  742. meta?: Meta;
  743. subjectDataTestId?: string;
  744. subjectIcon?: React.ReactNode;
  745. value?: React.ReactNode;
  746. };
  747. export type KeyValueListData = KeyValueListDataItem[];
  748. // Response from ShortIdLookupEndpoint
  749. // /organizations/${orgId}/shortids/${query}/
  750. export type ShortIdResponse = {
  751. group: Group;
  752. groupId: string;
  753. organizationSlug: string;
  754. projectSlug: string;
  755. shortId: string;
  756. };
  757. /**
  758. * Note used in Group Activity and Alerts for users to comment
  759. */
  760. export type Note = {
  761. /**
  762. * Array of [id, display string] tuples used for @-mentions
  763. */
  764. mentions: [string, string][];
  765. /**
  766. * Note contents (markdown allowed)
  767. */
  768. text: string;
  769. };