1 |
- {"version":3,"file":"isSentryRequestUrl.js","sources":["../../../src/utils/isSentryRequestUrl.ts"],"sourcesContent":["import type { Client, DsnComponents, Hub } from '@sentry/types';\n\n/**\n * Checks whether given url points to Sentry server\n * @param url url to verify\n *\n * TODO(v8): Remove Hub fallback type\n */\nexport function isSentryRequestUrl(url: string, hubOrClient: Hub | Client | undefined): boolean {\n const client =\n hubOrClient && isHub(hubOrClient)\n ? // eslint-disable-next-line deprecation/deprecation\n hubOrClient.getClient()\n : hubOrClient;\n const dsn = client && client.getDsn();\n const tunnel = client && client.getOptions().tunnel;\n\n return checkDsn(url, dsn) || checkTunnel(url, tunnel);\n}\n\nfunction checkTunnel(url: string, tunnel: string | undefined): boolean {\n if (!tunnel) {\n return false;\n }\n\n return removeTrailingSlash(url) === removeTrailingSlash(tunnel);\n}\n\nfunction checkDsn(url: string, dsn: DsnComponents | undefined): boolean {\n return dsn ? url.includes(dsn.host) : false;\n}\n\nfunction removeTrailingSlash(str: string): string {\n return str[str.length - 1] === '/' ? str.slice(0, -1) : str;\n}\n\nfunction isHub(hubOrClient: Hub | Client | undefined): hubOrClient is Hub {\n // eslint-disable-next-line deprecation/deprecation\n return (hubOrClient as Hub).getClient !== undefined;\n}\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,GAAG,EAAU,WAAW,EAAqC;AAChG,EAAE,MAAM,MAAO;AACf,IAAI,WAAY,IAAG,KAAK,CAAC,WAAW,CAAA;AACpC;AACA,QAAQ,WAAW,CAAC,SAAS,EAAC;AAC9B,QAAQ,WAAW,CAAA;AACnB,EAAE,MAAM,MAAM,MAAA,IAAU,MAAM,CAAC,MAAM,EAAE,CAAA;AACvC,EAAE,MAAM,MAAO,GAAE,MAAO,IAAG,MAAM,CAAC,UAAU,EAAE,CAAC,MAAM,CAAA;AACrD;AACA,EAAE,OAAO,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAE,IAAG,WAAW,CAAC,GAAG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