types.tsx 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. import {EntryException, ReleaseMeta} from 'sentry/types';
  2. import type {
  3. ReplayListRecord,
  4. ReplayRecord,
  5. ReplaySpan,
  6. } from 'sentry/views/replays/types';
  7. import type {Replay} from './replay';
  8. import {MOCK_RESP_VERBOSE} from './ruleConditions';
  9. type SimpleStub<T = any> = () => T;
  10. type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
  11. type OverridableStub<Params = any, Result = Params> = (
  12. params?: Partial<Params>
  13. ) => Result;
  14. type OverridableVariadicStub<Params = any, Result = Params> = (
  15. ...params: Array<Partial<Params>>
  16. ) => Result;
  17. type OverridableStubList<Params = any, Result = Params> = (
  18. params?: Array<Partial<Params>>
  19. ) => Result[];
  20. type TestStubFixtures = {
  21. AccessRequest: OverridableStub;
  22. AccountEmails: OverridableStubList;
  23. ActivityFeed: OverridableStub;
  24. AllAuthenticators: SimpleStub;
  25. ApiApplication: OverridableStub;
  26. ApiToken: OverridableStub;
  27. AsanaCreate: SimpleStub;
  28. AsanaPlugin: SimpleStub;
  29. AuditLogs: OverridableStubList;
  30. AuditLogsApiEventNames: SimpleStub;
  31. AuthProvider: OverridableStub;
  32. AuthProviders: OverridableStubList;
  33. Authenticators: SimpleStub;
  34. AvailableNotificationActions: OverridableStub;
  35. BitbucketIntegrationConfig: SimpleStub;
  36. Breadcrumb: OverridableStub;
  37. Broadcast: OverridableStub;
  38. BuiltInSymbolSources: OverridableStubList;
  39. CodeOwner: OverridableStub;
  40. Commit: OverridableStub;
  41. CommitAuthor: OverridableStub;
  42. Config: OverridableStub;
  43. Dashboard: OverridableVariadicStub;
  44. DataScrubbingRelayPiiConfig: SimpleStub;
  45. DebugFile: OverridableStub;
  46. DebugSymbols: OverridableStub;
  47. DeprecatedApiKey: OverridableStub;
  48. DetailedEvents: SimpleStub;
  49. DiscoverSavedQuery: OverridableStub;
  50. DocIntegration: OverridableStub;
  51. Entries: SimpleStub;
  52. Environments: SimpleStub;
  53. Event: OverridableStub;
  54. EventAttachment: OverridableStub;
  55. EventEntry: OverridableStub;
  56. EventEntryDebugMeta: OverridableStub;
  57. EventEntryExceptionGroup: SimpleStub<EntryException>;
  58. EventEntryStacktrace: OverridableStub;
  59. EventIdQueryResult: OverridableStub;
  60. EventStacktraceException: OverridableStub;
  61. EventStacktraceMessage: OverridableStub;
  62. EventsStats: OverridableStub;
  63. ExceptionWithMeta: OverridableStubList;
  64. ExceptionWithRawStackTrace: OverridableStub;
  65. Frame: OverridableStub;
  66. GitHubIntegration: OverridableStub;
  67. GitHubIntegrationConfig: SimpleStub;
  68. GitHubIntegrationProvider: OverridableStub;
  69. GitHubRepositoryProvider: OverridableStub;
  70. GlobalSelection: OverridableStub;
  71. Group: OverridableStub;
  72. GroupStats: OverridableStub;
  73. GroupingConfigs: SimpleStub;
  74. GroupingEnhancements: SimpleStub;
  75. Groups: SimpleStub;
  76. HiddenEnvironments: SimpleStub;
  77. Incident: OverridableStub;
  78. IncidentActivity: OverridableStub;
  79. IncidentStats: OverridableStub;
  80. IncidentTrigger: OverridableStub;
  81. InstallWizard: OverridableStub;
  82. JiraIntegration: OverridableStub;
  83. JiraIntegrationProvider: OverridableStub;
  84. MOCK_RESP_VERBOSE: typeof MOCK_RESP_VERBOSE;
  85. Member: OverridableStub;
  86. Members: OverridableStubList;
  87. MetricRule: OverridableStub;
  88. MetricsField: OverridableStub;
  89. MetricsMeta: OverridableStub;
  90. MetricsSessionUserCountByStatusByRelease: SimpleStub;
  91. MetricsTotalCountByReleaseIn24h: SimpleStub;
  92. OrgOwnedApps: SimpleStub;
  93. OrgRoleList: OverridableStub;
  94. Organization: OverridableStub;
  95. OrganizationEvent: OverridableStub;
  96. OrganizationIntegrations: OverridableStub;
  97. Organizations: OverridableStub;
  98. Outcomes: SimpleStub;
  99. OutcomesWithLowProcessedEvents: SimpleStub;
  100. OutcomesWithReason: SimpleStub;
  101. OutcomesWithoutClientDiscarded: SimpleStub;
  102. PageFilters: OverridableStub;
  103. PhabricatorCreate: SimpleStub;
  104. PhabricatorPlugin: SimpleStub;
  105. PlatformExternalIssue: OverridableStub;
  106. Plugin: OverridableStub;
  107. PluginListConfig: SimpleStub;
  108. Plugins: OverridableStubList;
  109. Project: OverridableStub;
  110. ProjectAlertRule: OverridableStub;
  111. ProjectAlertRuleConfiguration: OverridableStub;
  112. ProjectDetails: OverridableStub;
  113. ProjectFilters: OverridableStubList;
  114. ProjectKeys: OverridableStubList;
  115. ProviderList: SimpleStub;
  116. PublishedApps: SimpleStub;
  117. PullRequest: OverridableStub;
  118. Release: (params?: any, healthParams?: any) => any;
  119. ReleaseMeta: OverridableStub<ReleaseMeta>;
  120. Replay: typeof Replay;
  121. ReplayError: OverridableStub;
  122. ReplayList: OverridableStubList<ReplayListRecord>;
  123. ReplayRRWebDivHelloWorld: OverridableStub;
  124. ReplayRRWebNode: OverridableStub;
  125. ReplayRecord: OverridableStub<ReplayRecord>;
  126. ReplaySegmentBreadcrumb: OverridableStub;
  127. ReplaySegmentConsole: OverridableStub;
  128. ReplaySegmentFullsnapshot: OverridableStub;
  129. ReplaySegmentInit: OverridableStub;
  130. ReplaySegmentNavigation: OverridableStub;
  131. ReplaySegmentSpan: OverridableStub;
  132. ReplaySpanPayload: OverridableStub<
  133. Overwrite<ReplaySpan, {endTimestamp: Date; startTimestamp: Date}>,
  134. ReplaySpan
  135. >;
  136. ReplaySpanPayloadNavigate: OverridableStub<
  137. Overwrite<ReplaySpan, {endTimestamp: Date; startTimestamp: Date}>,
  138. ReplaySpan
  139. >;
  140. Repository: OverridableStub;
  141. RepositoryProjectPathConfig: OverridableStub;
  142. Search: OverridableStub;
  143. Searches: OverridableStubList;
  144. SentryApp: OverridableStub;
  145. SentryAppComponent: OverridableStub;
  146. SentryAppComponentAsync: OverridableStub;
  147. SentryAppComponentDependent: OverridableStub;
  148. SentryAppInstallation: OverridableStub;
  149. SentryAppInstalls: SimpleStub;
  150. SentryAppToken: OverridableStub;
  151. SentryAppWebhookRequest: OverridableStub;
  152. ServiceIncident: OverridableStub;
  153. SessionEmptyGroupedResponse: SimpleStub;
  154. SessionStatusCountByProjectInPeriod: SimpleStub;
  155. SessionStatusCountByReleaseInPeriod: SimpleStub;
  156. SessionTotalCountByProjectIn24h: SimpleStub;
  157. SessionUserCountByStatus: SimpleStub;
  158. SessionUserCountByStatus2: SimpleStub;
  159. SessionUserCountByStatusByRelease: SimpleStub;
  160. SessionUserStatusCountByProjectInPeriod: SimpleStub;
  161. SessionUserStatusCountByReleaseInPeriod: SimpleStub;
  162. SessionsField: OverridableStub;
  163. SesssionTotalCountByReleaseIn24h: SimpleStub;
  164. ShortIdQueryResult: OverridableStub;
  165. SourceMapArchive: OverridableStub;
  166. SourceMapArtifact: OverridableStub;
  167. SourceMapsDebugIDBundles: OverridableStub;
  168. SourceMapsDebugIDBundlesArtifacts: OverridableStub;
  169. Span: OverridableStub;
  170. Subscriptions: OverridableStubList;
  171. TagValues: OverridableStubList;
  172. Tags: OverridableStubList;
  173. Team: OverridableStub;
  174. TeamAlertsTriggered: SimpleStub;
  175. TeamIssuesBreakdown: SimpleStub;
  176. TeamIssuesReviewed: SimpleStub;
  177. TeamReleaseCounts: SimpleStub;
  178. TeamResolutionTime: SimpleStub;
  179. TeamRoleList: OverridableStub;
  180. Tombstones: OverridableStubList;
  181. TraceError: OverridableStub;
  182. UpdateSdkAndEnableIntegrationSuggestion: SimpleStub;
  183. User: OverridableStub;
  184. UserDetails: OverridableStub;
  185. UserFeedback: OverridableStub;
  186. UserIdentity: SimpleStub;
  187. UserTotalCountByProjectIn24h: SimpleStub;
  188. UserTotalCountByReleaseIn24h: SimpleStub;
  189. VercelProvider: SimpleStub;
  190. VstsCreate: SimpleStub;
  191. VstsIntegrationProvider: OverridableStub;
  192. VstsPlugin: SimpleStub;
  193. Widget: OverridableVariadicStub;
  194. // TODO: These need propertly typed still
  195. // Widget(queries = {...DEFAULT_QUERIES}, options)
  196. // Dashboard(widgets = DEFAULT_WIDGETS, props = {})
  197. // AsanaAutocomplete(type = 'project', values = [DEFAULT_AUTOCOMPLETE])
  198. // PhabricatorAutocomplete(type = 'project', values = null)
  199. // RoleList(params = [], fullAccess = false)
  200. // const MOCK_RESP_ONLY_IGNORED_CONDITIONS_INVALID
  201. // const MOCK_RESP_INCONSISTENT_PLACEHOLDERS
  202. // const MOCK_RESP_INCONSISTENT_INTERVALS
  203. };
  204. export default TestStubFixtures;