(client: Client)
| 136 | * The organization ID is extracted from the DSN. If the client options include a `orgId`, this will always take precedence. |
| 137 | */ |
| 138 | export function extractOrgIdFromClient(client: Client): string | undefined { |
| 139 | const options = client.getOptions(); |
| 140 | |
| 141 | const { host } = client.getDsn() || {}; |
| 142 | |
| 143 | let org_id: string | undefined; |
| 144 | |
| 145 | if (options.orgId) { |
| 146 | org_id = String(options.orgId); |
| 147 | } else if (host) { |
| 148 | org_id = extractOrgIdFromDsnHost(host); |
| 149 | } |
| 150 | |
| 151 | return org_id; |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Creates a valid Sentry Dsn object, identifying a Sentry instance and project. |
no test coverage detected