types.tsx 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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 {MockRuleCondition} 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_INCONSISTENT_INTERVALS: MockRuleCondition;
  85. MOCK_RESP_INCONSISTENT_PLACEHOLDERS: MockRuleCondition;
  86. MOCK_RESP_ONLY_IGNORED_CONDITIONS_INVALID: MockRuleCondition;
  87. MOCK_RESP_PLACEHOLDERS: MockRuleCondition;
  88. MOCK_RESP_VERBOSE: MockRuleCondition;
  89. Member: OverridableStub;
  90. Members: OverridableStubList;
  91. MetricRule: OverridableStub;
  92. MetricsField: OverridableStub;
  93. MetricsMeta: OverridableStub;
  94. MetricsSessionUserCountByStatusByRelease: SimpleStub;
  95. MetricsTotalCountByReleaseIn24h: SimpleStub;
  96. OrgOwnedApps: SimpleStub;
  97. OrgRoleList: OverridableStub;
  98. Organization: OverridableStub;
  99. OrganizationEvent: OverridableStub;
  100. OrganizationIntegrations: OverridableStub;
  101. Organizations: OverridableStub;
  102. Outcomes: SimpleStub;
  103. OutcomesWithLowProcessedEvents: SimpleStub;
  104. OutcomesWithReason: SimpleStub;
  105. OutcomesWithoutClientDiscarded: SimpleStub;
  106. PageFilters: OverridableStub;
  107. PhabricatorCreate: SimpleStub;
  108. PhabricatorPlugin: SimpleStub;
  109. PlatformExternalIssue: OverridableStub;
  110. Plugin: OverridableStub;
  111. PluginListConfig: SimpleStub;
  112. Plugins: OverridableStubList;
  113. Project: OverridableStub;
  114. ProjectAlertRule: OverridableStub;
  115. ProjectAlertRuleConfiguration: OverridableStub;
  116. ProjectDetails: OverridableStub;
  117. ProjectFilters: OverridableStubList;
  118. ProjectKeys: OverridableStubList;
  119. ProviderList: SimpleStub;
  120. PublishedApps: SimpleStub;
  121. PullRequest: OverridableStub;
  122. Release: (params?: any, healthParams?: any) => any;
  123. ReleaseMeta: OverridableStub<ReleaseMeta>;
  124. Replay: typeof Replay;
  125. ReplayError: OverridableStub;
  126. ReplayList: OverridableStubList<ReplayListRecord>;
  127. ReplayRRWebDivHelloWorld: OverridableStub;
  128. ReplayRRWebNode: OverridableStub;
  129. ReplayRecord: OverridableStub<ReplayRecord>;
  130. ReplaySegmentBreadcrumb: OverridableStub;
  131. ReplaySegmentConsole: OverridableStub;
  132. ReplaySegmentFullsnapshot: OverridableStub;
  133. ReplaySegmentInit: OverridableStub;
  134. ReplaySegmentNavigation: OverridableStub;
  135. ReplaySegmentSpan: OverridableStub;
  136. ReplaySpanPayload: OverridableStub<
  137. Overwrite<ReplaySpan, {endTimestamp: Date; startTimestamp: Date}>,
  138. ReplaySpan
  139. >;
  140. ReplaySpanPayloadNavigate: OverridableStub<
  141. Overwrite<ReplaySpan, {endTimestamp: Date; startTimestamp: Date}>,
  142. ReplaySpan
  143. >;
  144. Repository: OverridableStub;
  145. RepositoryProjectPathConfig: OverridableStub;
  146. Search: OverridableStub;
  147. Searches: OverridableStubList;
  148. SentryApp: OverridableStub;
  149. SentryAppComponent: OverridableStub;
  150. SentryAppComponentAsync: OverridableStub;
  151. SentryAppComponentDependent: OverridableStub;
  152. SentryAppInstallation: OverridableStub;
  153. SentryAppInstalls: SimpleStub;
  154. SentryAppToken: OverridableStub;
  155. SentryAppWebhookRequest: OverridableStub;
  156. ServiceIncident: OverridableStub;
  157. SessionEmptyGroupedResponse: SimpleStub;
  158. SessionStatusCountByProjectInPeriod: SimpleStub;
  159. SessionStatusCountByReleaseInPeriod: SimpleStub;
  160. SessionTotalCountByProjectIn24h: SimpleStub;
  161. SessionUserCountByStatus: SimpleStub;
  162. SessionUserCountByStatus2: SimpleStub;
  163. SessionUserCountByStatusByRelease: SimpleStub;
  164. SessionUserStatusCountByProjectInPeriod: SimpleStub;
  165. SessionUserStatusCountByReleaseInPeriod: SimpleStub;
  166. SessionsField: OverridableStub;
  167. SesssionTotalCountByReleaseIn24h: SimpleStub;
  168. ShortIdQueryResult: OverridableStub;
  169. SourceMapArchive: OverridableStub;
  170. SourceMapArtifact: OverridableStub;
  171. SourceMapsDebugIDBundles: OverridableStub;
  172. SourceMapsDebugIDBundlesArtifacts: OverridableStub;
  173. Span: OverridableStub;
  174. Subscriptions: OverridableStubList;
  175. TagValues: OverridableStubList;
  176. Tags: OverridableStubList;
  177. Team: OverridableStub;
  178. TeamAlertsTriggered: SimpleStub;
  179. TeamIssuesBreakdown: SimpleStub;
  180. TeamIssuesReviewed: SimpleStub;
  181. TeamReleaseCounts: SimpleStub;
  182. TeamResolutionTime: SimpleStub;
  183. TeamRoleList: OverridableStub;
  184. Tombstones: OverridableStubList;
  185. TraceError: OverridableStub;
  186. UpdateSdkAndEnableIntegrationSuggestion: SimpleStub;
  187. User: OverridableStub;
  188. UserDetails: OverridableStub;
  189. UserFeedback: OverridableStub;
  190. UserIdentity: SimpleStub;
  191. UserTotalCountByProjectIn24h: SimpleStub;
  192. UserTotalCountByReleaseIn24h: SimpleStub;
  193. VercelProvider: SimpleStub;
  194. VstsCreate: SimpleStub;
  195. VstsIntegrationProvider: OverridableStub;
  196. VstsPlugin: SimpleStub;
  197. Widget: OverridableVariadicStub;
  198. // TODO: These need propertly typed still
  199. // Widget(queries = {...DEFAULT_QUERIES}, options)
  200. // Dashboard(widgets = DEFAULT_WIDGETS, props = {})
  201. // AsanaAutocomplete(type = 'project', values = [DEFAULT_AUTOCOMPLETE])
  202. // PhabricatorAutocomplete(type = 'project', values = null)
  203. // RoleList(params = [], fullAccess = false)
  204. };
  205. export default TestStubFixtures;