types.tsx 7.3 KB

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