group.tsx 18 KB

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