@elenjical-ai/browser 0.0.0-stage → 10.76.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +57 -2
- package/build/npm/cjs/dev/client.js +77 -0
- package/build/npm/cjs/dev/client.js.map +1 -0
- package/build/npm/cjs/dev/debug-build.js +6 -0
- package/build/npm/cjs/dev/debug-build.js.map +1 -0
- package/build/npm/cjs/dev/diagnose-sdk.js +34 -0
- package/build/npm/cjs/dev/diagnose-sdk.js.map +1 -0
- package/build/npm/cjs/dev/eventbuilder.js +231 -0
- package/build/npm/cjs/dev/eventbuilder.js.map +1 -0
- package/build/npm/cjs/dev/feedbackAsync.js +11 -0
- package/build/npm/cjs/dev/feedbackAsync.js.map +1 -0
- package/build/npm/cjs/dev/feedbackSync.js +11 -0
- package/build/npm/cjs/dev/feedbackSync.js.map +1 -0
- package/build/npm/cjs/dev/helpers.js +108 -0
- package/build/npm/cjs/dev/helpers.js.map +1 -0
- package/build/npm/cjs/dev/index.js +208 -0
- package/build/npm/cjs/dev/index.js.map +1 -0
- package/build/npm/cjs/dev/integrations/breadcrumbs.js +249 -0
- package/build/npm/cjs/dev/integrations/breadcrumbs.js.map +1 -0
- package/build/npm/cjs/dev/integrations/browserapierrors.js +167 -0
- package/build/npm/cjs/dev/integrations/browserapierrors.js.map +1 -0
- package/build/npm/cjs/dev/integrations/browsersession.js +50 -0
- package/build/npm/cjs/dev/integrations/browsersession.js.map +1 -0
- package/build/npm/cjs/dev/integrations/contextlines.js +53 -0
- package/build/npm/cjs/dev/integrations/contextlines.js.map +1 -0
- package/build/npm/cjs/dev/integrations/culturecontext.js +50 -0
- package/build/npm/cjs/dev/integrations/culturecontext.js.map +1 -0
- package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js +8 -0
- package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js.map +1 -0
- package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js +30 -0
- package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -0
- package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js +32 -0
- package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js.map +1 -0
- package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js +23 -0
- package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js.map +1 -0
- package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js +37 -0
- package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js.map +1 -0
- package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js +60 -0
- package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js.map +1 -0
- package/build/npm/cjs/dev/integrations/globalhandlers.js +143 -0
- package/build/npm/cjs/dev/integrations/globalhandlers.js.map +1 -0
- package/build/npm/cjs/dev/integrations/graphqlClient.js +148 -0
- package/build/npm/cjs/dev/integrations/graphqlClient.js.map +1 -0
- package/build/npm/cjs/dev/integrations/httpclient.js +250 -0
- package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -0
- package/build/npm/cjs/dev/integrations/httpcontext.js +47 -0
- package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -0
- package/build/npm/cjs/dev/integrations/linkederrors.js +31 -0
- package/build/npm/cjs/dev/integrations/linkederrors.js.map +1 -0
- package/build/npm/cjs/dev/integrations/reportingobserver.js +60 -0
- package/build/npm/cjs/dev/integrations/reportingobserver.js.map +1 -0
- package/build/npm/cjs/dev/integrations/spanstreaming.js +49 -0
- package/build/npm/cjs/dev/integrations/spanstreaming.js.map +1 -0
- package/build/npm/cjs/dev/integrations/spotlight.js +61 -0
- package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -0
- package/build/npm/cjs/dev/integrations/view-hierarchy.js +74 -0
- package/build/npm/cjs/dev/integrations/view-hierarchy.js.map +1 -0
- package/build/npm/cjs/dev/integrations/webVitals.js +62 -0
- package/build/npm/cjs/dev/integrations/webVitals.js.map +1 -0
- package/build/npm/cjs/dev/integrations/webWorker.js +133 -0
- package/build/npm/cjs/dev/integrations/webWorker.js.map +1 -0
- package/build/npm/cjs/dev/normalizeStringifyValue.js +27 -0
- package/build/npm/cjs/dev/normalizeStringifyValue.js.map +1 -0
- package/build/npm/cjs/dev/profiling/UIProfiler.js +306 -0
- package/build/npm/cjs/dev/profiling/UIProfiler.js.map +1 -0
- package/build/npm/cjs/dev/profiling/index.js +38 -0
- package/build/npm/cjs/dev/profiling/index.js.map +1 -0
- package/build/npm/cjs/dev/profiling/integration.js +120 -0
- package/build/npm/cjs/dev/profiling/integration.js.map +1 -0
- package/build/npm/cjs/dev/profiling/startProfileForSpan.js +91 -0
- package/build/npm/cjs/dev/profiling/startProfileForSpan.js.map +1 -0
- package/build/npm/cjs/dev/profiling/utils.js +498 -0
- package/build/npm/cjs/dev/profiling/utils.js.map +1 -0
- package/build/npm/cjs/dev/report-dialog.js +53 -0
- package/build/npm/cjs/dev/report-dialog.js.map +1 -0
- package/build/npm/cjs/dev/sdk.js +70 -0
- package/build/npm/cjs/dev/sdk.js.map +1 -0
- package/build/npm/cjs/dev/stack-parsers.js +118 -0
- package/build/npm/cjs/dev/stack-parsers.js.map +1 -0
- package/build/npm/cjs/dev/tracing/backgroundtab.js +34 -0
- package/build/npm/cjs/dev/tracing/backgroundtab.js.map +1 -0
- package/build/npm/cjs/dev/tracing/browserTracingIntegration.js +437 -0
- package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -0
- package/build/npm/cjs/dev/tracing/linkedTraces.js +140 -0
- package/build/npm/cjs/dev/tracing/linkedTraces.js.map +1 -0
- package/build/npm/cjs/dev/tracing/reportPageLoaded.js +10 -0
- package/build/npm/cjs/dev/tracing/reportPageLoaded.js.map +1 -0
- package/build/npm/cjs/dev/tracing/request.js +236 -0
- package/build/npm/cjs/dev/tracing/request.js.map +1 -0
- package/build/npm/cjs/dev/tracing/setActiveSpan.js +21 -0
- package/build/npm/cjs/dev/tracing/setActiveSpan.js.map +1 -0
- package/build/npm/cjs/dev/tracing/utils.js +31 -0
- package/build/npm/cjs/dev/tracing/utils.js.map +1 -0
- package/build/npm/cjs/dev/transports/fetch.js +58 -0
- package/build/npm/cjs/dev/transports/fetch.js.map +1 -0
- package/build/npm/cjs/dev/transports/offline.js +111 -0
- package/build/npm/cjs/dev/transports/offline.js.map +1 -0
- package/build/npm/cjs/dev/userfeedback.js +32 -0
- package/build/npm/cjs/dev/userfeedback.js.map +1 -0
- package/build/npm/cjs/dev/utils/detectBrowserExtension.js +38 -0
- package/build/npm/cjs/dev/utils/detectBrowserExtension.js.map +1 -0
- package/build/npm/cjs/dev/utils/lazyLoadIntegration.js +92 -0
- package/build/npm/cjs/dev/utils/lazyLoadIntegration.js.map +1 -0
- package/build/npm/cjs/prod/client.js +77 -0
- package/build/npm/cjs/prod/client.js.map +1 -0
- package/build/npm/cjs/prod/debug-build.js +6 -0
- package/build/npm/cjs/prod/debug-build.js.map +1 -0
- package/build/npm/cjs/prod/diagnose-sdk.js +34 -0
- package/build/npm/cjs/prod/diagnose-sdk.js.map +1 -0
- package/build/npm/cjs/prod/eventbuilder.js +231 -0
- package/build/npm/cjs/prod/eventbuilder.js.map +1 -0
- package/build/npm/cjs/prod/feedbackAsync.js +11 -0
- package/build/npm/cjs/prod/feedbackAsync.js.map +1 -0
- package/build/npm/cjs/prod/feedbackSync.js +11 -0
- package/build/npm/cjs/prod/feedbackSync.js.map +1 -0
- package/build/npm/cjs/prod/helpers.js +108 -0
- package/build/npm/cjs/prod/helpers.js.map +1 -0
- package/build/npm/cjs/prod/index.js +208 -0
- package/build/npm/cjs/prod/index.js.map +1 -0
- package/build/npm/cjs/prod/integrations/breadcrumbs.js +249 -0
- package/build/npm/cjs/prod/integrations/breadcrumbs.js.map +1 -0
- package/build/npm/cjs/prod/integrations/browserapierrors.js +167 -0
- package/build/npm/cjs/prod/integrations/browserapierrors.js.map +1 -0
- package/build/npm/cjs/prod/integrations/browsersession.js +50 -0
- package/build/npm/cjs/prod/integrations/browsersession.js.map +1 -0
- package/build/npm/cjs/prod/integrations/contextlines.js +53 -0
- package/build/npm/cjs/prod/integrations/contextlines.js.map +1 -0
- package/build/npm/cjs/prod/integrations/culturecontext.js +50 -0
- package/build/npm/cjs/prod/integrations/culturecontext.js.map +1 -0
- package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js +8 -0
- package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js.map +1 -0
- package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js +30 -0
- package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -0
- package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js +32 -0
- package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js.map +1 -0
- package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js +23 -0
- package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js.map +1 -0
- package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js +37 -0
- package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js.map +1 -0
- package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js +60 -0
- package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js.map +1 -0
- package/build/npm/cjs/prod/integrations/globalhandlers.js +143 -0
- package/build/npm/cjs/prod/integrations/globalhandlers.js.map +1 -0
- package/build/npm/cjs/prod/integrations/graphqlClient.js +148 -0
- package/build/npm/cjs/prod/integrations/graphqlClient.js.map +1 -0
- package/build/npm/cjs/prod/integrations/httpclient.js +250 -0
- package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -0
- package/build/npm/cjs/prod/integrations/httpcontext.js +47 -0
- package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -0
- package/build/npm/cjs/prod/integrations/linkederrors.js +31 -0
- package/build/npm/cjs/prod/integrations/linkederrors.js.map +1 -0
- package/build/npm/cjs/prod/integrations/reportingobserver.js +60 -0
- package/build/npm/cjs/prod/integrations/reportingobserver.js.map +1 -0
- package/build/npm/cjs/prod/integrations/spanstreaming.js +49 -0
- package/build/npm/cjs/prod/integrations/spanstreaming.js.map +1 -0
- package/build/npm/cjs/prod/integrations/spotlight.js +61 -0
- package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -0
- package/build/npm/cjs/prod/integrations/view-hierarchy.js +74 -0
- package/build/npm/cjs/prod/integrations/view-hierarchy.js.map +1 -0
- package/build/npm/cjs/prod/integrations/webVitals.js +62 -0
- package/build/npm/cjs/prod/integrations/webVitals.js.map +1 -0
- package/build/npm/cjs/prod/integrations/webWorker.js +133 -0
- package/build/npm/cjs/prod/integrations/webWorker.js.map +1 -0
- package/build/npm/cjs/prod/normalizeStringifyValue.js +27 -0
- package/build/npm/cjs/prod/normalizeStringifyValue.js.map +1 -0
- package/build/npm/cjs/prod/profiling/UIProfiler.js +306 -0
- package/build/npm/cjs/prod/profiling/UIProfiler.js.map +1 -0
- package/build/npm/cjs/prod/profiling/index.js +38 -0
- package/build/npm/cjs/prod/profiling/index.js.map +1 -0
- package/build/npm/cjs/prod/profiling/integration.js +120 -0
- package/build/npm/cjs/prod/profiling/integration.js.map +1 -0
- package/build/npm/cjs/prod/profiling/startProfileForSpan.js +91 -0
- package/build/npm/cjs/prod/profiling/startProfileForSpan.js.map +1 -0
- package/build/npm/cjs/prod/profiling/utils.js +498 -0
- package/build/npm/cjs/prod/profiling/utils.js.map +1 -0
- package/build/npm/cjs/prod/report-dialog.js +53 -0
- package/build/npm/cjs/prod/report-dialog.js.map +1 -0
- package/build/npm/cjs/prod/sdk.js +60 -0
- package/build/npm/cjs/prod/sdk.js.map +1 -0
- package/build/npm/cjs/prod/stack-parsers.js +118 -0
- package/build/npm/cjs/prod/stack-parsers.js.map +1 -0
- package/build/npm/cjs/prod/tracing/backgroundtab.js +34 -0
- package/build/npm/cjs/prod/tracing/backgroundtab.js.map +1 -0
- package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +437 -0
- package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -0
- package/build/npm/cjs/prod/tracing/linkedTraces.js +139 -0
- package/build/npm/cjs/prod/tracing/linkedTraces.js.map +1 -0
- package/build/npm/cjs/prod/tracing/reportPageLoaded.js +10 -0
- package/build/npm/cjs/prod/tracing/reportPageLoaded.js.map +1 -0
- package/build/npm/cjs/prod/tracing/request.js +236 -0
- package/build/npm/cjs/prod/tracing/request.js.map +1 -0
- package/build/npm/cjs/prod/tracing/setActiveSpan.js +21 -0
- package/build/npm/cjs/prod/tracing/setActiveSpan.js.map +1 -0
- package/build/npm/cjs/prod/tracing/utils.js +31 -0
- package/build/npm/cjs/prod/tracing/utils.js.map +1 -0
- package/build/npm/cjs/prod/transports/fetch.js +58 -0
- package/build/npm/cjs/prod/transports/fetch.js.map +1 -0
- package/build/npm/cjs/prod/transports/offline.js +111 -0
- package/build/npm/cjs/prod/transports/offline.js.map +1 -0
- package/build/npm/cjs/prod/userfeedback.js +32 -0
- package/build/npm/cjs/prod/userfeedback.js.map +1 -0
- package/build/npm/cjs/prod/utils/detectBrowserExtension.js +38 -0
- package/build/npm/cjs/prod/utils/detectBrowserExtension.js.map +1 -0
- package/build/npm/cjs/prod/utils/lazyLoadIntegration.js +92 -0
- package/build/npm/cjs/prod/utils/lazyLoadIntegration.js.map +1 -0
- package/build/npm/esm/dev/client.js +74 -0
- package/build/npm/esm/dev/client.js.map +1 -0
- package/build/npm/esm/dev/debug-build.js +4 -0
- package/build/npm/esm/dev/debug-build.js.map +1 -0
- package/build/npm/esm/dev/diagnose-sdk.js +32 -0
- package/build/npm/esm/dev/diagnose-sdk.js.map +1 -0
- package/build/npm/esm/dev/eventbuilder.js +224 -0
- package/build/npm/esm/dev/eventbuilder.js.map +1 -0
- package/build/npm/esm/dev/feedbackAsync.js +9 -0
- package/build/npm/esm/dev/feedbackAsync.js.map +1 -0
- package/build/npm/esm/dev/feedbackSync.js +9 -0
- package/build/npm/esm/dev/feedbackSync.js.map +1 -0
- package/build/npm/esm/dev/helpers.js +102 -0
- package/build/npm/esm/dev/helpers.js.map +1 -0
- package/build/npm/esm/dev/index.js +48 -0
- package/build/npm/esm/dev/index.js.map +1 -0
- package/build/npm/esm/dev/integrations/breadcrumbs.js +247 -0
- package/build/npm/esm/dev/integrations/breadcrumbs.js.map +1 -0
- package/build/npm/esm/dev/integrations/browserapierrors.js +165 -0
- package/build/npm/esm/dev/integrations/browserapierrors.js.map +1 -0
- package/build/npm/esm/dev/integrations/browsersession.js +48 -0
- package/build/npm/esm/dev/integrations/browsersession.js.map +1 -0
- package/build/npm/esm/dev/integrations/contextlines.js +50 -0
- package/build/npm/esm/dev/integrations/contextlines.js.map +1 -0
- package/build/npm/esm/dev/integrations/culturecontext.js +48 -0
- package/build/npm/esm/dev/integrations/culturecontext.js.map +1 -0
- package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js +6 -0
- package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js.map +1 -0
- package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js +27 -0
- package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -0
- package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js +29 -0
- package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js.map +1 -0
- package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js +21 -0
- package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js.map +1 -0
- package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js +35 -0
- package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js.map +1 -0
- package/build/npm/esm/dev/integrations/fetchStreamPerformance.js +58 -0
- package/build/npm/esm/dev/integrations/fetchStreamPerformance.js.map +1 -0
- package/build/npm/esm/dev/integrations/globalhandlers.js +139 -0
- package/build/npm/esm/dev/integrations/globalhandlers.js.map +1 -0
- package/build/npm/esm/dev/integrations/graphqlClient.js +142 -0
- package/build/npm/esm/dev/integrations/graphqlClient.js.map +1 -0
- package/build/npm/esm/dev/integrations/httpclient.js +248 -0
- package/build/npm/esm/dev/integrations/httpclient.js.map +1 -0
- package/build/npm/esm/dev/integrations/httpcontext.js +45 -0
- package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -0
- package/build/npm/esm/dev/integrations/linkederrors.js +29 -0
- package/build/npm/esm/dev/integrations/linkederrors.js.map +1 -0
- package/build/npm/esm/dev/integrations/reportingobserver.js +58 -0
- package/build/npm/esm/dev/integrations/reportingobserver.js.map +1 -0
- package/build/npm/esm/dev/integrations/spanstreaming.js +47 -0
- package/build/npm/esm/dev/integrations/spanstreaming.js.map +1 -0
- package/build/npm/esm/dev/integrations/spotlight.js +57 -0
- package/build/npm/esm/dev/integrations/spotlight.js.map +1 -0
- package/build/npm/esm/dev/integrations/view-hierarchy.js +72 -0
- package/build/npm/esm/dev/integrations/view-hierarchy.js.map +1 -0
- package/build/npm/esm/dev/integrations/webVitals.js +59 -0
- package/build/npm/esm/dev/integrations/webVitals.js.map +1 -0
- package/build/npm/esm/dev/integrations/webWorker.js +129 -0
- package/build/npm/esm/dev/integrations/webWorker.js.map +1 -0
- package/build/npm/esm/dev/normalizeStringifyValue.js +25 -0
- package/build/npm/esm/dev/normalizeStringifyValue.js.map +1 -0
- package/build/npm/esm/dev/package.json +1 -0
- package/build/npm/esm/dev/profiling/UIProfiler.js +304 -0
- package/build/npm/esm/dev/profiling/UIProfiler.js.map +1 -0
- package/build/npm/esm/dev/profiling/index.js +36 -0
- package/build/npm/esm/dev/profiling/index.js.map +1 -0
- package/build/npm/esm/dev/profiling/integration.js +118 -0
- package/build/npm/esm/dev/profiling/integration.js.map +1 -0
- package/build/npm/esm/dev/profiling/startProfileForSpan.js +89 -0
- package/build/npm/esm/dev/profiling/startProfileForSpan.js.map +1 -0
- package/build/npm/esm/dev/profiling/utils.js +474 -0
- package/build/npm/esm/dev/profiling/utils.js.map +1 -0
- package/build/npm/esm/dev/report-dialog.js +51 -0
- package/build/npm/esm/dev/report-dialog.js.map +1 -0
- package/build/npm/esm/dev/sdk.js +65 -0
- package/build/npm/esm/dev/sdk.js.map +1 -0
- package/build/npm/esm/dev/stack-parsers.js +110 -0
- package/build/npm/esm/dev/stack-parsers.js.map +1 -0
- package/build/npm/esm/dev/tracing/backgroundtab.js +32 -0
- package/build/npm/esm/dev/tracing/backgroundtab.js.map +1 -0
- package/build/npm/esm/dev/tracing/browserTracingIntegration.js +429 -0
- package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -0
- package/build/npm/esm/dev/tracing/linkedTraces.js +131 -0
- package/build/npm/esm/dev/tracing/linkedTraces.js.map +1 -0
- package/build/npm/esm/dev/tracing/reportPageLoaded.js +8 -0
- package/build/npm/esm/dev/tracing/reportPageLoaded.js.map +1 -0
- package/build/npm/esm/dev/tracing/request.js +232 -0
- package/build/npm/esm/dev/tracing/request.js.map +1 -0
- package/build/npm/esm/dev/tracing/setActiveSpan.js +19 -0
- package/build/npm/esm/dev/tracing/setActiveSpan.js.map +1 -0
- package/build/npm/esm/dev/tracing/utils.js +26 -0
- package/build/npm/esm/dev/tracing/utils.js.map +1 -0
- package/build/npm/esm/dev/transports/fetch.js +56 -0
- package/build/npm/esm/dev/transports/fetch.js.map +1 -0
- package/build/npm/esm/dev/transports/offline.js +105 -0
- package/build/npm/esm/dev/transports/offline.js.map +1 -0
- package/build/npm/esm/dev/userfeedback.js +30 -0
- package/build/npm/esm/dev/userfeedback.js.map +1 -0
- package/build/npm/esm/dev/utils/detectBrowserExtension.js +36 -0
- package/build/npm/esm/dev/utils/detectBrowserExtension.js.map +1 -0
- package/build/npm/esm/dev/utils/lazyLoadIntegration.js +89 -0
- package/build/npm/esm/dev/utils/lazyLoadIntegration.js.map +1 -0
- package/build/npm/esm/prod/client.js +74 -0
- package/build/npm/esm/prod/client.js.map +1 -0
- package/build/npm/esm/prod/debug-build.js +4 -0
- package/build/npm/esm/prod/debug-build.js.map +1 -0
- package/build/npm/esm/prod/diagnose-sdk.js +32 -0
- package/build/npm/esm/prod/diagnose-sdk.js.map +1 -0
- package/build/npm/esm/prod/eventbuilder.js +224 -0
- package/build/npm/esm/prod/eventbuilder.js.map +1 -0
- package/build/npm/esm/prod/feedbackAsync.js +9 -0
- package/build/npm/esm/prod/feedbackAsync.js.map +1 -0
- package/build/npm/esm/prod/feedbackSync.js +9 -0
- package/build/npm/esm/prod/feedbackSync.js.map +1 -0
- package/build/npm/esm/prod/helpers.js +102 -0
- package/build/npm/esm/prod/helpers.js.map +1 -0
- package/build/npm/esm/prod/index.js +48 -0
- package/build/npm/esm/prod/index.js.map +1 -0
- package/build/npm/esm/prod/integrations/breadcrumbs.js +247 -0
- package/build/npm/esm/prod/integrations/breadcrumbs.js.map +1 -0
- package/build/npm/esm/prod/integrations/browserapierrors.js +165 -0
- package/build/npm/esm/prod/integrations/browserapierrors.js.map +1 -0
- package/build/npm/esm/prod/integrations/browsersession.js +48 -0
- package/build/npm/esm/prod/integrations/browsersession.js.map +1 -0
- package/build/npm/esm/prod/integrations/contextlines.js +50 -0
- package/build/npm/esm/prod/integrations/contextlines.js.map +1 -0
- package/build/npm/esm/prod/integrations/culturecontext.js +48 -0
- package/build/npm/esm/prod/integrations/culturecontext.js.map +1 -0
- package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js +6 -0
- package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js.map +1 -0
- package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js +27 -0
- package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -0
- package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js +29 -0
- package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js.map +1 -0
- package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js +21 -0
- package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js.map +1 -0
- package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js +35 -0
- package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js.map +1 -0
- package/build/npm/esm/prod/integrations/fetchStreamPerformance.js +58 -0
- package/build/npm/esm/prod/integrations/fetchStreamPerformance.js.map +1 -0
- package/build/npm/esm/prod/integrations/globalhandlers.js +139 -0
- package/build/npm/esm/prod/integrations/globalhandlers.js.map +1 -0
- package/build/npm/esm/prod/integrations/graphqlClient.js +142 -0
- package/build/npm/esm/prod/integrations/graphqlClient.js.map +1 -0
- package/build/npm/esm/prod/integrations/httpclient.js +248 -0
- package/build/npm/esm/prod/integrations/httpclient.js.map +1 -0
- package/build/npm/esm/prod/integrations/httpcontext.js +45 -0
- package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -0
- package/build/npm/esm/prod/integrations/linkederrors.js +29 -0
- package/build/npm/esm/prod/integrations/linkederrors.js.map +1 -0
- package/build/npm/esm/prod/integrations/reportingobserver.js +58 -0
- package/build/npm/esm/prod/integrations/reportingobserver.js.map +1 -0
- package/build/npm/esm/prod/integrations/spanstreaming.js +47 -0
- package/build/npm/esm/prod/integrations/spanstreaming.js.map +1 -0
- package/build/npm/esm/prod/integrations/spotlight.js +57 -0
- package/build/npm/esm/prod/integrations/spotlight.js.map +1 -0
- package/build/npm/esm/prod/integrations/view-hierarchy.js +72 -0
- package/build/npm/esm/prod/integrations/view-hierarchy.js.map +1 -0
- package/build/npm/esm/prod/integrations/webVitals.js +59 -0
- package/build/npm/esm/prod/integrations/webVitals.js.map +1 -0
- package/build/npm/esm/prod/integrations/webWorker.js +129 -0
- package/build/npm/esm/prod/integrations/webWorker.js.map +1 -0
- package/build/npm/esm/prod/normalizeStringifyValue.js +25 -0
- package/build/npm/esm/prod/normalizeStringifyValue.js.map +1 -0
- package/build/npm/esm/prod/package.json +1 -0
- package/build/npm/esm/prod/profiling/UIProfiler.js +304 -0
- package/build/npm/esm/prod/profiling/UIProfiler.js.map +1 -0
- package/build/npm/esm/prod/profiling/index.js +36 -0
- package/build/npm/esm/prod/profiling/index.js.map +1 -0
- package/build/npm/esm/prod/profiling/integration.js +118 -0
- package/build/npm/esm/prod/profiling/integration.js.map +1 -0
- package/build/npm/esm/prod/profiling/startProfileForSpan.js +89 -0
- package/build/npm/esm/prod/profiling/startProfileForSpan.js.map +1 -0
- package/build/npm/esm/prod/profiling/utils.js +474 -0
- package/build/npm/esm/prod/profiling/utils.js.map +1 -0
- package/build/npm/esm/prod/report-dialog.js +51 -0
- package/build/npm/esm/prod/report-dialog.js.map +1 -0
- package/build/npm/esm/prod/sdk.js +55 -0
- package/build/npm/esm/prod/sdk.js.map +1 -0
- package/build/npm/esm/prod/stack-parsers.js +110 -0
- package/build/npm/esm/prod/stack-parsers.js.map +1 -0
- package/build/npm/esm/prod/tracing/backgroundtab.js +32 -0
- package/build/npm/esm/prod/tracing/backgroundtab.js.map +1 -0
- package/build/npm/esm/prod/tracing/browserTracingIntegration.js +429 -0
- package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -0
- package/build/npm/esm/prod/tracing/linkedTraces.js +130 -0
- package/build/npm/esm/prod/tracing/linkedTraces.js.map +1 -0
- package/build/npm/esm/prod/tracing/reportPageLoaded.js +8 -0
- package/build/npm/esm/prod/tracing/reportPageLoaded.js.map +1 -0
- package/build/npm/esm/prod/tracing/request.js +232 -0
- package/build/npm/esm/prod/tracing/request.js.map +1 -0
- package/build/npm/esm/prod/tracing/setActiveSpan.js +19 -0
- package/build/npm/esm/prod/tracing/setActiveSpan.js.map +1 -0
- package/build/npm/esm/prod/tracing/utils.js +26 -0
- package/build/npm/esm/prod/tracing/utils.js.map +1 -0
- package/build/npm/esm/prod/transports/fetch.js +56 -0
- package/build/npm/esm/prod/transports/fetch.js.map +1 -0
- package/build/npm/esm/prod/transports/offline.js +105 -0
- package/build/npm/esm/prod/transports/offline.js.map +1 -0
- package/build/npm/esm/prod/userfeedback.js +30 -0
- package/build/npm/esm/prod/userfeedback.js.map +1 -0
- package/build/npm/esm/prod/utils/detectBrowserExtension.js +36 -0
- package/build/npm/esm/prod/utils/detectBrowserExtension.js.map +1 -0
- package/build/npm/esm/prod/utils/lazyLoadIntegration.js +89 -0
- package/build/npm/esm/prod/utils/lazyLoadIntegration.js.map +1 -0
- package/build/npm/types/client.d.ts +79 -0
- package/build/npm/types/client.d.ts.map +1 -0
- package/build/npm/types/debug-build.d.ts +7 -0
- package/build/npm/types/debug-build.d.ts.map +1 -0
- package/build/npm/types/diagnose-sdk.d.ts +11 -0
- package/build/npm/types/diagnose-sdk.d.ts.map +1 -0
- package/build/npm/types/eventbuilder.d.ts +40 -0
- package/build/npm/types/eventbuilder.d.ts.map +1 -0
- package/build/npm/types/exports.d.ts +21 -0
- package/build/npm/types/exports.d.ts.map +1 -0
- package/build/npm/types/feedbackAsync.d.ts +7 -0
- package/build/npm/types/feedbackAsync.d.ts.map +1 -0
- package/build/npm/types/feedbackSync.d.ts +4 -0
- package/build/npm/types/feedbackSync.d.ts.map +1 -0
- package/build/npm/types/helpers.d.ts +27 -0
- package/build/npm/types/helpers.d.ts.map +1 -0
- package/build/npm/types/index.bundle.base.d.ts +2 -0
- package/build/npm/types/index.bundle.base.d.ts.map +1 -0
- package/build/npm/types/index.bundle.d.ts +5 -0
- package/build/npm/types/index.bundle.d.ts.map +1 -0
- package/build/npm/types/index.bundle.feedback.d.ts +7 -0
- package/build/npm/types/index.bundle.feedback.d.ts.map +1 -0
- package/build/npm/types/index.bundle.logs.metrics.d.ts +6 -0
- package/build/npm/types/index.bundle.logs.metrics.d.ts.map +1 -0
- package/build/npm/types/index.bundle.replay.d.ts +6 -0
- package/build/npm/types/index.bundle.replay.d.ts.map +1 -0
- package/build/npm/types/index.bundle.replay.feedback.d.ts +8 -0
- package/build/npm/types/index.bundle.replay.feedback.d.ts.map +1 -0
- package/build/npm/types/index.bundle.replay.logs.metrics.d.ts +7 -0
- package/build/npm/types/index.bundle.replay.logs.metrics.d.ts.map +1 -0
- package/build/npm/types/index.bundle.tracing.d.ts +13 -0
- package/build/npm/types/index.bundle.tracing.d.ts.map +1 -0
- package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts +13 -0
- package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts.map +1 -0
- package/build/npm/types/index.bundle.tracing.replay.d.ts +14 -0
- package/build/npm/types/index.bundle.tracing.replay.d.ts.map +1 -0
- package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts +16 -0
- package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts.map +1 -0
- package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +14 -0
- package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts.map +1 -0
- package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts +14 -0
- package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts.map +1 -0
- package/build/npm/types/index.d.ts +38 -0
- package/build/npm/types/index.d.ts.map +1 -0
- package/build/npm/types/integrations/breadcrumbs.d.ts +16 -0
- package/build/npm/types/integrations/breadcrumbs.d.ts.map +1 -0
- package/build/npm/types/integrations/browserapierrors.d.ts +23 -0
- package/build/npm/types/integrations/browserapierrors.d.ts.map +1 -0
- package/build/npm/types/integrations/browserprofiling.d.ts +2 -0
- package/build/npm/types/integrations/browserprofiling.d.ts.map +1 -0
- package/build/npm/types/integrations/browsersession.d.ts +25 -0
- package/build/npm/types/integrations/browsersession.d.ts.map +1 -0
- package/build/npm/types/integrations/contextlines.d.ts +32 -0
- package/build/npm/types/integrations/contextlines.d.ts.map +1 -0
- package/build/npm/types/integrations/culturecontext.d.ts +18 -0
- package/build/npm/types/integrations/culturecontext.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/growthbook/index.d.ts +2 -0
- package/build/npm/types/integrations/featureFlags/growthbook/index.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/growthbook/integration.d.ts +25 -0
- package/build/npm/types/integrations/featureFlags/growthbook/integration.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/growthbook/types.d.ts +6 -0
- package/build/npm/types/integrations/featureFlags/growthbook/types.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/index.d.ts +2 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/index.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/integration.d.ts +27 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/integration.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/types.d.ts +44 -0
- package/build/npm/types/integrations/featureFlags/launchdarkly/types.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/openfeature/index.d.ts +2 -0
- package/build/npm/types/integrations/featureFlags/openfeature/index.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/openfeature/integration.d.ts +18 -0
- package/build/npm/types/integrations/featureFlags/openfeature/integration.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/openfeature/types.d.ts +78 -0
- package/build/npm/types/integrations/featureFlags/openfeature/types.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/statsig/index.d.ts +2 -0
- package/build/npm/types/integrations/featureFlags/statsig/index.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/statsig/integration.d.ts +30 -0
- package/build/npm/types/integrations/featureFlags/statsig/integration.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/statsig/types.d.ts +14 -0
- package/build/npm/types/integrations/featureFlags/statsig/types.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/unleash/index.d.ts +2 -0
- package/build/npm/types/integrations/featureFlags/unleash/index.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/unleash/integration.d.ts +31 -0
- package/build/npm/types/integrations/featureFlags/unleash/integration.d.ts.map +1 -0
- package/build/npm/types/integrations/featureFlags/unleash/types.d.ts +21 -0
- package/build/npm/types/integrations/featureFlags/unleash/types.d.ts.map +1 -0
- package/build/npm/types/integrations/fetchStreamPerformance.d.ts +16 -0
- package/build/npm/types/integrations/fetchStreamPerformance.d.ts.map +1 -0
- package/build/npm/types/integrations/globalhandlers.d.ts +19 -0
- package/build/npm/types/integrations/globalhandlers.d.ts.map +1 -0
- package/build/npm/types/integrations/graphqlClient.d.ts +60 -0
- package/build/npm/types/integrations/graphqlClient.d.ts.map +1 -0
- package/build/npm/types/integrations/httpclient.d.ts +29 -0
- package/build/npm/types/integrations/httpclient.d.ts.map +1 -0
- package/build/npm/types/integrations/httpcontext.d.ts +8 -0
- package/build/npm/types/integrations/httpcontext.d.ts.map +1 -0
- package/build/npm/types/integrations/linkederrors.d.ts +12 -0
- package/build/npm/types/integrations/linkederrors.d.ts.map +1 -0
- package/build/npm/types/integrations/reportingobserver.d.ts +12 -0
- package/build/npm/types/integrations/reportingobserver.d.ts.map +1 -0
- package/build/npm/types/integrations/spanstreaming.d.ts +4 -0
- package/build/npm/types/integrations/spanstreaming.d.ts.map +1 -0
- package/build/npm/types/integrations/spotlight.d.ts +21 -0
- package/build/npm/types/integrations/spotlight.d.ts.map +1 -0
- package/build/npm/types/integrations/view-hierarchy.d.ts +51 -0
- package/build/npm/types/integrations/view-hierarchy.d.ts.map +1 -0
- package/build/npm/types/integrations/webVitals.d.ts +26 -0
- package/build/npm/types/integrations/webVitals.d.ts.map +1 -0
- package/build/npm/types/integrations/webWorker.d.ts +129 -0
- package/build/npm/types/integrations/webWorker.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.captureconsole.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.captureconsole.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.createlangchaincallbackhandler.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.createlangchaincallbackhandler.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.dedupe.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.dedupe.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.extraerrordata.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.extraerrordata.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.feedback.d.ts +5 -0
- package/build/npm/types/integrations-bundle/index.feedback.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.graphqlclient.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.graphqlclient.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.instrumentanthropicaiclient.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.instrumentanthropicaiclient.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.instrumentgooglegenaiclient.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.instrumentgooglegenaiclient.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.instrumentlangchainembeddings.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.instrumentlangchainembeddings.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.instrumentlanggraph.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.instrumentlanggraph.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.instrumentopenaiclient.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.instrumentopenaiclient.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.instrumentstategraph.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.instrumentstategraph.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.modulemetadata.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.modulemetadata.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.rewriteframes.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.rewriteframes.d.ts.map +1 -0
- package/build/npm/types/integrations-bundle/index.spotlight.d.ts +2 -0
- package/build/npm/types/integrations-bundle/index.spotlight.d.ts.map +1 -0
- package/build/npm/types/normalizeStringifyValue.d.ts +15 -0
- package/build/npm/types/normalizeStringifyValue.d.ts.map +1 -0
- package/build/npm/types/pluggable-exports-bundle/index.multiplexedtransport.d.ts +2 -0
- package/build/npm/types/pluggable-exports-bundle/index.multiplexedtransport.d.ts.map +1 -0
- package/build/npm/types/profiling/UIProfiler.d.ts +75 -0
- package/build/npm/types/profiling/UIProfiler.d.ts.map +1 -0
- package/build/npm/types/profiling/index.d.ts +8 -0
- package/build/npm/types/profiling/index.d.ts.map +1 -0
- package/build/npm/types/profiling/integration.d.ts +4 -0
- package/build/npm/types/profiling/integration.d.ts.map +1 -0
- package/build/npm/types/profiling/jsSelfProfiling.d.ts +41 -0
- package/build/npm/types/profiling/jsSelfProfiling.d.ts.map +1 -0
- package/build/npm/types/profiling/startProfileForSpan.d.ts +8 -0
- package/build/npm/types/profiling/startProfileForSpan.d.ts.map +1 -0
- package/build/npm/types/profiling/utils.d.ts +112 -0
- package/build/npm/types/profiling/utils.d.ts.map +1 -0
- package/build/npm/types/report-dialog.d.ts +8 -0
- package/build/npm/types/report-dialog.d.ts.map +1 -0
- package/build/npm/types/sdk.d.ts +62 -0
- package/build/npm/types/sdk.d.ts.map +1 -0
- package/build/npm/types/stack-parsers.d.ts +9 -0
- package/build/npm/types/stack-parsers.d.ts.map +1 -0
- package/build/npm/types/tracing/backgroundtab.d.ts +6 -0
- package/build/npm/types/tracing/backgroundtab.d.ts.map +1 -0
- package/build/npm/types/tracing/browserTracingIntegration.d.ts +271 -0
- package/build/npm/types/tracing/browserTracingIntegration.d.ts.map +1 -0
- package/build/npm/types/tracing/linkedTraces.d.ts +52 -0
- package/build/npm/types/tracing/linkedTraces.d.ts.map +1 -0
- package/build/npm/types/tracing/reportPageLoaded.d.ts +11 -0
- package/build/npm/types/tracing/reportPageLoaded.d.ts.map +1 -0
- package/build/npm/types/tracing/request.d.ts +87 -0
- package/build/npm/types/tracing/request.d.ts.map +1 -0
- package/build/npm/types/tracing/setActiveSpan.d.ts +39 -0
- package/build/npm/types/tracing/setActiveSpan.d.ts.map +1 -0
- package/build/npm/types/tracing/utils.d.ts +17 -0
- package/build/npm/types/tracing/utils.d.ts.map +1 -0
- package/build/npm/types/transports/fetch.d.ts +8 -0
- package/build/npm/types/transports/fetch.d.ts.map +1 -0
- package/build/npm/types/transports/offline.d.ts +33 -0
- package/build/npm/types/transports/offline.d.ts.map +1 -0
- package/build/npm/types/transports/types.d.ts +6 -0
- package/build/npm/types/transports/types.d.ts.map +1 -0
- package/build/npm/types/userfeedback.d.ts +10 -0
- package/build/npm/types/userfeedback.d.ts.map +1 -0
- package/build/npm/types/utils/detectBrowserExtension.d.ts +6 -0
- package/build/npm/types/utils/detectBrowserExtension.d.ts.map +1 -0
- package/build/npm/types/utils/lazyLoadIntegration.d.ts +13 -0
- package/build/npm/types/utils/lazyLoadIntegration.d.ts.map +1 -0
- package/build/npm/types-ts3.8/client.d.ts +79 -0
- package/build/npm/types-ts3.8/debug-build.d.ts +7 -0
- package/build/npm/types-ts3.8/diagnose-sdk.d.ts +11 -0
- package/build/npm/types-ts3.8/eventbuilder.d.ts +40 -0
- package/build/npm/types-ts3.8/exports.d.ts +21 -0
- package/build/npm/types-ts3.8/feedbackAsync.d.ts +7 -0
- package/build/npm/types-ts3.8/feedbackSync.d.ts +4 -0
- package/build/npm/types-ts3.8/helpers.d.ts +27 -0
- package/build/npm/types-ts3.8/index.bundle.base.d.ts +2 -0
- package/build/npm/types-ts3.8/index.bundle.d.ts +5 -0
- package/build/npm/types-ts3.8/index.bundle.feedback.d.ts +7 -0
- package/build/npm/types-ts3.8/index.bundle.logs.metrics.d.ts +6 -0
- package/build/npm/types-ts3.8/index.bundle.replay.d.ts +6 -0
- package/build/npm/types-ts3.8/index.bundle.replay.feedback.d.ts +8 -0
- package/build/npm/types-ts3.8/index.bundle.replay.logs.metrics.d.ts +7 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.d.ts +13 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.logs.metrics.d.ts +13 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.d.ts +14 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.d.ts +16 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +14 -0
- package/build/npm/types-ts3.8/index.bundle.tracing.replay.logs.metrics.d.ts +14 -0
- package/build/npm/types-ts3.8/index.d.ts +38 -0
- package/build/npm/types-ts3.8/integrations/breadcrumbs.d.ts +16 -0
- package/build/npm/types-ts3.8/integrations/browserapierrors.d.ts +23 -0
- package/build/npm/types-ts3.8/integrations/browserprofiling.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations/browsersession.d.ts +25 -0
- package/build/npm/types-ts3.8/integrations/contextlines.d.ts +32 -0
- package/build/npm/types-ts3.8/integrations/culturecontext.d.ts +18 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/growthbook/index.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/growthbook/integration.d.ts +25 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/growthbook/types.d.ts +6 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/index.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/integration.d.ts +27 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/launchdarkly/types.d.ts +44 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/openfeature/index.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/openfeature/integration.d.ts +18 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/openfeature/types.d.ts +78 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/statsig/index.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/statsig/integration.d.ts +30 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/statsig/types.d.ts +14 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/unleash/index.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/unleash/integration.d.ts +31 -0
- package/build/npm/types-ts3.8/integrations/featureFlags/unleash/types.d.ts +21 -0
- package/build/npm/types-ts3.8/integrations/fetchStreamPerformance.d.ts +16 -0
- package/build/npm/types-ts3.8/integrations/globalhandlers.d.ts +19 -0
- package/build/npm/types-ts3.8/integrations/graphqlClient.d.ts +60 -0
- package/build/npm/types-ts3.8/integrations/httpclient.d.ts +32 -0
- package/build/npm/types-ts3.8/integrations/httpcontext.d.ts +8 -0
- package/build/npm/types-ts3.8/integrations/linkederrors.d.ts +12 -0
- package/build/npm/types-ts3.8/integrations/reportingobserver.d.ts +12 -0
- package/build/npm/types-ts3.8/integrations/spanstreaming.d.ts +4 -0
- package/build/npm/types-ts3.8/integrations/spotlight.d.ts +21 -0
- package/build/npm/types-ts3.8/integrations/view-hierarchy.d.ts +51 -0
- package/build/npm/types-ts3.8/integrations/webVitals.d.ts +26 -0
- package/build/npm/types-ts3.8/integrations/webWorker.d.ts +129 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.captureconsole.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.createlangchaincallbackhandler.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.dedupe.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.extraerrordata.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.feedback.d.ts +5 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.graphqlclient.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentanthropicaiclient.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentgooglegenaiclient.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentlangchainembeddings.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentlanggraph.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentopenaiclient.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.instrumentstategraph.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.modulemetadata.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.rewriteframes.d.ts +2 -0
- package/build/npm/types-ts3.8/integrations-bundle/index.spotlight.d.ts +2 -0
- package/build/npm/types-ts3.8/normalizeStringifyValue.d.ts +15 -0
- package/build/npm/types-ts3.8/pluggable-exports-bundle/index.multiplexedtransport.d.ts +2 -0
- package/build/npm/types-ts3.8/profiling/UIProfiler.d.ts +75 -0
- package/build/npm/types-ts3.8/profiling/index.d.ts +8 -0
- package/build/npm/types-ts3.8/profiling/integration.d.ts +4 -0
- package/build/npm/types-ts3.8/profiling/jsSelfProfiling.d.ts +41 -0
- package/build/npm/types-ts3.8/profiling/startProfileForSpan.d.ts +8 -0
- package/build/npm/types-ts3.8/profiling/utils.d.ts +112 -0
- package/build/npm/types-ts3.8/report-dialog.d.ts +8 -0
- package/build/npm/types-ts3.8/sdk.d.ts +62 -0
- package/build/npm/types-ts3.8/stack-parsers.d.ts +9 -0
- package/build/npm/types-ts3.8/tracing/backgroundtab.d.ts +6 -0
- package/build/npm/types-ts3.8/tracing/browserTracingIntegration.d.ts +271 -0
- package/build/npm/types-ts3.8/tracing/linkedTraces.d.ts +52 -0
- package/build/npm/types-ts3.8/tracing/reportPageLoaded.d.ts +11 -0
- package/build/npm/types-ts3.8/tracing/request.d.ts +87 -0
- package/build/npm/types-ts3.8/tracing/setActiveSpan.d.ts +39 -0
- package/build/npm/types-ts3.8/tracing/utils.d.ts +17 -0
- package/build/npm/types-ts3.8/transports/fetch.d.ts +8 -0
- package/build/npm/types-ts3.8/transports/offline.d.ts +33 -0
- package/build/npm/types-ts3.8/transports/types.d.ts +6 -0
- package/build/npm/types-ts3.8/userfeedback.d.ts +10 -0
- package/build/npm/types-ts3.8/utils/detectBrowserExtension.d.ts +6 -0
- package/build/npm/types-ts3.8/utils/lazyLoadIntegration.d.ts +37 -0
- package/package.json +85 -4
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { defineIntegration, spanToJSON, SEMANTIC_ATTRIBUTE_ELENJICAL_OP, SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, isString, stringMatchesSomePattern, isObjectLike } from '@elenjical/core/browser';
|
|
2
|
+
import { ELENJICAL_XHR_DATA_KEY, getBodyString, getFetchRequestArgBody } from '@elenjical/browser-utils';
|
|
3
|
+
import { URL_FULL, GRAPHQL_DOCUMENT } from '@elenjical/conventions/attributes';
|
|
4
|
+
|
|
5
|
+
const INTEGRATION_NAME = "GraphQLClient";
|
|
6
|
+
const _graphqlClientIntegration = ((options) => {
|
|
7
|
+
return {
|
|
8
|
+
name: INTEGRATION_NAME,
|
|
9
|
+
setup(client) {
|
|
10
|
+
_updateSpanWithGraphQLData(client, options);
|
|
11
|
+
_updateBreadcrumbWithGraphQLData(client, options);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
function _updateSpanWithGraphQLData(client, options) {
|
|
16
|
+
client.on("beforeOutgoingRequestSpan", (span, hint) => {
|
|
17
|
+
const spanJSON = spanToJSON(span);
|
|
18
|
+
const spanAttributes = spanJSON.data || {};
|
|
19
|
+
const spanOp = spanAttributes[SEMANTIC_ATTRIBUTE_ELENJICAL_OP];
|
|
20
|
+
const isHttpClientSpan = spanOp === "http.client";
|
|
21
|
+
if (!isHttpClientSpan) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const httpUrl = spanAttributes[URL_FULL] || spanAttributes["http.url"] || spanAttributes["url"];
|
|
25
|
+
const httpMethod = spanAttributes[SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] || spanAttributes["http.method"];
|
|
26
|
+
if (!isString(httpUrl) || !isString(httpMethod)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const { endpoints } = options;
|
|
30
|
+
const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);
|
|
31
|
+
const payload = getRequestPayloadXhrOrFetch(hint);
|
|
32
|
+
if (isTracedGraphqlEndpoint && payload) {
|
|
33
|
+
const graphqlBody = getGraphQLRequestPayload(payload);
|
|
34
|
+
if (graphqlBody) {
|
|
35
|
+
const operationInfo = _getGraphQLOperation(graphqlBody);
|
|
36
|
+
span.updateName(`${httpMethod} ${httpUrl} (${operationInfo})`);
|
|
37
|
+
if (isStandardRequest(graphqlBody) && client.getDataCollectionOptions().graphQL.document === true) {
|
|
38
|
+
span.setAttribute(GRAPHQL_DOCUMENT, graphqlBody.query);
|
|
39
|
+
}
|
|
40
|
+
if (isPersistedRequest(graphqlBody)) {
|
|
41
|
+
span.setAttribute("graphql.persisted_query.hash.sha256", graphqlBody.extensions.persistedQuery.sha256Hash);
|
|
42
|
+
span.setAttribute("graphql.persisted_query.version", graphqlBody.extensions.persistedQuery.version);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function _updateBreadcrumbWithGraphQLData(client, options) {
|
|
49
|
+
client.on("beforeOutgoingRequestBreadcrumb", (breadcrumb, handlerData) => {
|
|
50
|
+
const { category, type, data } = breadcrumb;
|
|
51
|
+
const isFetch = category === "fetch";
|
|
52
|
+
const isXhr = category === "xhr";
|
|
53
|
+
const isHttpBreadcrumb = type === "http";
|
|
54
|
+
if (isHttpBreadcrumb && (isFetch || isXhr)) {
|
|
55
|
+
const httpUrl = data?.url;
|
|
56
|
+
const { endpoints } = options;
|
|
57
|
+
const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);
|
|
58
|
+
const payload = getRequestPayloadXhrOrFetch(handlerData);
|
|
59
|
+
if (isTracedGraphqlEndpoint && data && payload) {
|
|
60
|
+
const graphqlBody = getGraphQLRequestPayload(payload);
|
|
61
|
+
if (!data.graphql && graphqlBody) {
|
|
62
|
+
const operationInfo = _getGraphQLOperation(graphqlBody);
|
|
63
|
+
data["graphql.operation"] = operationInfo;
|
|
64
|
+
if (isStandardRequest(graphqlBody) && client.getDataCollectionOptions().graphQL.document === true) {
|
|
65
|
+
data[GRAPHQL_DOCUMENT] = graphqlBody.query;
|
|
66
|
+
}
|
|
67
|
+
if (isPersistedRequest(graphqlBody)) {
|
|
68
|
+
data["graphql.persisted_query.hash.sha256"] = graphqlBody.extensions.persistedQuery.sha256Hash;
|
|
69
|
+
data["graphql.persisted_query.version"] = graphqlBody.extensions.persistedQuery.version;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function _getGraphQLOperation(requestBody) {
|
|
77
|
+
if (isPersistedRequest(requestBody)) {
|
|
78
|
+
return `persisted ${requestBody.operationName}`;
|
|
79
|
+
}
|
|
80
|
+
if (isStandardRequest(requestBody)) {
|
|
81
|
+
const { query: graphqlQuery, operationName: graphqlOperationName } = requestBody;
|
|
82
|
+
const { operationName = graphqlOperationName, operationType } = parseGraphQLQuery(graphqlQuery);
|
|
83
|
+
const operationInfo = operationName ? `${operationType} ${operationName}` : `${operationType}`;
|
|
84
|
+
return operationInfo;
|
|
85
|
+
}
|
|
86
|
+
return "unknown";
|
|
87
|
+
}
|
|
88
|
+
function getRequestPayloadXhrOrFetch(hint) {
|
|
89
|
+
const isXhr = "xhr" in hint;
|
|
90
|
+
let body;
|
|
91
|
+
if (isXhr) {
|
|
92
|
+
const elenjicalXhrData = hint.xhr[ELENJICAL_XHR_DATA_KEY];
|
|
93
|
+
body = elenjicalXhrData && getBodyString(elenjicalXhrData.body)[0];
|
|
94
|
+
} else {
|
|
95
|
+
const elenjicalFetchData = getFetchRequestArgBody(hint.input);
|
|
96
|
+
body = getBodyString(elenjicalFetchData)[0];
|
|
97
|
+
}
|
|
98
|
+
return body;
|
|
99
|
+
}
|
|
100
|
+
function parseGraphQLQuery(query) {
|
|
101
|
+
const namedQueryRe = /^(?:\s*)(query|mutation|subscription)(?:\s*)(\w+)(?:\s*)[{(]/;
|
|
102
|
+
const unnamedQueryRe = /^(?:\s*)(query|mutation|subscription)(?:\s*)[{(]/;
|
|
103
|
+
const namedMatch = query.match(namedQueryRe);
|
|
104
|
+
if (namedMatch) {
|
|
105
|
+
return {
|
|
106
|
+
operationType: namedMatch[1],
|
|
107
|
+
operationName: namedMatch[2]
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const unnamedMatch = query.match(unnamedQueryRe);
|
|
111
|
+
if (unnamedMatch) {
|
|
112
|
+
return {
|
|
113
|
+
operationType: unnamedMatch[1],
|
|
114
|
+
operationName: void 0
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
operationType: void 0,
|
|
119
|
+
operationName: void 0
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function isStandardRequest(payload) {
|
|
123
|
+
return isObjectLike(payload) && typeof payload.query === "string";
|
|
124
|
+
}
|
|
125
|
+
function isPersistedRequest(payload) {
|
|
126
|
+
return isObjectLike(payload) && typeof payload.operationName === "string" && isObjectLike(payload.extensions) && isObjectLike(payload.extensions.persistedQuery) && typeof payload.extensions.persistedQuery.sha256Hash === "string" && typeof payload.extensions.persistedQuery.version === "number";
|
|
127
|
+
}
|
|
128
|
+
function getGraphQLRequestPayload(payload) {
|
|
129
|
+
try {
|
|
130
|
+
const requestBody = JSON.parse(payload);
|
|
131
|
+
if (isStandardRequest(requestBody) || isPersistedRequest(requestBody)) {
|
|
132
|
+
return requestBody;
|
|
133
|
+
}
|
|
134
|
+
return void 0;
|
|
135
|
+
} catch {
|
|
136
|
+
return void 0;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const graphqlClientIntegration = defineIntegration(_graphqlClientIntegration);
|
|
140
|
+
|
|
141
|
+
export { _getGraphQLOperation, getGraphQLRequestPayload, getRequestPayloadXhrOrFetch, graphqlClientIntegration, parseGraphQLQuery };
|
|
142
|
+
//# sourceMappingURL=graphqlClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphqlClient.js","sources":["../../../../../src/integrations/graphqlClient.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@elenjical/core/browser';\nimport {\n defineIntegration,\n isObjectLike,\n isString,\n SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD,\n SEMANTIC_ATTRIBUTE_ELENJICAL_OP,\n spanToJSON,\n stringMatchesSomePattern,\n} from '@elenjical/core/browser';\nimport type { FetchHint, XhrHint } from '@elenjical/browser-utils';\nimport { getBodyString, getFetchRequestArgBody, ELENJICAL_XHR_DATA_KEY } from '@elenjical/browser-utils';\nimport { GRAPHQL_DOCUMENT, URL_FULL } from '@elenjical/conventions/attributes';\n\ninterface GraphQLClientOptions {\n endpoints: Array<string | RegExp>;\n}\n\n/** Standard graphql request shape: https://graphql.org/learn/serving-over-http/#post-request-and-body */\ninterface GraphQLStandardRequest {\n query: string;\n operationName?: string;\n variables?: Record<string, unknown>;\n extensions?: Record<string, unknown>;\n}\n\n/** Persisted operation request */\ninterface GraphQLPersistedRequest {\n operationName: string;\n variables?: Record<string, unknown>;\n extensions: {\n persistedQuery: {\n version: number;\n sha256Hash: string;\n };\n } & Record<string, unknown>;\n}\n\ntype GraphQLRequestPayload = GraphQLStandardRequest | GraphQLPersistedRequest;\n\ninterface GraphQLOperation {\n operationType?: string;\n operationName?: string;\n}\n\nconst INTEGRATION_NAME = 'GraphQLClient' as const;\n\nconst _graphqlClientIntegration = ((options: GraphQLClientOptions) => {\n return {\n name: INTEGRATION_NAME,\n setup(client: Client) {\n _updateSpanWithGraphQLData(client, options);\n _updateBreadcrumbWithGraphQLData(client, options);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction _updateSpanWithGraphQLData(client: Client, options: GraphQLClientOptions): void {\n client.on('beforeOutgoingRequestSpan', (span, hint) => {\n const spanJSON = spanToJSON(span);\n\n const spanAttributes = spanJSON.data || {};\n const spanOp = spanAttributes[SEMANTIC_ATTRIBUTE_ELENJICAL_OP];\n\n const isHttpClientSpan = spanOp === 'http.client';\n\n if (!isHttpClientSpan) {\n return;\n }\n\n // Fall back to `url` because fetch instrumentation only sets `http.url` for absolute URLs;\n // relative URLs end up only in `url` (see `getFetchSpanAttributes` in packages/core/src/fetch.ts).\n const httpUrl = spanAttributes[URL_FULL] || spanAttributes['http.url'] || spanAttributes['url'];\n const httpMethod = spanAttributes[SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] || spanAttributes['http.method'];\n\n if (!isString(httpUrl) || !isString(httpMethod)) {\n return;\n }\n\n const { endpoints } = options;\n const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);\n const payload = getRequestPayloadXhrOrFetch(hint as XhrHint | FetchHint);\n\n if (isTracedGraphqlEndpoint && payload) {\n const graphqlBody = getGraphQLRequestPayload(payload);\n\n if (graphqlBody) {\n const operationInfo = _getGraphQLOperation(graphqlBody);\n span.updateName(`${httpMethod} ${httpUrl} (${operationInfo})`);\n\n // Handle standard requests - capture the query document when enabled via dataCollection (default true)\n if (isStandardRequest(graphqlBody) && client.getDataCollectionOptions().graphQL.document === true) {\n span.setAttribute(GRAPHQL_DOCUMENT, graphqlBody.query);\n }\n\n // Handle persisted operations - capture hash for debugging\n if (isPersistedRequest(graphqlBody)) {\n span.setAttribute('graphql.persisted_query.hash.sha256', graphqlBody.extensions.persistedQuery.sha256Hash);\n span.setAttribute('graphql.persisted_query.version', graphqlBody.extensions.persistedQuery.version);\n }\n }\n }\n });\n}\n\nfunction _updateBreadcrumbWithGraphQLData(client: Client, options: GraphQLClientOptions): void {\n client.on('beforeOutgoingRequestBreadcrumb', (breadcrumb, handlerData) => {\n const { category, type, data } = breadcrumb;\n\n const isFetch = category === 'fetch';\n const isXhr = category === 'xhr';\n const isHttpBreadcrumb = type === 'http';\n\n if (isHttpBreadcrumb && (isFetch || isXhr)) {\n const httpUrl = data?.url;\n const { endpoints } = options;\n\n const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);\n const payload = getRequestPayloadXhrOrFetch(handlerData as XhrHint | FetchHint);\n\n if (isTracedGraphqlEndpoint && data && payload) {\n const graphqlBody = getGraphQLRequestPayload(payload);\n\n if (!data.graphql && graphqlBody) {\n const operationInfo = _getGraphQLOperation(graphqlBody);\n\n data['graphql.operation'] = operationInfo;\n\n if (isStandardRequest(graphqlBody) && client.getDataCollectionOptions().graphQL.document === true) {\n data[GRAPHQL_DOCUMENT] = graphqlBody.query;\n }\n\n if (isPersistedRequest(graphqlBody)) {\n data['graphql.persisted_query.hash.sha256'] = graphqlBody.extensions.persistedQuery.sha256Hash;\n data['graphql.persisted_query.version'] = graphqlBody.extensions.persistedQuery.version;\n }\n }\n }\n }\n });\n}\n\n/**\n * @param requestBody - GraphQL request\n * @returns A formatted version of the request: 'TYPE NAME' or 'TYPE' or 'persisted NAME'\n */\nexport function _getGraphQLOperation(requestBody: GraphQLRequestPayload): string {\n // Handle persisted operations\n if (isPersistedRequest(requestBody)) {\n return `persisted ${requestBody.operationName}`;\n }\n\n // Handle standard GraphQL requests\n if (isStandardRequest(requestBody)) {\n const { query: graphqlQuery, operationName: graphqlOperationName } = requestBody;\n const { operationName = graphqlOperationName, operationType } = parseGraphQLQuery(graphqlQuery);\n const operationInfo = operationName ? `${operationType} ${operationName}` : `${operationType}`;\n return operationInfo;\n }\n\n // Fallback for unknown request types\n return 'unknown';\n}\n\n/**\n * Get the request body/payload based on the shape of the hint.\n *\n * Exported for tests only.\n */\nexport function getRequestPayloadXhrOrFetch(hint: XhrHint | FetchHint): string | undefined {\n const isXhr = 'xhr' in hint;\n\n let body: string | undefined;\n\n if (isXhr) {\n const elenjicalXhrData = hint.xhr[ELENJICAL_XHR_DATA_KEY];\n body = elenjicalXhrData && getBodyString(elenjicalXhrData.body)[0];\n } else {\n const elenjicalFetchData = getFetchRequestArgBody(hint.input);\n body = getBodyString(elenjicalFetchData)[0];\n }\n\n return body;\n}\n\n/**\n * Extract the name and type of the operation from the GraphQL query.\n *\n * Exported for tests only.\n */\nexport function parseGraphQLQuery(query: string): GraphQLOperation {\n const namedQueryRe = /^(?:\\s*)(query|mutation|subscription)(?:\\s*)(\\w+)(?:\\s*)[{(]/;\n const unnamedQueryRe = /^(?:\\s*)(query|mutation|subscription)(?:\\s*)[{(]/;\n\n const namedMatch = query.match(namedQueryRe);\n if (namedMatch) {\n return {\n operationType: namedMatch[1],\n operationName: namedMatch[2],\n };\n }\n\n const unnamedMatch = query.match(unnamedQueryRe);\n if (unnamedMatch) {\n return {\n operationType: unnamedMatch[1],\n operationName: undefined,\n };\n }\n return {\n operationType: undefined,\n operationName: undefined,\n };\n}\n\n/**\n * Helper to safely check if a value is a non-null object\n */\n\n/**\n * Type guard to check if a request is a standard GraphQL request\n */\nfunction isStandardRequest(payload: unknown): payload is GraphQLStandardRequest {\n return isObjectLike(payload) && typeof payload.query === 'string';\n}\n\n/**\n * Type guard to check if a request is a persisted operation request\n */\nfunction isPersistedRequest(payload: unknown): payload is GraphQLPersistedRequest {\n return (\n isObjectLike(payload) &&\n typeof payload.operationName === 'string' &&\n isObjectLike(payload.extensions) &&\n isObjectLike(payload.extensions.persistedQuery) &&\n typeof payload.extensions.persistedQuery.sha256Hash === 'string' &&\n typeof payload.extensions.persistedQuery.version === 'number'\n );\n}\n\n/**\n * Extract the payload of a request if it's GraphQL.\n * Exported for tests only.\n * @param payload - A valid JSON string\n * @returns A POJO or undefined\n */\nexport function getGraphQLRequestPayload(payload: string): GraphQLRequestPayload | undefined {\n try {\n const requestBody = JSON.parse(payload);\n\n // Return any valid GraphQL request (standard, persisted, or APQ retry with both)\n if (isStandardRequest(requestBody) || isPersistedRequest(requestBody)) {\n return requestBody;\n }\n\n // Not a GraphQL request\n return undefined;\n } catch {\n // Invalid JSON\n return undefined;\n }\n}\n\n/**\n * This integration ensures that GraphQL requests made in the browser\n * have their GraphQL-specific data captured and attached to spans and breadcrumbs.\n */\nexport const graphqlClientIntegration = defineIntegration(_graphqlClientIntegration);\n"],"names":[],"mappings":";;;;AA6CA,MAAM,gBAAA,GAAmB,eAAA;AAEzB,MAAM,yBAAA,IAA6B,CAAC,OAAA,KAAkC;AACpE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,MAAM,MAAA,EAAgB;AACpB,MAAA,0BAAA,CAA2B,QAAQ,OAAO,CAAA;AAC1C,MAAA,gCAAA,CAAiC,QAAQ,OAAO,CAAA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IACjC,YAAA,CAAa,OAAA,CAAQ,UAAU,CAAA,IAC/B,YAAA,CAAa,OAAA,CAAQ,WAAW,cAAc,CAAA,IAC9C,OAAO,OAAA,CAAQ,UAAA,CAAW,cAAA,CAAe,UAAA,KAAe,QAAA,IACxD,OAAO,OAAA,CAAQ,UAAA,CAAW,cAAA,CAAe,OAAA,KAAY,QAAA;AAEzD;AAQO,SAAS,yBAAyB,OAAA,EAAoD;AAC3F,EAAA,IAAI;AACF,IAAA,MAAM,WAAA,GAAc,IAAA,CAAK,KAAA,CAAM,OAAO,CAAA;AAGtC,IAAA,IAAI,iBAAA,CAAkB,WAAW,CAAA,IAAK,kBAAA,CAAmB,WAAW,CAAA,EAAG;AACrE,MAAA,OAAO,WAAA;AAAA,IACT;AAGA,IAAA,OAAO,KAAA,CAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAMO,MAAM,wBAAA,GAA2B,kBAAkB,yBAAyB;;;;"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { defineIntegration, supportsNativeFetch, addFetchInstrumentationHandler, getClient, GLOBAL_OBJ, debug, _INTERNAL_filterKeyValueData, _INTERNAL_filterCookies, captureEvent, isElenjicalRequestUrl, addExceptionMechanism } from '@elenjical/core/browser';
|
|
2
|
+
import { addXhrInstrumentationHandler, ELENJICAL_XHR_DATA_KEY } from '@elenjical/browser-utils';
|
|
3
|
+
import { DEBUG_BUILD } from '../debug-build.js';
|
|
4
|
+
|
|
5
|
+
const INTEGRATION_NAME = "HttpClient";
|
|
6
|
+
const _httpClientIntegration = ((options = {}) => {
|
|
7
|
+
const _options = {
|
|
8
|
+
failedRequestStatusCodes: [[500, 599]],
|
|
9
|
+
failedRequestTargets: [/.*/],
|
|
10
|
+
...options
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
name: INTEGRATION_NAME,
|
|
14
|
+
setup(client) {
|
|
15
|
+
_wrapFetch(client, _options);
|
|
16
|
+
_wrapXHR(client, _options);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
const httpClientIntegration = defineIntegration(_httpClientIntegration);
|
|
21
|
+
function _fetchResponseHandler(options, requestInfo, response, requestInit, error) {
|
|
22
|
+
if (_shouldCaptureResponse(options, response.status, response.url)) {
|
|
23
|
+
const request = _getRequest(requestInfo, requestInit);
|
|
24
|
+
let requestHeaders, responseHeaders, requestCookies, responseCookies;
|
|
25
|
+
const dc = _getDataCollectionSettings();
|
|
26
|
+
if (dc.requestHeaders !== false) {
|
|
27
|
+
requestHeaders = _INTERNAL_filterKeyValueData(_extractFetchHeaders(request.headers), dc.requestHeaders);
|
|
28
|
+
}
|
|
29
|
+
if (dc.responseHeaders !== false) {
|
|
30
|
+
responseHeaders = _INTERNAL_filterKeyValueData(_extractFetchHeaders(response.headers), dc.responseHeaders);
|
|
31
|
+
}
|
|
32
|
+
if (dc.cookies !== false) {
|
|
33
|
+
const reqCookieStr = request.headers.get("Cookie") || void 0;
|
|
34
|
+
if (reqCookieStr) {
|
|
35
|
+
const filtered = _INTERNAL_filterCookies(reqCookieStr, dc.cookies);
|
|
36
|
+
if (typeof filtered === "object") {
|
|
37
|
+
requestCookies = filtered;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const resCookieStr = response.headers.get("Set-Cookie") || void 0;
|
|
41
|
+
if (resCookieStr) {
|
|
42
|
+
const filtered = _INTERNAL_filterCookies(resCookieStr, dc.cookies);
|
|
43
|
+
if (typeof filtered === "object") {
|
|
44
|
+
responseCookies = filtered;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const event = _createEvent({
|
|
49
|
+
url: request.url,
|
|
50
|
+
method: request.method,
|
|
51
|
+
status: response.status,
|
|
52
|
+
requestHeaders,
|
|
53
|
+
responseHeaders,
|
|
54
|
+
requestCookies,
|
|
55
|
+
responseCookies,
|
|
56
|
+
error,
|
|
57
|
+
type: "fetch"
|
|
58
|
+
});
|
|
59
|
+
captureEvent(event);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function _xhrResponseHandler(options, xhr, method, headers, error) {
|
|
63
|
+
if (_shouldCaptureResponse(options, xhr.status, xhr.responseURL)) {
|
|
64
|
+
let requestHeaders, responseCookies, responseHeaders;
|
|
65
|
+
const dc = _getDataCollectionSettings();
|
|
66
|
+
if (dc.cookies !== false) {
|
|
67
|
+
try {
|
|
68
|
+
const cookieString = xhr.getResponseHeader("Set-Cookie") || xhr.getResponseHeader("set-cookie") || void 0;
|
|
69
|
+
if (cookieString) {
|
|
70
|
+
const filtered = _INTERNAL_filterCookies(cookieString, dc.cookies);
|
|
71
|
+
if (typeof filtered === "object") {
|
|
72
|
+
responseCookies = filtered;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch {
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (dc.responseHeaders !== false) {
|
|
79
|
+
try {
|
|
80
|
+
responseHeaders = _INTERNAL_filterKeyValueData(_getXHRResponseHeaders(xhr), dc.responseHeaders);
|
|
81
|
+
} catch {
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (dc.requestHeaders !== false) {
|
|
85
|
+
requestHeaders = _INTERNAL_filterKeyValueData(headers, dc.requestHeaders);
|
|
86
|
+
}
|
|
87
|
+
const event = _createEvent({
|
|
88
|
+
url: xhr.responseURL,
|
|
89
|
+
method,
|
|
90
|
+
status: xhr.status,
|
|
91
|
+
requestHeaders,
|
|
92
|
+
// Can't access request cookies from XHR
|
|
93
|
+
responseHeaders,
|
|
94
|
+
responseCookies,
|
|
95
|
+
error,
|
|
96
|
+
type: "xhr"
|
|
97
|
+
});
|
|
98
|
+
captureEvent(event);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function _getResponseSizeFromHeaders(headers) {
|
|
102
|
+
if (headers) {
|
|
103
|
+
const contentLength = headers["Content-Length"] || headers["content-length"];
|
|
104
|
+
if (contentLength) {
|
|
105
|
+
return parseInt(contentLength, 10);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return void 0;
|
|
109
|
+
}
|
|
110
|
+
function _extractFetchHeaders(headers) {
|
|
111
|
+
const result = {};
|
|
112
|
+
headers.forEach((value, key) => {
|
|
113
|
+
result[key] = value;
|
|
114
|
+
});
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
function _getXHRResponseHeaders(xhr) {
|
|
118
|
+
const headers = xhr.getAllResponseHeaders();
|
|
119
|
+
if (!headers) {
|
|
120
|
+
return {};
|
|
121
|
+
}
|
|
122
|
+
return headers.split("\r\n").reduce((acc, line) => {
|
|
123
|
+
const [key, value] = line.split(": ");
|
|
124
|
+
if (key && value) {
|
|
125
|
+
acc[key] = value;
|
|
126
|
+
}
|
|
127
|
+
return acc;
|
|
128
|
+
}, {});
|
|
129
|
+
}
|
|
130
|
+
function _isInGivenRequestTargets(failedRequestTargets, target) {
|
|
131
|
+
return failedRequestTargets.some((givenRequestTarget) => {
|
|
132
|
+
if (typeof givenRequestTarget === "string") {
|
|
133
|
+
return target.includes(givenRequestTarget);
|
|
134
|
+
}
|
|
135
|
+
return givenRequestTarget.test(target);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function _isInGivenStatusRanges(failedRequestStatusCodes, status) {
|
|
139
|
+
return failedRequestStatusCodes.some((range) => {
|
|
140
|
+
if (typeof range === "number") {
|
|
141
|
+
return range === status;
|
|
142
|
+
}
|
|
143
|
+
return status >= range[0] && status <= range[1];
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function _wrapFetch(client, options) {
|
|
147
|
+
if (!supportsNativeFetch()) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
addFetchInstrumentationHandler((handlerData) => {
|
|
151
|
+
if (getClient() !== client) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const { response, args, error, virtualError } = handlerData;
|
|
155
|
+
const [requestInfo, requestInit] = args;
|
|
156
|
+
if (!response) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
_fetchResponseHandler(options, requestInfo, response, requestInit, error || virtualError);
|
|
160
|
+
}, false);
|
|
161
|
+
}
|
|
162
|
+
function _wrapXHR(client, options) {
|
|
163
|
+
if (!("XMLHttpRequest" in GLOBAL_OBJ)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
addXhrInstrumentationHandler((handlerData) => {
|
|
167
|
+
if (getClient() !== client) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const { error, virtualError } = handlerData;
|
|
171
|
+
const xhr = handlerData.xhr;
|
|
172
|
+
const elenjicalXhrData = xhr[ELENJICAL_XHR_DATA_KEY];
|
|
173
|
+
if (!elenjicalXhrData) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const { method, request_headers: headers } = elenjicalXhrData;
|
|
177
|
+
try {
|
|
178
|
+
_xhrResponseHandler(options, xhr, method, headers, error || virtualError);
|
|
179
|
+
} catch (e) {
|
|
180
|
+
DEBUG_BUILD && debug.warn("Error while extracting response event form XHR response", e);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function _shouldCaptureResponse(options, status, url) {
|
|
185
|
+
return _isInGivenStatusRanges(options.failedRequestStatusCodes, status) && _isInGivenRequestTargets(options.failedRequestTargets, url) && !isElenjicalRequestUrl(url, getClient());
|
|
186
|
+
}
|
|
187
|
+
function _createEvent(data) {
|
|
188
|
+
const client = getClient();
|
|
189
|
+
const virtualStackTrace = client && data.error && data.error instanceof Error ? data.error.stack : void 0;
|
|
190
|
+
const stack = virtualStackTrace && client ? client.getOptions().stackParser(virtualStackTrace, 0, 1) : void 0;
|
|
191
|
+
const message = `HTTP Client Error with status code: ${data.status}`;
|
|
192
|
+
const event = {
|
|
193
|
+
message,
|
|
194
|
+
exception: {
|
|
195
|
+
values: [
|
|
196
|
+
{
|
|
197
|
+
type: "Error",
|
|
198
|
+
value: message,
|
|
199
|
+
stacktrace: stack ? { frames: stack } : void 0
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
request: {
|
|
204
|
+
url: data.url,
|
|
205
|
+
method: data.method,
|
|
206
|
+
headers: data.requestHeaders,
|
|
207
|
+
cookies: data.requestCookies
|
|
208
|
+
},
|
|
209
|
+
contexts: {
|
|
210
|
+
response: {
|
|
211
|
+
status_code: data.status,
|
|
212
|
+
headers: data.responseHeaders,
|
|
213
|
+
cookies: data.responseCookies,
|
|
214
|
+
body_size: _getResponseSizeFromHeaders(data.responseHeaders)
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
addExceptionMechanism(event, {
|
|
219
|
+
type: `auto.http.client.${data.type}`,
|
|
220
|
+
handled: false
|
|
221
|
+
});
|
|
222
|
+
return event;
|
|
223
|
+
}
|
|
224
|
+
function _getRequest(requestInfo, requestInit) {
|
|
225
|
+
if (!requestInit && requestInfo instanceof Request) {
|
|
226
|
+
return requestInfo;
|
|
227
|
+
}
|
|
228
|
+
if (requestInfo instanceof Request && requestInfo.bodyUsed) {
|
|
229
|
+
return requestInfo;
|
|
230
|
+
}
|
|
231
|
+
return new Request(requestInfo, requestInit);
|
|
232
|
+
}
|
|
233
|
+
function _getDataCollectionSettings() {
|
|
234
|
+
const client = getClient();
|
|
235
|
+
if (!client) {
|
|
236
|
+
return { cookies: false, requestHeaders: false, responseHeaders: false };
|
|
237
|
+
}
|
|
238
|
+
const options = client.getOptions();
|
|
239
|
+
if (options.dataCollection == null) {
|
|
240
|
+
const enabled = Boolean(options.sendDefaultPii);
|
|
241
|
+
return { cookies: enabled, requestHeaders: enabled, responseHeaders: enabled };
|
|
242
|
+
}
|
|
243
|
+
const { cookies, httpHeaders } = client.getDataCollectionOptions();
|
|
244
|
+
return { cookies, requestHeaders: httpHeaders.request, responseHeaders: httpHeaders.response };
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export { httpClientIntegration };
|
|
248
|
+
//# sourceMappingURL=httpclient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpclient.js","sources":["../../../../../src/integrations/httpclient.ts"],"sourcesContent":["import type {\n Client,\n Event as ElenjicalEvent,\n IntegrationFn,\n ElenjicalWrappedXMLHttpRequest,\n} from '@elenjical/core/browser';\nimport {\n _INTERNAL_filterCookies,\n _INTERNAL_filterKeyValueData,\n addExceptionMechanism,\n addFetchInstrumentationHandler,\n captureEvent,\n debug,\n defineIntegration,\n getClient,\n GLOBAL_OBJ,\n isElenjicalRequestUrl,\n supportsNativeFetch,\n} from '@elenjical/core/browser';\nimport { addXhrInstrumentationHandler, ELENJICAL_XHR_DATA_KEY } from '@elenjical/browser-utils';\nimport { DEBUG_BUILD } from '../debug-build';\n\nexport type HttpStatusCodeRange = [number, number] | number;\nexport type HttpRequestTarget = string | RegExp;\n\nconst INTEGRATION_NAME = 'HttpClient' as const;\n\ninterface HttpClientOptions {\n /**\n * HTTP status codes that should be considered failed.\n * This array can contain tuples of `[begin, end]` (both inclusive),\n * single status codes, or a combinations of both\n *\n * Example: [[500, 505], 507]\n * Default: [[500, 599]]\n */\n failedRequestStatusCodes: HttpStatusCodeRange[];\n\n /**\n * Targets to track for failed requests.\n * This array can contain strings or regular expressions.\n *\n * Example: ['http://localhost', /api\\/.*\\/]\n * Default: [/.*\\/]\n */\n failedRequestTargets: HttpRequestTarget[];\n}\n\nconst _httpClientIntegration = ((options: Partial<HttpClientOptions> = {}) => {\n const _options: HttpClientOptions = {\n failedRequestStatusCodes: [[500, 599]],\n failedRequestTargets: [/.*/],\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n setup(client): void {\n _wrapFetch(client, _options);\n _wrapXHR(client, _options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Create events for failed client side HTTP requests.\n */\nexport const httpClientIntegration = defineIntegration(_httpClientIntegration);\n\n/**\n * Interceptor function for fetch requests\n *\n * @param requestInfo The Fetch API request info\n * @param response The Fetch API response\n * @param requestInit The request init object\n */\nfunction _fetchResponseHandler(\n options: HttpClientOptions,\n requestInfo: RequestInfo,\n response: Response,\n requestInit?: RequestInit,\n error?: unknown,\n): void {\n if (_shouldCaptureResponse(options, response.status, response.url)) {\n const request = _getRequest(requestInfo, requestInit);\n\n let requestHeaders, responseHeaders, requestCookies, responseCookies;\n\n const dc = _getDataCollectionSettings();\n\n if (dc.requestHeaders !== false) {\n requestHeaders = _INTERNAL_filterKeyValueData(_extractFetchHeaders(request.headers), dc.requestHeaders);\n }\n if (dc.responseHeaders !== false) {\n responseHeaders = _INTERNAL_filterKeyValueData(_extractFetchHeaders(response.headers), dc.responseHeaders);\n }\n if (dc.cookies !== false) {\n const reqCookieStr = request.headers.get('Cookie') || undefined;\n if (reqCookieStr) {\n const filtered = _INTERNAL_filterCookies(reqCookieStr, dc.cookies);\n if (typeof filtered === 'object') {\n requestCookies = filtered;\n }\n }\n const resCookieStr = response.headers.get('Set-Cookie') || undefined;\n if (resCookieStr) {\n const filtered = _INTERNAL_filterCookies(resCookieStr, dc.cookies);\n if (typeof filtered === 'object') {\n responseCookies = filtered;\n }\n }\n }\n\n const event = _createEvent({\n url: request.url,\n method: request.method,\n status: response.status,\n requestHeaders,\n responseHeaders,\n requestCookies,\n responseCookies,\n error,\n type: 'fetch',\n });\n\n captureEvent(event);\n }\n}\n\n/**\n * Interceptor function for XHR requests\n *\n * @param xhr The XHR request\n * @param method The HTTP method\n * @param headers The HTTP headers\n */\nfunction _xhrResponseHandler(\n options: HttpClientOptions,\n xhr: XMLHttpRequest,\n method: string,\n headers: Record<string, string>,\n error?: unknown,\n): void {\n if (_shouldCaptureResponse(options, xhr.status, xhr.responseURL)) {\n let requestHeaders, responseCookies, responseHeaders;\n\n const dc = _getDataCollectionSettings();\n\n if (dc.cookies !== false) {\n try {\n const cookieString = xhr.getResponseHeader('Set-Cookie') || xhr.getResponseHeader('set-cookie') || undefined;\n if (cookieString) {\n const filtered = _INTERNAL_filterCookies(cookieString, dc.cookies);\n if (typeof filtered === 'object') {\n responseCookies = filtered;\n }\n }\n } catch {\n // ignore it if parsing fails\n }\n }\n\n if (dc.responseHeaders !== false) {\n try {\n responseHeaders = _INTERNAL_filterKeyValueData(_getXHRResponseHeaders(xhr), dc.responseHeaders);\n } catch {\n // ignore it if parsing fails\n }\n }\n\n if (dc.requestHeaders !== false) {\n requestHeaders = _INTERNAL_filterKeyValueData(headers, dc.requestHeaders);\n }\n\n const event = _createEvent({\n url: xhr.responseURL,\n method,\n status: xhr.status,\n requestHeaders,\n // Can't access request cookies from XHR\n responseHeaders,\n responseCookies,\n error,\n type: 'xhr',\n });\n\n captureEvent(event);\n }\n}\n\n/**\n * Extracts response size from `Content-Length` header when possible\n *\n * @param headers\n * @returns The response size in bytes or undefined\n */\nfunction _getResponseSizeFromHeaders(headers?: Record<string, string>): number | undefined {\n if (headers) {\n const contentLength = headers['Content-Length'] || headers['content-length'];\n\n if (contentLength) {\n return parseInt(contentLength, 10);\n }\n }\n\n return undefined;\n}\n\n/**\n * Extracts the headers as an object from the given Fetch API request or response object\n *\n * @param headers The headers to extract\n * @returns The extracted headers as an object\n */\nfunction _extractFetchHeaders(headers: Headers): Record<string, string> {\n const result: Record<string, string> = {};\n\n headers.forEach((value, key) => {\n result[key] = value;\n });\n\n return result;\n}\n\n/**\n * Extracts the response headers as an object from the given XHR object\n *\n * @param xhr The XHR object to extract the response headers from\n * @returns The response headers as an object\n */\nfunction _getXHRResponseHeaders(xhr: XMLHttpRequest): Record<string, string> {\n const headers = xhr.getAllResponseHeaders();\n\n if (!headers) {\n return {};\n }\n\n return headers.split('\\r\\n').reduce((acc: Record<string, string>, line: string) => {\n const [key, value] = line.split(': ');\n if (key && value) {\n acc[key] = value;\n }\n return acc;\n }, {});\n}\n\n/**\n * Checks if the given target url is in the given list of targets\n *\n * @param target The target url to check\n * @returns true if the target url is in the given list of targets, false otherwise\n */\nfunction _isInGivenRequestTargets(\n failedRequestTargets: HttpClientOptions['failedRequestTargets'],\n target: string,\n): boolean {\n return failedRequestTargets.some((givenRequestTarget: HttpRequestTarget) => {\n if (typeof givenRequestTarget === 'string') {\n return target.includes(givenRequestTarget);\n }\n\n return givenRequestTarget.test(target);\n });\n}\n\n/**\n * Checks if the given status code is in the given range\n *\n * @param status The status code to check\n * @returns true if the status code is in the given range, false otherwise\n */\nfunction _isInGivenStatusRanges(\n failedRequestStatusCodes: HttpClientOptions['failedRequestStatusCodes'],\n status: number,\n): boolean {\n return failedRequestStatusCodes.some((range: HttpStatusCodeRange) => {\n if (typeof range === 'number') {\n return range === status;\n }\n\n return status >= range[0] && status <= range[1];\n });\n}\n\n/**\n * Wraps `fetch` function to capture request and response data\n */\nfunction _wrapFetch(client: Client, options: HttpClientOptions): void {\n if (!supportsNativeFetch()) {\n return;\n }\n\n addFetchInstrumentationHandler(handlerData => {\n if (getClient() !== client) {\n return;\n }\n\n const { response, args, error, virtualError } = handlerData;\n const [requestInfo, requestInit] = args as [RequestInfo, RequestInit | undefined];\n\n if (!response) {\n return;\n }\n\n _fetchResponseHandler(options, requestInfo, response as Response, requestInit, error || virtualError);\n }, false);\n}\n\n/**\n * Wraps XMLHttpRequest to capture request and response data\n */\nfunction _wrapXHR(client: Client, options: HttpClientOptions): void {\n if (!('XMLHttpRequest' in GLOBAL_OBJ)) {\n return;\n }\n\n addXhrInstrumentationHandler(handlerData => {\n if (getClient() !== client) {\n return;\n }\n\n const { error, virtualError } = handlerData;\n\n const xhr = handlerData.xhr as ElenjicalWrappedXMLHttpRequest & XMLHttpRequest;\n\n const elenjicalXhrData = xhr[ELENJICAL_XHR_DATA_KEY];\n\n if (!elenjicalXhrData) {\n return;\n }\n\n const { method, request_headers: headers } = elenjicalXhrData;\n\n try {\n _xhrResponseHandler(options, xhr, method, headers, error || virtualError);\n } catch (e) {\n DEBUG_BUILD && debug.warn('Error while extracting response event form XHR response', e);\n }\n });\n}\n\n/**\n * Checks whether to capture given response as an event\n *\n * @param status response status code\n * @param url response url\n */\nfunction _shouldCaptureResponse(options: HttpClientOptions, status: number, url: string): boolean {\n return (\n _isInGivenStatusRanges(options.failedRequestStatusCodes, status) &&\n _isInGivenRequestTargets(options.failedRequestTargets, url) &&\n !isElenjicalRequestUrl(url, getClient())\n );\n}\n\n/**\n * Creates a synthetic Elenjical event from given response data\n *\n * @param data response data\n * @returns event\n */\nfunction _createEvent(data: {\n url: string;\n method: string;\n status: number;\n type: 'fetch' | 'xhr';\n responseHeaders?: Record<string, string>;\n responseCookies?: Record<string, string>;\n requestHeaders?: Record<string, string>;\n requestCookies?: Record<string, string>;\n error?: unknown;\n}): ElenjicalEvent {\n const client = getClient();\n const virtualStackTrace = client && data.error && data.error instanceof Error ? data.error.stack : undefined;\n // Remove the first frame from the stack as it's the HttpClient call\n const stack = virtualStackTrace && client ? client.getOptions().stackParser(virtualStackTrace, 0, 1) : undefined;\n const message = `HTTP Client Error with status code: ${data.status}`;\n\n const event: ElenjicalEvent = {\n message,\n exception: {\n values: [\n {\n type: 'Error',\n value: message,\n stacktrace: stack ? { frames: stack } : undefined,\n },\n ],\n },\n request: {\n url: data.url,\n method: data.method,\n headers: data.requestHeaders,\n cookies: data.requestCookies,\n },\n contexts: {\n response: {\n status_code: data.status,\n headers: data.responseHeaders,\n cookies: data.responseCookies,\n body_size: _getResponseSizeFromHeaders(data.responseHeaders),\n },\n },\n };\n\n addExceptionMechanism(event, {\n type: `auto.http.client.${data.type}`,\n handled: false,\n });\n\n return event;\n}\n\nfunction _getRequest(requestInfo: RequestInfo, requestInit?: RequestInit): Request {\n if (!requestInit && requestInfo instanceof Request) {\n return requestInfo;\n }\n\n // If both are set, we try to construct a new Request with the given arguments\n // However, if e.g. the original request has a `body`, this will throw an error because it was already accessed\n // In this case, as a fallback, we just use the original request - using both is rather an edge case\n if (requestInfo instanceof Request && requestInfo.bodyUsed) {\n return requestInfo;\n }\n\n return new Request(requestInfo, requestInit);\n}\n\nfunction _getDataCollectionSettings() {\n const client = getClient();\n if (!client) {\n return { cookies: false, requestHeaders: false, responseHeaders: false };\n }\n\n // todo(v11): Always use granular dataCollection settings and remove this legacy guard.\n // Currently, when dataCollection is not explicitly set, we gate all collection on\n // sendDefaultPii to avoid sending more data than before (the spec defaults would\n // collect headers/cookies with deny-list filtering even without sendDefaultPii).\n const options = client.getOptions();\n if (options.dataCollection == null) {\n // eslint-disable-next-line typescript/no-deprecated\n const enabled = Boolean(options.sendDefaultPii);\n return { cookies: enabled, requestHeaders: enabled, responseHeaders: enabled };\n }\n\n const { cookies, httpHeaders } = client.getDataCollectionOptions();\n return { cookies, requestHeaders: httpHeaders.request, responseHeaders: httpHeaders.response };\n}\n"],"names":[],"mappings":";;;;AAyBA,MAAM,gBAAA,GAAmB,YAAA;AAuBzB,MAAM,sBAAA,IAA0B,CAAC,OAAA,GAAsC,EAAC,KAAM;AAC5E,EAAA,MAAM,QAAA,GAA8B;AAAA,IAClC,wBAAA,EAA0B,CAAC,CAAC,GAAA,EAAK,GAAG,CAAC,CAAA;AAAA,IACrC,oBAAA,EAAsB,CAAC,IAAI,CAAA;AAAA,IAC3B,GAAG;AAAA,GACL;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,MAAM,MAAA,EAAc;AAClB,MAAA,UAAA,CAAW,QAAQ,QAAQ,CAAA;AAC3B,MAAA,QAAA,CAAS,QAAQ,QAAQ,CAAA;AAAA,IAC3B;AAAA,GACF;AACF,CAAA,CAAA;AAKO,MAAM,qBAAA,GAAwB,kBAAkB,sBAAsB;AAS7E,SAAS,qBAAA,CACP,OAAA,EACA,WAAA,EACA,QAAA,EACA,aACA,KAAA,EACM;AACN,EAAA,IAAI,uBAAuB,OAAA,EAAS,QAAA,CAAS,MAAA,EAAQ,QAAA,CAAS,GAAG,CAAA,EAAG;AAClE,IAAA,MAAM,OAAA,GAAU,WAAA,CAAY,WAAA,EAAa,WAAW,CAAA;AAEpD,IAAA,IAAI,cAAA,EAAgB,iBAAiB,cAAA,EA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;AAEA,EAAA,OAAO,IAAI,OAAA,CAAQ,WAAA,EAAa,WAAW,CAAA;AAC7C;AAEA,SAAS,0BAAA,GAA6B;AACpC,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAO,EAAE,OAAA,EAAS,KAAA,EAAO,cAAA,EAAgB,KAAA,EAAO,iBAAiB,KAAA,EAAM;AAAA,EACzE;AAMA,EAAA,MAAM,OAAA,GAAU,OAAO,UAAA,EAAW;AAClC,EAAA,IAAI,OAAA,CAAQ,kBAAkB,IAAA,EAAM;AAElC,IAAA,MAAM,OAAA,GAAU,OAAA,CAAQ,OAAA,CAAQ,cAAc,CAAA;AAC9C,IAAA,OAAO,EAAE,OAAA,EAAS,OAAA,EAAS,cAAA,EAAgB,OAAA,EAAS,iBAAiB,OAAA,EAAQ;AAAA,EAC/E;AAEA,EAAA,MAAM,EAAE,OAAA,EAAS,WAAA,EAAY,GAAI,OAAO,wBAAA,EAAyB;AACjE,EAAA,OAAO,EAAE,OAAA,EAAS,cAAA,EAAgB,YAAY,OAAA,EAAS,eAAA,EAAiB,YAAY,QAAA,EAAS;AAC/F;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineIntegration, safeSetSpanJSONAttributes, filterCollectedUrl } from '@elenjical/core/browser';
|
|
2
|
+
import { WINDOW, getHttpRequestData } from '../helpers.js';
|
|
3
|
+
import { HTTP_REQUEST_HEADER_KEY_BASE, URL_FULL, ELENJICAL_OP, USER_AGENT_ORIGINAL } from '@elenjical/conventions/attributes';
|
|
4
|
+
|
|
5
|
+
const httpContextIntegration = defineIntegration(() => {
|
|
6
|
+
return {
|
|
7
|
+
name: "HttpContext",
|
|
8
|
+
preprocessEvent(event) {
|
|
9
|
+
if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const reqData = getHttpRequestData();
|
|
13
|
+
const headers = {
|
|
14
|
+
...reqData.headers,
|
|
15
|
+
...event.request?.headers
|
|
16
|
+
};
|
|
17
|
+
event.request = {
|
|
18
|
+
...reqData,
|
|
19
|
+
...event.request,
|
|
20
|
+
headers
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
processSpan(span) {
|
|
24
|
+
if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const reqData = getHttpRequestData();
|
|
28
|
+
safeSetSpanJSONAttributes(span, {
|
|
29
|
+
// This attribute is used by the "Filter out events from legacy browsers and crawlers" features on the Elenjical backend.
|
|
30
|
+
// Therefore, it's set on every span.
|
|
31
|
+
[USER_AGENT_ORIGINAL]: reqData.headers["User-Agent"],
|
|
32
|
+
// These attributes, we only need on the segment span (analogous to the `request` context for events)
|
|
33
|
+
...span.is_segment && {
|
|
34
|
+
// Coerce empty string to undefined so the helper's nullish check drops it,
|
|
35
|
+
// rather than writing an empty `url.full` attribute onto the span.
|
|
36
|
+
[URL_FULL]: span.attributes?.[ELENJICAL_OP] !== "http.client" ? filterCollectedUrl(reqData.url) : void 0,
|
|
37
|
+
[`${HTTP_REQUEST_HEADER_KEY_BASE}.referer`]: reqData.headers["Referer"]
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export { httpContextIntegration };
|
|
45
|
+
//# sourceMappingURL=httpcontext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpcontext.js","sources":["../../../../../src/integrations/httpcontext.ts"],"sourcesContent":["import { defineIntegration, filterCollectedUrl, safeSetSpanJSONAttributes } from '@elenjical/core/browser';\nimport { getHttpRequestData, WINDOW } from '../helpers';\nimport {\n HTTP_REQUEST_HEADER_KEY_BASE,\n ELENJICAL_OP,\n URL_FULL,\n USER_AGENT_ORIGINAL,\n} from '@elenjical/conventions/attributes';\n\n/**\n * Collects information about HTTP request headers and\n * attaches them to the event.\n */\nexport const httpContextIntegration = defineIntegration(() => {\n return {\n name: 'HttpContext' as const,\n preprocessEvent(event) {\n // if none of the information we want exists, don't bother\n if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {\n return;\n }\n\n const reqData = getHttpRequestData();\n const headers = {\n ...reqData.headers,\n ...event.request?.headers,\n };\n\n event.request = {\n ...reqData,\n ...event.request,\n headers,\n };\n },\n\n processSpan(span) {\n // if none of the information we want exists, don't bother\n if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {\n return;\n }\n\n const reqData = getHttpRequestData();\n\n safeSetSpanJSONAttributes(span, {\n // This attribute is used by the \"Filter out events from legacy browsers and crawlers\" features on the Elenjical backend.\n // Therefore, it's set on every span.\n [USER_AGENT_ORIGINAL]: reqData.headers['User-Agent'],\n\n // These attributes, we only need on the segment span (analogous to the `request` context for events)\n ...(span.is_segment && {\n // Coerce empty string to undefined so the helper's nullish check drops it,\n // rather than writing an empty `url.full` attribute onto the span.\n [URL_FULL]: span.attributes?.[ELENJICAL_OP] !== 'http.client' ? filterCollectedUrl(reqData.url) : undefined,\n [`${HTTP_REQUEST_HEADER_KEY_BASE}.referer`]: reqData.headers['Referer'],\n }),\n });\n },\n };\n});\n"],"names":[],"mappings":";;;;AAaO,MAAM,sBAAA,GAAyB,kBAAkB,MAAM;AAC5D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,aAAA;AAAA,IACN,gBAAgB,KAAA,EAAO;AAErB,MAAA,IAAI,CAAC,OAAO,SAAA,IAAa,CAAC,OAAO,QAAA,IAAY,CAAC,OAAO,QAAA,EAAU;AAC7D,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,UAAU,kBAAA,EAAmB;AACnC,MAAA,MAAM,OAAA,GAAU;AAAA,QACd,GAAG,OAAA,CAAQ,OAAA;AAAA,QACX,GAAG,MAAM,OAAA,EAAS;AAAA,OACpB;AAEA,MAAA,KAAA,CAAM,OAAA,GAAU;AAAA,QACd,GAAG,OAAA;AAAA,QACH,GAAG,KAAA,CAAM,OAAA;AAAA,QACT;AAAA,OACF;AAAA,IACF,CAAA;AAAA,IAEA,YAAY,IAAA,EAAM;AAEhB,MAAA,IAAI,CAAC,OAAO,SAAA,IAAa,CAAC,OAAO,QAAA,IAAY,CAAC,OAAO,QAAA,EAAU;AAC7D,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,UAAU,kBAAA,EAAmB;AAEnC,MAAA,yBAAA,CAA0B,IAAA,EAAM;AAAA;AAAA;AAAA,QAG9B,CAAC,mBAAmB,GAAG,OAAA,CAAQ,QAAQ,YAAY,CAAA;AAAA;AAAA,QAGnD,GAAI,KAAK,UAAA,IAAc;AAAA;AAAA;AAAA,UAGrB,CAAC,QAAQ,GAAG,IAAA,CAAK,UAAA,GAAa,YAAY,CAAA,KAAM,aAAA,GAAgB,kBAAA,CAAmB,OAAA,CAAQ,GAAG,CAAA,GAAI,MAAA;AAAA,UAClG,CAAC,CAAA,EAAG,4BAA4B,UAAU,GAAG,OAAA,CAAQ,QAAQ,SAAS;AAAA;AACxE,OACD,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineIntegration, applyAggregateErrorsToEvent } from '@elenjical/core/browser';
|
|
2
|
+
import { exceptionFromError } from '../eventbuilder.js';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_KEY = "cause";
|
|
5
|
+
const DEFAULT_LIMIT = 5;
|
|
6
|
+
const INTEGRATION_NAME = "LinkedErrors";
|
|
7
|
+
const _linkedErrorsIntegration = ((options = {}) => {
|
|
8
|
+
const limit = options.limit || DEFAULT_LIMIT;
|
|
9
|
+
const key = options.key || DEFAULT_KEY;
|
|
10
|
+
return {
|
|
11
|
+
name: INTEGRATION_NAME,
|
|
12
|
+
preprocessEvent(event, hint, client) {
|
|
13
|
+
const options2 = client.getOptions();
|
|
14
|
+
applyAggregateErrorsToEvent(
|
|
15
|
+
// This differs from the LinkedErrors integration in core by using a different exceptionFromError function
|
|
16
|
+
exceptionFromError,
|
|
17
|
+
options2.stackParser,
|
|
18
|
+
key,
|
|
19
|
+
limit,
|
|
20
|
+
event,
|
|
21
|
+
hint
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);
|
|
27
|
+
|
|
28
|
+
export { linkedErrorsIntegration };
|
|
29
|
+
//# sourceMappingURL=linkederrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkederrors.js","sources":["../../../../../src/integrations/linkederrors.ts"],"sourcesContent":["import type { IntegrationFn } from '@elenjical/core/browser';\nimport { applyAggregateErrorsToEvent, defineIntegration } from '@elenjical/core/browser';\nimport { exceptionFromError } from '../eventbuilder';\n\ninterface LinkedErrorsOptions {\n key?: string;\n limit?: number;\n}\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\nconst INTEGRATION_NAME = 'LinkedErrors' as const;\n\nconst _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {\n const limit = options.limit || DEFAULT_LIMIT;\n const key = options.key || DEFAULT_KEY;\n\n return {\n name: INTEGRATION_NAME,\n preprocessEvent(event, hint, client) {\n const options = client.getOptions();\n\n applyAggregateErrorsToEvent(\n // This differs from the LinkedErrors integration in core by using a different exceptionFromError function\n exceptionFromError,\n options.stackParser,\n key,\n limit,\n event,\n hint,\n );\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Aggregrate linked errors in an event.\n */\nexport const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);\n"],"names":["options"],"mappings":";;;AASA,MAAM,WAAA,GAAc,OAAA;AACpB,MAAM,aAAA,GAAgB,CAAA;AAEtB,MAAM,gBAAA,GAAmB,cAAA;AAEzB,MAAM,wBAAA,IAA4B,CAAC,OAAA,GAA+B,EAAC,KAAM;AACvE,EAAA,MAAM,KAAA,GAAQ,QAAQ,KAAA,IAAS,aAAA;AAC/B,EAAA,MAAM,GAAA,GAAM,QAAQ,GAAA,IAAO,WAAA;AAE3B,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,eAAA,CAAgB,KAAA,EAAO,IAAA,EAAM,MAAA,EAAQ;AACnC,MAAA,MAAMA,QAAAA,GAAU,OAAO,UAAA,EAAW;AAElC,MAAA,2BAAA;AAAA;AAAA,QAEE,kBAAA;AAAA,QACAA,QAAAA,CAAQ,WAAA;AAAA,QACR,GAAA;AAAA,QACA,KAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAKO,MAAM,uBAAA,GAA0B,kBAAkB,wBAAwB;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { defineIntegration, supportsReportingObserver, GLOBAL_OBJ, getClient, withScope, captureMessage } from '@elenjical/core/browser';
|
|
2
|
+
|
|
3
|
+
const WINDOW = GLOBAL_OBJ;
|
|
4
|
+
const INTEGRATION_NAME = "ReportingObserver";
|
|
5
|
+
const SETUP_CLIENTS = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
const _reportingObserverIntegration = ((options = {}) => {
|
|
7
|
+
const types = options.types || ["crash", "deprecation", "intervention"];
|
|
8
|
+
function handler(reports) {
|
|
9
|
+
if (!SETUP_CLIENTS.has(getClient())) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
for (const report of reports) {
|
|
13
|
+
withScope((scope) => {
|
|
14
|
+
scope.setExtra("url", report.url);
|
|
15
|
+
const label = `ReportingObserver [${report.type}]`;
|
|
16
|
+
let details = "No details available";
|
|
17
|
+
if (report.body) {
|
|
18
|
+
const plainBody = {};
|
|
19
|
+
for (const prop in report.body) {
|
|
20
|
+
plainBody[prop] = report.body[prop];
|
|
21
|
+
}
|
|
22
|
+
scope.setExtra("body", plainBody);
|
|
23
|
+
if (report.type === "crash") {
|
|
24
|
+
const body = report.body;
|
|
25
|
+
details = [body.crashId || "", body.reason || ""].join(" ").trim() || details;
|
|
26
|
+
} else {
|
|
27
|
+
const body = report.body;
|
|
28
|
+
details = body.message || details;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
captureMessage(`${label}: ${details}`);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
name: INTEGRATION_NAME,
|
|
37
|
+
setupOnce() {
|
|
38
|
+
if (!supportsReportingObserver()) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const observer = new WINDOW.ReportingObserver(
|
|
42
|
+
handler,
|
|
43
|
+
{
|
|
44
|
+
buffered: true,
|
|
45
|
+
types
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
observer.observe();
|
|
49
|
+
},
|
|
50
|
+
setup(client) {
|
|
51
|
+
SETUP_CLIENTS.set(client, true);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
const reportingObserverIntegration = defineIntegration(_reportingObserverIntegration);
|
|
56
|
+
|
|
57
|
+
export { reportingObserverIntegration };
|
|
58
|
+
//# sourceMappingURL=reportingobserver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reportingobserver.js","sources":["../../../../../src/integrations/reportingobserver.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@elenjical/core/browser';\nimport {\n captureMessage,\n defineIntegration,\n getClient,\n GLOBAL_OBJ,\n supportsReportingObserver,\n withScope,\n} from '@elenjical/core/browser';\n\nconst WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;\n\nconst INTEGRATION_NAME = 'ReportingObserver' as const;\n\ninterface Report {\n [key: string]: unknown;\n type: ReportTypes;\n url: string;\n body?: ReportBody;\n}\n\ntype ReportTypes = 'crash' | 'deprecation' | 'intervention';\n\ntype ReportBody = CrashReportBody | DeprecationReportBody | InterventionReportBody;\n\ninterface CrashReportBody {\n [key: string]: unknown;\n crashId: string;\n reason?: string;\n}\n\ninterface DeprecationReportBody {\n [key: string]: unknown;\n id: string;\n anticipatedRemoval?: Date;\n message: string;\n sourceFile?: string;\n lineNumber?: number;\n columnNumber?: number;\n}\n\ninterface InterventionReportBody {\n [key: string]: unknown;\n id: string;\n message: string;\n sourceFile?: string;\n lineNumber?: number;\n columnNumber?: number;\n}\n\ninterface ReportingObserverOptions {\n types?: ReportTypes[];\n}\n\n/** This is experimental and the types are not included with TypeScript, sadly. */\ninterface ReportingObserverClass {\n new (\n handler: (reports: Report[]) => void,\n options: { buffered?: boolean; types?: ReportTypes[] },\n ): {\n observe: () => void;\n };\n}\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _reportingObserverIntegration = ((options: ReportingObserverOptions = {}) => {\n const types = options.types || ['crash', 'deprecation', 'intervention'];\n\n /** Handler for the reporting observer. */\n function handler(reports: Report[]): void {\n if (!SETUP_CLIENTS.has(getClient() as Client)) {\n return;\n }\n\n for (const report of reports) {\n withScope(scope => {\n scope.setExtra('url', report.url);\n\n const label = `ReportingObserver [${report.type}]`;\n let details = 'No details available';\n\n if (report.body) {\n // Object.keys doesn't work on ReportBody, as all properties are inherited\n const plainBody: {\n [key: string]: unknown;\n } = {};\n\n // eslint-disable-next-line guard-for-in\n for (const prop in report.body) {\n plainBody[prop] = report.body[prop];\n }\n\n scope.setExtra('body', plainBody);\n\n if (report.type === 'crash') {\n const body = report.body as CrashReportBody;\n // A fancy way to create a message out of crashId OR reason OR both OR fallback\n details = [body.crashId || '', body.reason || ''].join(' ').trim() || details;\n } else {\n const body = report.body as DeprecationReportBody | InterventionReportBody;\n details = body.message || details;\n }\n }\n\n captureMessage(`${label}: ${details}`);\n });\n }\n }\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n if (!supportsReportingObserver()) {\n return;\n }\n\n const observer = new (WINDOW as typeof WINDOW & { ReportingObserver: ReportingObserverClass }).ReportingObserver(\n handler,\n {\n buffered: true,\n types,\n },\n );\n\n observer.observe();\n },\n\n setup(client): void {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Reporting API integration - https://w3c.github.io/reporting/\n */\nexport const reportingObserverIntegration = defineIntegration(_reportingObserverIntegration);\n"],"names":[],"mappings":";;AAUA,MAAM,MAAA,GAAS,UAAA;AAEf,MAAM,gBAAA,GAAmB,mBAAA;AAoDzB,MAAM,aAAA,uBAAoB,OAAA,EAAyB;AAEnD,MAAM,6BAAA,IAAiC,CAAC,OAAA,GAAoC,EAAC,KAAM;AACjF,EAAA,MAAM,QAAQ,OAAA,CAAQ,KAAA,IAAS,CAAC,OAAA,EAAS,eAAe,cAAc,CAAA;AAGtE,EAAA,SAAS,QAAQ,OAAA,EAAyB;AACxC,IAAA,IAAI,CAAC,aAAA,CAAc,GAAA,CAAI,SAAA,EAAqB,CAAA,EAAG;AAC7C,MAAA;AAAA,IACF;AAEA,IAAA,KAAA,MAAW,UAAU,OAAA,EAAS;AAC5B,MAAA,SAAA,CAAU,CAAA,KAAA,KAAS;AACjB,QAAA,KAAA,CAAM,QAAA,CAAS,KAAA,EAAO,MAAA,CAAO,GAAG,CAAA;AAEhC,QAAA,MAAM,KAAA,GAAQ,CAAA,mBAAA,EAAsB,MAAA,CAAO,IAAI,CAAA,CAAA,CAAA;AAC/C,QAAA,IAAI,OAAA,GAAU,sBAAA;AAEd,QAAA,IAAI,OAAO,IAAA,EAAM;AAEf,UAAA,MAAM,YAEF,EAAC;AAGL,UAAA,KAAA,MAAW,IAAA,IAAQ,OAAO,IAAA,EAAM;AAC9B,YAAA,SAAA,CAAU,IAAI,CAAA,GAAI,MAAA,CAAO,IAAA,CAAK,IAAI,CAAA;AAAA,UACpC;AAEA,UAAA,KAAA,CAAM,QAAA,CAAS,QAAQ,SAAS,CAAA;AAEhC,UAAA,IAAI,MAAA,CAAO,SAAS,OAAA,EAAS;AAC3B,YAAA,MAAM,OAAO,MAA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