* Reads and normalizes the connector source configuration once per call.
(sourceConfig: Record<string, unknown>)
| 144 | * Reads and normalizes the connector source configuration once per call. |
| 145 | */ |
| 146 | function readSourceConfig(sourceConfig: Record<string, unknown>): SentrySourceConfig { |
| 147 | const host = normalizeHost(sourceConfig.baseUrl) |
| 148 | const organization = |
| 149 | typeof sourceConfig.organization === 'string' ? sourceConfig.organization.trim() : '' |
| 150 | const project = typeof sourceConfig.project === 'string' ? sourceConfig.project.trim() : '' |
| 151 | const query = |
| 152 | typeof sourceConfig.query === 'string' && sourceConfig.query.trim() |
| 153 | ? sourceConfig.query.trim() |
| 154 | : DEFAULT_QUERY |
| 155 | const statsPeriod = |
| 156 | typeof sourceConfig.statsPeriod === 'string' ? sourceConfig.statsPeriod.trim() : '' |
| 157 | const environment = |
| 158 | typeof sourceConfig.environment === 'string' ? sourceConfig.environment.trim() : '' |
| 159 | const maxIssues = sourceConfig.maxIssues ? Number(sourceConfig.maxIssues) : 0 |
| 160 | |
| 161 | return { |
| 162 | host, |
| 163 | apiBase: `https://${host}/api/0`, |
| 164 | organization, |
| 165 | project, |
| 166 | query, |
| 167 | statsPeriod, |
| 168 | environment, |
| 169 | maxIssues, |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Builds the standard JSON request headers carrying the Sentry auth token. |
no test coverage detected