{"version":3,"file":"client.js","sources":["../../src/client.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport { getEnvelopeEndpointWithUrlEncodedAuth } from './api';\nimport { DEFAULT_ENVIRONMENT } from './constants';\nimport { getCurrentScope, getIsolationScope, getTraceContextFromScope } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport { createEventEnvelope, createSessionEnvelope } from './envelope';\nimport type { IntegrationIndex } from './integration';\nimport { afterSetupIntegrations, setupIntegration, setupIntegrations } from './integration';\nimport { _INTERNAL_flushLogsBuffer } from './logs/internal';\nimport { _INTERNAL_flushMetricsBuffer } from './metrics/internal';\nimport type { Scope } from './scope';\nimport { updateSession } from './session';\nimport { getDynamicSamplingContextFromScope } from './tracing/dynamicSamplingContext';\nimport { isStreamedBeforeSendSpanCallback } from './tracing/spans/beforeSendSpan';\nimport { extractGenAiSpansFromEvent } from './tracing/spans/extractGenAiSpans';\nimport { DEFAULT_TRANSPORT_BUFFER_SIZE } from './transports/base';\nimport type { Breadcrumb, BreadcrumbHint, FetchBreadcrumbHint, XhrBreadcrumbHint } from './types/breadcrumb';\nimport type { CheckIn, MonitorConfig } from './types/checkin';\nimport type { EventDropReason, Outcome } from './types/clientreport';\nimport type { DataCategory } from './types/datacategory';\nimport type { DsnComponents } from './types/dsn';\nimport type { DynamicSamplingContext, Envelope } from './types/envelope';\nimport type { ErrorEvent, Event, EventHint, EventType, TransactionEvent } from './types/event';\nimport type { EventProcessor } from './types/eventprocessor';\nimport type { FeedbackEvent } from './types/feedback';\nimport type { Integration } from './types/integration';\nimport type { Log } from './types/log';\nimport type { Metric } from './types/metric';\nimport type { Primitive } from './types/misc';\nimport type { ClientOptions } from './types/options';\nimport type { ParameterizedString } from './types/parameterize';\nimport type { ReplayEndEvent, ReplayStartEvent } from './types/replay';\nimport type { RequestEventData } from './types/request';\nimport type { SdkMetadata } from './types/sdkmetadata';\nimport type { Session, SessionAggregates } from './types/session';\nimport type { SeverityLevel } from './types/severity';\nimport type { Span, SpanAttributes, SpanContextData, SpanJSON, StreamedSpanJSON } from './types/span';\nimport type { StartSpanOptions } from './types/startSpanOptions';\nimport type { Transport, TransportMakeRequestResponse } from './types/transport';\nimport type { ResolvedDataCollection } from './types/datacollection';\nimport { createClientReportEnvelope } from './utils/clientreport';\nimport { debug } from './utils/debug-logger';\nimport { dsnToString, makeDsn } from './utils/dsn';\nimport { addItemToEnvelope, createAttachmentEnvelopeItem } from './utils/envelope';\nimport { getPossibleEventMessages } from './utils/eventUtils';\nimport { isParameterizedString, isPlainObject, isPrimitive, isThenable } from './utils/is';\nimport { merge } from './utils/merge';\nimport { checkOrSetAlreadyCaught, uuid4 } from './utils/misc';\nimport { parseSampleRate } from './utils/parseSampleRate';\nimport { prepareEvent } from './utils/prepareEvent';\nimport { makePromiseBuffer, type PromiseBuffer, SENTRY_BUFFER_FULL_ERROR } from './utils/promisebuffer';\nimport { safeMathRandom } from './utils/randomSafeContext';\nimport { reparentChildSpans, shouldIgnoreSpan } from './utils/should-ignore-span';\nimport { showSpanDropWarning } from './utils/spanUtils';\nimport { rejectedSyncPromise } from './utils/syncpromise';\nimport { safeUnref } from './utils/timer';\nimport { convertSpanJsonToTransactionEvent, convertTransactionEventToSpanJson } from './utils/transactionEvent';\nimport { resolveDataCollectionOptions } from './utils/data-collection/resolveDataCollectionOptions';\n\nconst ALREADY_SEEN_ERROR = \"Not capturing exception because it's already been captured.\";\nconst MISSING_RELEASE_FOR_SESSION_ERROR = 'Discarded session because of missing or non-string release';\n\nconst INTERNAL_ERROR_SYMBOL = Symbol.for('SentryInternalError');\nconst DO_NOT_SEND_EVENT_SYMBOL = Symbol.for('SentryDoNotSendEventError');\n\n// Default interval for flushing logs and metrics (5 seconds)\nconst DEFAULT_FLUSH_INTERVAL = 5000;\n\ninterface InternalError {\n message: string;\n [INTERNAL_ERROR_SYMBOL]: true;\n}\n\ninterface DoNotSendEventError {\n message: string;\n [DO_NOT_SEND_EVENT_SYMBOL]: true;\n}\n\nfunction _makeInternalError(message: string): InternalError {\n return {\n message,\n [INTERNAL_ERROR_SYMBOL]: true,\n };\n}\n\nfunction _makeDoNotSendEventError(message: string): DoNotSendEventError {\n return {\n message,\n [DO_NOT_SEND_EVENT_SYMBOL]: true,\n };\n}\n\nfunction _isInternalError(error: unknown): error is InternalError {\n return !!error && typeof error === 'object' && INTERNAL_ERROR_SYMBOL in error;\n}\n\nfunction _isDoNotSendEventError(error: unknown): error is DoNotSendEventError {\n return !!error && typeof error === 'object' && DO_NOT_SEND_EVENT_SYMBOL in error;\n}\n\n/**\n * Sets up weight-based flushing for logs or metrics.\n * This helper function encapsulates the common pattern of:\n * 1. Tracking accumulated weight of items\n * 2. Flushing when weight exceeds threshold (800KB)\n * 3. Flushing after timeout period from the first item\n *\n * Uses closure variables to track weight and timeout state.\n */\nfunction setupWeightBasedFlushing<\n T,\n AfterCaptureHook extends 'afterCaptureLog' | 'afterCaptureMetric',\n FlushHook extends 'flushLogs' | 'flushMetrics',\n>(\n client: Client,\n afterCaptureHook: AfterCaptureHook,\n flushHook: FlushHook,\n estimateSizeFn: (item: T) => number,\n flushFn: (client: Client) => void,\n): void {\n // Track weight and timeout in closure variables\n let weight = 0;\n let flushTimeout: ReturnType | undefined;\n let isTimerActive = false;\n\n // @ts-expect-error - TypeScript can't narrow generic hook types to match specific overloads, but we know this is type-safe\n client.on(flushHook, () => {\n weight = 0;\n clearTimeout(flushTimeout);\n isTimerActive = false;\n });\n\n // @ts-expect-error - TypeScript can't narrow generic hook types to match specific overloads, but we know this is type-safe\n client.on(afterCaptureHook, (item: T) => {\n weight += estimateSizeFn(item);\n\n // We flush the buffer if it exceeds 0.8 MB\n // The weight is a rough estimate, so we flush way before the payload gets too big.\n if (weight >= 800_000) {\n flushFn(client);\n } else if (!isTimerActive) {\n const flushInterval = client.getOptions()._flushInterval ?? DEFAULT_FLUSH_INTERVAL;\n if (flushInterval > 0) {\n // Only start timer if one isn't already running.\n // This prevents flushing being delayed by items that arrive close to the timeout limit\n // and thus resetting the flushing timeout and delaying items being flushed.\n isTimerActive = true;\n // Use safeUnref so the timer doesn't prevent the process from exiting\n flushTimeout = safeUnref(\n setTimeout(() => {\n flushFn(client);\n // Note: isTimerActive is reset by the flushHook handler above, not here,\n // to avoid race conditions when new items arrive during the flush.\n }, flushInterval),\n );\n }\n }\n });\n\n client.on('flush', () => {\n flushFn(client);\n });\n}\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event, it is passed through\n * {@link Client._prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends Client {\n * public constructor(options: NodeOptions) {\n * super(options);\n * }\n *\n * // ...\n * }\n */\nexport abstract class Client {\n /** Options passed to the SDK. */\n protected readonly _options: O;\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n protected readonly _dsn?: DsnComponents;\n\n protected readonly _transport?: Transport;\n\n /** Array of set up integrations. */\n protected _integrations: IntegrationIndex;\n\n /** Number of calls being processed */\n protected _numProcessing: number;\n\n protected _eventProcessors: EventProcessor[];\n\n /** Holds flushable */\n protected _outcomes: { [key: string]: number };\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n protected _hooks: Record>;\n\n protected _promiseBuffer: PromiseBuffer;\n\n protected readonly _dataCollection: ResolvedDataCollection;\n\n /**\n * Initializes this client instance.\n *\n * @param options Options for the client.\n */\n protected constructor(options: O) {\n this._options = options;\n this._integrations = {};\n this._numProcessing = 0;\n this._outcomes = {};\n this._hooks = {};\n this._eventProcessors = [];\n this._promiseBuffer = makePromiseBuffer(options.transportOptions?.bufferSize ?? DEFAULT_TRANSPORT_BUFFER_SIZE);\n this._dataCollection = resolveDataCollectionOptions(options);\n\n if (options.dsn) {\n this._dsn = makeDsn(options.dsn);\n } else {\n DEBUG_BUILD && debug.warn('No DSN provided, client will not send events.');\n }\n\n if (this._dsn) {\n const url = getEnvelopeEndpointWithUrlEncodedAuth(\n this._dsn,\n options.tunnel,\n options._metadata ? options._metadata.sdk : undefined,\n );\n this._transport = options.transport({\n tunnel: this._options.tunnel,\n recordDroppedEvent: this.recordDroppedEvent.bind(this),\n ...options.transportOptions,\n url,\n });\n }\n\n // Backfill enableLogs option from _experiments.enableLogs\n // TODO(v11): Remove or change default value\n // eslint-disable-next-line deprecation/deprecation\n this._options.enableLogs = this._options.enableLogs ?? this._options._experiments?.enableLogs;\n\n // Setup log flushing with weight and timeout tracking\n if (this._options.enableLogs) {\n setupWeightBasedFlushing(this, 'afterCaptureLog', 'flushLogs', estimateLogSizeInBytes, _INTERNAL_flushLogsBuffer);\n }\n\n // todo(v11): Remove the experimental flag\n // eslint-disable-next-line deprecation/deprecation\n const enableMetrics = this._options.enableMetrics ?? this._options._experiments?.enableMetrics ?? true;\n\n // Setup metric flushing with weight and timeout tracking\n if (enableMetrics) {\n setupWeightBasedFlushing(\n this,\n 'afterCaptureMetric',\n 'flushMetrics',\n estimateMetricSizeInBytes,\n _INTERNAL_flushMetricsBuffer,\n );\n }\n }\n\n /**\n * Captures an exception event and sends it to Sentry.\n *\n * Unlike `captureException` exported from every SDK, this method requires that you pass it the current scope.\n */\n public captureException(exception: unknown, hint?: EventHint, scope?: Scope): string {\n const eventId = uuid4();\n\n // ensure we haven't captured this very object before\n if (checkOrSetAlreadyCaught(exception)) {\n DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR);\n return eventId;\n }\n\n const hintWithEventId = {\n event_id: eventId,\n ...hint,\n };\n\n this._process(\n () =>\n this.eventFromException(exception, hintWithEventId)\n .then(event => this._captureEvent(event, hintWithEventId, scope))\n .then(res => res),\n 'error',\n );\n\n return hintWithEventId.event_id;\n }\n\n /**\n * Captures a message event and sends it to Sentry.\n *\n * Unlike `captureMessage` exported from every SDK, this method requires that you pass it the current scope.\n */\n public captureMessage(\n message: ParameterizedString,\n level?: SeverityLevel,\n hint?: EventHint,\n currentScope?: Scope,\n ): string {\n const hintWithEventId = {\n event_id: uuid4(),\n ...hint,\n };\n\n const eventMessage = isParameterizedString(message) ? message : String(message);\n const isMessage = isPrimitive(message);\n const promisedEvent = isMessage\n ? this.eventFromMessage(eventMessage, level, hintWithEventId)\n : this.eventFromException(message, hintWithEventId);\n\n this._process(\n () => promisedEvent.then(event => this._captureEvent(event, hintWithEventId, currentScope)),\n isMessage ? 'unknown' : 'error',\n );\n\n return hintWithEventId.event_id;\n }\n\n /**\n * Captures a manually created event and sends it to Sentry.\n *\n * Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.\n */\n public captureEvent(event: Event, hint?: EventHint, currentScope?: Scope): string {\n const eventId = uuid4();\n\n // ensure we haven't captured this very object before\n if (hint?.originalException && checkOrSetAlreadyCaught(hint.originalException)) {\n DEBUG_BUILD && debug.log(ALREADY_SEEN_ERROR);\n return eventId;\n }\n\n const hintWithEventId = {\n event_id: eventId,\n ...hint,\n };\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanScope: Scope | undefined = sdkProcessingMetadata.capturedSpanScope;\n const capturedSpanIsolationScope: Scope | undefined = sdkProcessingMetadata.capturedSpanIsolationScope;\n const dataCategory = getDataCategoryByType(event.type);\n\n this._process(\n () => this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope, capturedSpanIsolationScope),\n dataCategory,\n );\n\n return hintWithEventId.event_id;\n }\n\n /**\n * Captures a session.\n */\n public captureSession(session: Session): void {\n this.sendSession(session);\n // After sending, we set init false to indicate it's not the first occurrence\n updateSession(session, { init: false });\n }\n\n /**\n * Create a cron monitor check in and send it to Sentry. This method is not available on all clients.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n * @param scope An optional scope containing event metadata.\n * @returns A string representing the id of the check in.\n */\n public captureCheckIn?(checkIn: CheckIn, monitorConfig?: MonitorConfig, scope?: Scope): string;\n\n /**\n * Get the current Dsn.\n */\n public getDsn(): DsnComponents | undefined {\n return this._dsn;\n }\n\n /**\n * Get the current options.\n */\n public getOptions(): O {\n return this._options;\n }\n\n /**\n * Get the resolved data collection configuration.\n */\n public getDataCollectionOptions(): ResolvedDataCollection {\n return this._dataCollection;\n }\n\n /**\n * Get the SDK metadata.\n * @see SdkMetadata\n */\n public getSdkMetadata(): SdkMetadata | undefined {\n return this._options._metadata;\n }\n\n /**\n * Returns the transport that is used by the client.\n * Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.\n */\n public getTransport(): Transport | undefined {\n return this._transport;\n }\n\n /**\n * Wait for all events to be sent or the timeout to expire, whichever comes first.\n *\n * @param timeout Maximum time in ms the client should wait for events to be flushed. Omitting this parameter will\n * cause the client to wait until all events are sent before resolving the promise.\n * @returns A promise that will resolve with `true` if all events are sent before the timeout, or `false` if there are\n * still events in the queue when the timeout is reached.\n */\n // @ts-expect-error - PromiseLike is a subset of Promise\n public async flush(timeout?: number): PromiseLike {\n const transport = this._transport;\n\n // Emit `flush` unconditionally so weight-based log/metric flushers drain\n // their buffers and clear their idle timers, even when no transport is\n // configured (e.g. no DSN).\n this.emit('flush');\n\n if (!transport) {\n return true;\n }\n\n const clientFinished = await this._isClientDoneProcessing(timeout);\n const transportFlushed = await transport.flush(timeout);\n\n return clientFinished && transportFlushed;\n }\n\n /**\n * Flush the event queue and set the client to `enabled = false`. See {@link Client.flush}.\n *\n * @param {number} timeout Maximum time in ms the client should wait before shutting down. Omitting this parameter will cause\n * the client to wait until all events are sent before disabling itself.\n * @returns {Promise} A promise which resolves to `true` if the flush completes successfully before the timeout, or `false` if\n * it doesn't.\n */\n // @ts-expect-error - PromiseLike is a subset of Promise\n public async close(timeout?: number): PromiseLike {\n _INTERNAL_flushLogsBuffer(this);\n const result = await this.flush(timeout);\n this.getOptions().enabled = false;\n this.emit('close');\n return result;\n }\n\n /**\n * Get all installed event processors.\n */\n public getEventProcessors(): EventProcessor[] {\n return this._eventProcessors;\n }\n\n /**\n * Adds an event processor that applies to any event processed by this client.\n */\n public addEventProcessor(eventProcessor: EventProcessor): void {\n this._eventProcessors.push(eventProcessor);\n }\n\n /**\n * Initialize this client.\n * Call this after the client was set on a scope.\n */\n public init(): void {\n if (\n this._isEnabled() ||\n // Force integrations to be setup even if no DSN was set when we have\n // Spotlight enabled. This is particularly important for browser as we\n // don't support the `spotlight` option there and rely on the users\n // adding the `spotlightBrowserIntegration()` to their integrations which\n // wouldn't get initialized with the check below when there's no DSN set.\n this._options.integrations.some(({ name }) => name.startsWith('Spotlight'))\n ) {\n this._setupIntegrations();\n }\n }\n\n /**\n * Gets an installed integration by its name.\n *\n * @returns {Integration|undefined} The installed integration or `undefined` if no integration with that `name` was installed.\n */\n public getIntegrationByName(integrationName: string): T | undefined {\n return this._integrations[integrationName] as T | undefined;\n }\n\n /**\n * Returns the names of all installed integrations.\n */\n public getIntegrationNames(): string[] {\n return Object.keys(this._integrations);\n }\n\n /**\n * Add an integration to the client.\n * This can be used to e.g. lazy load integrations.\n * In most cases, this should not be necessary,\n * and you're better off just passing the integrations via `integrations: []` at initialization time.\n * However, if you find the need to conditionally load & add an integration, you can use `addIntegration` to do so.\n */\n public addIntegration(integration: Integration): void {\n const isAlreadyInstalled = this._integrations[integration.name];\n\n if (!isAlreadyInstalled && integration.beforeSetup) {\n integration.beforeSetup(this);\n }\n\n // This hook takes care of only installing if not already installed\n setupIntegration(this, integration, this._integrations);\n // Here we need to check manually to make sure to not run this multiple times\n if (!isAlreadyInstalled) {\n afterSetupIntegrations(this, [integration]);\n }\n }\n\n /**\n * Send a fully prepared event to Sentry.\n */\n public sendEvent(event: Event, hint: EventHint = {}): void {\n this.emit('beforeSendEvent', event, hint);\n\n // Extract gen_ai spans from transaction and convert to span v2 format.\n // This mutates event.spans to remove the extracted spans.\n const genAiSpanItem = extractGenAiSpansFromEvent(event, this);\n\n let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);\n\n for (const attachment of hint.attachments || []) {\n env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment));\n }\n\n if (genAiSpanItem) {\n env = addItemToEnvelope(env, genAiSpanItem);\n }\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(env).then(sendResponse => this.emit('afterSendEvent', event, sendResponse));\n }\n\n /**\n * Send a session or session aggregrates to Sentry.\n */\n public sendSession(session: Session | SessionAggregates): void {\n // Backfill release and environment on session\n const { release: clientReleaseOption, environment: clientEnvironmentOption = DEFAULT_ENVIRONMENT } = this._options;\n if ('aggregates' in session) {\n const sessionAttrs = session.attrs || {};\n if (!sessionAttrs.release && !clientReleaseOption) {\n DEBUG_BUILD && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);\n return;\n }\n sessionAttrs.release = sessionAttrs.release || clientReleaseOption;\n sessionAttrs.environment = sessionAttrs.environment || clientEnvironmentOption;\n session.attrs = sessionAttrs;\n } else {\n if (!session.release && !clientReleaseOption) {\n DEBUG_BUILD && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);\n return;\n }\n session.release = session.release || clientReleaseOption;\n session.environment = session.environment || clientEnvironmentOption;\n }\n\n this.emit('beforeSendSession', session);\n\n const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(env);\n }\n\n /**\n * Record on the client that an event got dropped (ie, an event that will not be sent to Sentry).\n */\n public recordDroppedEvent(reason: EventDropReason, category: DataCategory, count: number = 1): void {\n if (this._options.sendClientReports) {\n // We want to track each category (error, transaction, session, replay_event) separately\n // but still keep the distinction between different type of outcomes.\n // We could use nested maps, but it's much easier to read and type this way.\n // A correct type for map-based implementation if we want to go that route\n // would be `Partial>>>`\n // With typescript 4.1 we could even use template literal types\n const key = `${reason}:${category}`;\n DEBUG_BUILD && debug.log(`Recording outcome: \"${key}\"${count > 1 ? ` (${count} times)` : ''}`);\n this._outcomes[key] = (this._outcomes[key] || 0) + count;\n }\n }\n\n /* eslint-disable @typescript-eslint/unified-signatures */\n /**\n * Register a callback for whenever a span is started.\n * Receives the span as argument.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'spanStart', callback: (span: Span) => void): () => void;\n\n /**\n * Register a callback before span sampling runs. Receives a `samplingDecision` object argument with a `decision`\n * property that can be used to make a sampling decision that will be enforced, before any span sampling runs.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeSampling',\n callback: (\n samplingData: {\n spanAttributes: SpanAttributes;\n spanName: string;\n parentSampled?: boolean;\n parentSampleRate?: number;\n parentContext?: SpanContextData;\n },\n samplingDecision: { decision: boolean },\n ) => void,\n ): void;\n\n /**\n * Register a callback for after a span is ended.\n * NOTE: The span cannot be mutated anymore in this callback.\n * Receives the span as argument.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'spanEnd', callback: (span: Span) => void): () => void;\n\n /**\n * Register a callback for after a span is ended and the `spanEnd` hook has run.\n * NOTE: The span cannot be mutated anymore in this callback.\n */\n public on(hook: 'afterSpanEnd', callback: (immutableSegmentSpan: Readonly) => void): () => void;\n\n /**\n * Register a callback for after a segment span is ended and the `segmentSpanEnd` hook has run.\n * NOTE: The segment span cannot be mutated anymore in this callback.\n */\n public on(hook: 'afterSegmentSpanEnd', callback: (immutableSegmentSpan: Readonly) => void): () => void;\n\n /**\n * Register a callback for when a span JSON is processed, to add some data to the span JSON.\n */\n public on(hook: 'processSpan', callback: (streamedSpanJSON: StreamedSpanJSON) => void): () => void;\n\n /**\n * Register a callback for when a segment span JSON is processed, to add some data to the segment span JSON.\n */\n public on(hook: 'processSegmentSpan', callback: (streamedSpanJSON: StreamedSpanJSON) => void): () => void;\n\n /**\n * Register a callback for when an idle span is allowed to auto-finish.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'idleSpanEnableAutoFinish', callback: (span: Span) => void): () => void;\n\n /**\n * Register a callback for transaction start and finish.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): () => void;\n\n /**\n * Register a callback that runs when stack frame metadata should be applied to an event.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'applyFrameMetadata', callback: (event: Event) => void): () => void;\n\n /**\n * Register a callback for before sending an event.\n * This is called right before an event is sent and should not be used to mutate the event.\n * Receives an Event & EventHint as arguments.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;\n\n /**\n * Register a callback for before sending a session or session aggregrates..\n * Receives the session/aggregate as second argument.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeSendSession', callback: (session: Session | SessionAggregates) => void): () => void;\n\n /**\n * Register a callback for preprocessing an event,\n * before it is passed to (global) event processors.\n * Receives an Event & EventHint as arguments.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;\n\n /**\n * Register a callback for postprocessing an event,\n * after it was passed to (global) event processors, before it is being sent.\n * Receives an Event & EventHint as arguments.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'postprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): () => void;\n\n /**\n * Register a callback for when an event has been sent.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'afterSendEvent',\n callback: (event: Event, sendResponse: TransportMakeRequestResponse) => void,\n ): () => void;\n\n /**\n * Register a callback before a breadcrumb is added.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): () => void;\n\n /**\n * Register a callback when a DSC (Dynamic Sampling Context) is created.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'createDsc', callback: (dsc: DynamicSamplingContext, rootSpan?: Span) => void): () => void;\n\n /**\n * Register a callback when a Feedback event has been prepared.\n * This should be used to mutate the event. The options argument can hint\n * about what kind of mutation it expects.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeSendFeedback',\n callback: (feedback: FeedbackEvent, options?: { includeReplay?: boolean }) => void,\n ): () => void;\n\n /**\n * Register a callback when the feedback widget is opened in a user's browser\n */\n public on(hook: 'openFeedbackWidget', callback: () => void): () => void;\n\n /**\n * A hook that is called when a replay session starts recording (either session or buffer mode).\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'replayStart', callback: (event: ReplayStartEvent) => void): () => void;\n\n /**\n * A hook that is called when a replay session stops recording, either manually or due to an\n * internal condition such as `maxReplayDuration` expiry, send failure, or mutation limit.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'replayEnd', callback: (event: ReplayEndEvent) => void): () => void;\n\n /**\n * A hook for the browser tracing integrations to trigger a span start for a page load.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'startPageLoadSpan',\n callback: (\n options: StartSpanOptions,\n traceOptions?: { sentryTrace?: string | undefined; baggage?: string | undefined },\n ) => void,\n ): () => void;\n\n /**\n * A hook for the browser tracing integrations to trigger the end of a page load span.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'endPageloadSpan', callback: () => void): () => void;\n\n /**\n * A hook for the browser tracing integrations to trigger after the pageload span was started.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'afterStartPageLoadSpan', callback: (span: Span) => void): () => void;\n\n /**\n * A hook for triggering right before a navigation span is started.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeStartNavigationSpan',\n callback: (options: StartSpanOptions, navigationOptions?: { isRedirect?: boolean }) => void,\n ): () => void;\n\n /**\n * A hook for browser tracing integrations to trigger a span for a navigation.\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'startNavigationSpan',\n callback: (options: StartSpanOptions, navigationOptions?: { isRedirect?: boolean }) => void,\n ): () => void;\n\n /**\n * A hook for GraphQL client integration to enhance a span with request data.\n * @returns A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeOutgoingRequestSpan',\n callback: (span: Span, hint: XhrBreadcrumbHint | FetchBreadcrumbHint) => void,\n ): () => void;\n\n /**\n * A hook for GraphQL client integration to enhance a breadcrumb with request data.\n * @returns A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'beforeOutgoingRequestBreadcrumb',\n callback: (breadcrumb: Breadcrumb, hint: XhrBreadcrumbHint | FetchBreadcrumbHint) => void,\n ): () => void;\n\n /**\n * A hook that is called when the client is flushing\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'flush', callback: () => void): () => void;\n\n /**\n * A hook that is called when the client is closing\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'close', callback: () => void): () => void;\n\n /**\n * A hook that is called before a log is captured. This hooks runs before `beforeSendLog` is fired.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'beforeCaptureLog', callback: (log: Log) => void): () => void;\n\n /**\n * A hook that is called after a log is captured\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'afterCaptureLog', callback: (log: Log) => void): () => void;\n\n /**\n * A hook that is called when the client is flushing logs\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'flushLogs', callback: () => void): () => void;\n\n /**\n * A hook that is called after capturing a metric. This hooks runs after `beforeSendMetric` is fired.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'afterCaptureMetric', callback: (metric: Metric) => void): () => void;\n\n /**\n * A hook that is called when the client is flushing metrics\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'flushMetrics', callback: () => void): () => void;\n\n /**\n * A hook that is called when a metric is processed before it is captured and before the `beforeSendMetric` callback is fired.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'processMetric', callback: (metric: Metric) => void): () => void;\n\n /**\n * A hook that is called when a http server request is started.\n * This hook is called after request isolation, but before the request is processed.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(\n hook: 'httpServerRequest',\n callback: (request: unknown, response: unknown, normalizedRequest: RequestEventData) => void,\n ): () => void;\n\n /**\n * A hook that is called when the UI Profiler should start profiling.\n *\n * This hook is called when running `Sentry.uiProfiler.startProfiler()`.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'startUIProfiler', callback: () => void): () => void;\n\n /**\n * A hook that is called when the UI Profiler should stop profiling.\n *\n * This hook is called when running `Sentry.uiProfiler.stopProfiler()`.\n *\n * @returns {() => void} A function that, when executed, removes the registered callback.\n */\n public on(hook: 'stopUIProfiler', callback: () => void): () => void;\n\n /**\n * Register a hook on this client.\n */\n public on(hook: string, callback: unknown): () => void {\n const hookCallbacks = (this._hooks[hook] = this._hooks[hook] || new Set());\n\n // Wrap the callback in a function so that registering the same callback instance multiple\n // times results in the callback being called multiple times.\n // @ts-expect-error - The `callback` type is correct and must be a function due to the\n // individual, specific overloads of this function.\n // eslint-disable-next-line @typescript-eslint/ban-types\n const uniqueCallback: Function = (...args: unknown[]) => callback(...args);\n\n hookCallbacks.add(uniqueCallback);\n\n // This function returns a callback execution handler that, when invoked,\n // deregisters a callback. This is crucial for managing instances where callbacks\n // need to be unregistered to prevent self-referencing in callback closures,\n // ensuring proper garbage collection.\n return () => {\n hookCallbacks.delete(uniqueCallback);\n };\n }\n\n /** Fire a hook whenever a span starts. */\n public emit(hook: 'spanStart', span: Span): void;\n\n /** A hook that is called every time before a span is sampled. */\n public emit(\n hook: 'beforeSampling',\n samplingData: {\n spanAttributes: SpanAttributes;\n spanName: string;\n parentSampled?: boolean;\n parentSampleRate?: number;\n parentContext?: SpanContextData;\n },\n samplingDecision: { decision: boolean },\n ): void;\n\n /** Fire a hook whenever a span ends. */\n public emit(hook: 'spanEnd', span: Span): void;\n\n /**\n * Fire a hook event after a span ends and the `spanEnd` hook has run.\n */\n public emit(hook: 'afterSpanEnd', immutableSpan: Readonly): void;\n\n /**\n * Fire a hook event after a segment span ends and the `spanEnd` hook has run.\n */\n public emit(hook: 'afterSegmentSpanEnd', immutableSegmentSpan: Readonly): void;\n\n /**\n * Fire a hook event when a span JSON is processed, to add some data to the span JSON.\n */\n public emit(hook: 'processSpan', streamedSpanJSON: StreamedSpanJSON): void;\n\n /**\n * Fire a hook event for when a segment span JSON is processed, to add some data to the segment span JSON.\n */\n public emit(hook: 'processSegmentSpan', streamedSpanJSON: StreamedSpanJSON): void;\n\n /**\n * Fire a hook indicating that an idle span is allowed to auto finish.\n */\n public emit(hook: 'idleSpanEnableAutoFinish', span: Span): void;\n\n /**\n * Fire a hook event for envelope creation and sending. Expects to be given an envelope as the\n * second argument.\n */\n public emit(hook: 'beforeEnvelope', envelope: Envelope): void;\n\n /**\n * Fire a hook indicating that stack frame metadata should be applied to the event passed to the hook.\n */\n public emit(hook: 'applyFrameMetadata', event: Event): void;\n\n /**\n * Fire a hook event before sending an event.\n * This is called right before an event is sent and should not be used to mutate the event.\n * Expects to be given an Event & EventHint as the second/third argument.\n */\n public emit(hook: 'beforeSendEvent', event: Event, hint?: EventHint): void;\n\n /**\n * Fire a hook event before sending a session/aggregates.\n * Expects to be given the prepared session/aggregates as second argument.\n */\n public emit(hook: 'beforeSendSession', session: Session | SessionAggregates): void;\n\n /**\n * Fire a hook event to process events before they are passed to (global) event processors.\n * Expects to be given an Event & EventHint as the second/third argument.\n */\n public emit(hook: 'preprocessEvent', event: Event, hint?: EventHint): void;\n\n /**\n * Fire a hook event to process a user on an event before it is sent to Sentry, after all other processors have run.\n * Expects to be given an Event & EventHint as the second/third argument.\n */\n public emit(hook: 'postprocessEvent', event: Event, hint?: EventHint): void;\n\n /**\n * Fire a hook event after sending an event. Expects to be given an Event as the\n * second argument.\n */\n public emit(hook: 'afterSendEvent', event: Event, sendResponse: TransportMakeRequestResponse): void;\n\n /**\n * Fire a hook for when a breadcrumb is added. Expects the breadcrumb as second argument.\n */\n public emit(hook: 'beforeAddBreadcrumb', breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void;\n\n /**\n * Fire a hook for when a DSC (Dynamic Sampling Context) is created. Expects the DSC as second argument.\n */\n public emit(hook: 'createDsc', dsc: DynamicSamplingContext, rootSpan?: Span): void;\n\n /**\n * Fire a hook event for after preparing a feedback event. Events to be given\n * a feedback event as the second argument, and an optional options object as\n * third argument.\n */\n public emit(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: { includeReplay?: boolean }): void;\n\n /**\n * Fire a hook event for when the feedback widget is opened in a user's browser\n */\n public emit(hook: 'openFeedbackWidget'): void;\n\n /**\n * Fire a hook event when a replay session starts recording.\n */\n public emit(hook: 'replayStart', event: ReplayStartEvent): void;\n\n /**\n * Fire a hook event when a replay session stops recording.\n */\n public emit(hook: 'replayEnd', event: ReplayEndEvent): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger a span start for a page load.\n */\n public emit(\n hook: 'startPageLoadSpan',\n options: StartSpanOptions,\n traceOptions?: { sentryTrace?: string | undefined; baggage?: string | undefined },\n ): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger the end of a page load span.\n */\n public emit(hook: 'endPageloadSpan'): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger aafter the pageload span was started.\n */\n public emit(hook: 'afterStartPageLoadSpan', span: Span): void;\n\n /**\n * Emit a hook event for triggering right before a navigation span is started.\n */\n public emit(\n hook: 'beforeStartNavigationSpan',\n options: StartSpanOptions,\n navigationOptions?: { isRedirect?: boolean },\n ): void;\n\n /**\n * Emit a hook event for browser tracing integrations to trigger a span for a navigation.\n */\n public emit(\n hook: 'startNavigationSpan',\n options: StartSpanOptions,\n navigationOptions?: { isRedirect?: boolean },\n ): void;\n\n /**\n * Emit a hook event for GraphQL client integration to enhance a span with request data.\n */\n public emit(hook: 'beforeOutgoingRequestSpan', span: Span, hint: XhrBreadcrumbHint | FetchBreadcrumbHint): void;\n\n /**\n * Emit a hook event for GraphQL client integration to enhance a breadcrumb with request data.\n */\n public emit(\n hook: 'beforeOutgoingRequestBreadcrumb',\n breadcrumb: Breadcrumb,\n hint: XhrBreadcrumbHint | FetchBreadcrumbHint,\n ): void;\n\n /**\n * Emit a hook event for client flush\n */\n public emit(hook: 'flush'): void;\n\n /**\n * Emit a hook event for client close\n */\n public emit(hook: 'close'): void;\n\n /**\n * Emit a hook event for client before capturing a log. This hooks runs before `beforeSendLog` is fired.\n */\n public emit(hook: 'beforeCaptureLog', log: Log): void;\n\n /**\n * Emit a hook event for client after capturing a log.\n */\n public emit(hook: 'afterCaptureLog', log: Log): void;\n\n /**\n * Emit a hook event for client flush logs\n */\n public emit(hook: 'flushLogs'): void;\n\n /**\n * Emit a hook event for client after capturing a metric.\n */\n public emit(hook: 'afterCaptureMetric', metric: Metric): void;\n\n /**\n * Emit a hook event for client flush metrics\n */\n public emit(hook: 'flushMetrics'): void;\n\n /**\n *\n * Emit a hook event for client to process a metric before it is captured.\n * This hook is called before the `beforeSendMetric` callback is fired.\n */\n public emit(hook: 'processMetric', metric: Metric): void;\n\n /**\n * Emit a hook event for client when a http server request is started.\n * This hook is called after request isolation, but before the request is processed.\n */\n public emit(\n hook: 'httpServerRequest',\n request: unknown,\n response: unknown,\n normalizedRequest: RequestEventData,\n ): void;\n\n /**\n * Emit a hook event for starting the UI Profiler.\n */\n public emit(hook: 'startUIProfiler'): void;\n\n /**\n * Emit a hook event for stopping the UI Profiler.\n */\n public emit(hook: 'stopUIProfiler'): void;\n\n /**\n * Emit a hook that was previously registered via `on()`.\n */\n public emit(hook: string, ...rest: unknown[]): void {\n const callbacks = this._hooks[hook];\n if (callbacks) {\n callbacks.forEach(callback => callback(...rest));\n }\n }\n\n /**\n * Send an envelope to Sentry.\n */\n // @ts-expect-error - PromiseLike is a subset of Promise\n public async sendEnvelope(envelope: Envelope): PromiseLike {\n this.emit('beforeEnvelope', envelope);\n\n if (this._isEnabled() && this._transport) {\n try {\n return await this._transport.send(envelope);\n } catch (reason) {\n DEBUG_BUILD && debug.error('Error while sending envelope:', reason);\n return {};\n }\n }\n\n DEBUG_BUILD && debug.error('Transport disabled');\n return {};\n }\n\n /**\n * Register a cleanup function to be called when the client is disposed.\n * This is useful for integrations that need to clean up global state.\n *\n * NOTE: This is a no-op in the base `Client` class. Subclasses like `ServerRuntimeClient`\n * override this method to actually register and execute cleanup callbacks.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public registerCleanup(callback: () => void): void {\n // No-op in base class - subclasses override to implement cleanup registration\n }\n\n /**\n * Disposes of the client and releases all resources.\n *\n * Subclasses should override this method to clean up their own resources, including invoking\n * any callbacks registered via {@link Client.registerCleanup}. The base implementation is a\n * no-op and does NOT execute registered cleanup callbacks.\n *\n * After calling dispose(), the client should not be used anymore.\n */\n public dispose(): void {\n // Base class has no cleanup logic - subclasses implement their own\n }\n\n /* eslint-enable @typescript-eslint/unified-signatures */\n\n /** Setup integrations for this client. */\n protected _setupIntegrations(): void {\n const { integrations } = this._options;\n this._integrations = setupIntegrations(this, integrations);\n afterSetupIntegrations(this, integrations);\n }\n\n /** Updates existing session based on the provided event */\n protected _updateSessionFromEvent(session: Session, event: Event): void {\n // initially, set `crashed` based on the event level and update from exceptions if there are any later on\n let crashed = event.level === 'fatal';\n let errored = false;\n const exceptions = event.exception?.values;\n\n if (exceptions) {\n errored = true;\n // reset crashed to false if there are exceptions, to ensure `mechanism.handled` is respected.\n crashed = false;\n\n for (const ex of exceptions) {\n if (ex.mechanism?.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n\n // A session is updated and that session update is sent in only one of the two following scenarios:\n // 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update\n // 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update\n const sessionNonTerminal = session.status === 'ok';\n const shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed);\n\n if (shouldUpdateAndSend) {\n updateSession(session, {\n ...(crashed && { status: 'crashed' }),\n errors: session.errors || Number(errored || crashed),\n });\n this.captureSession(session);\n }\n }\n\n /**\n * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying\n * \"no\" (resolving to `false`) in order to give the client a chance to potentially finish first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not\n * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and\n * `false` otherwise\n */\n protected async _isClientDoneProcessing(timeout?: number): Promise {\n let ticked = 0;\n\n while (!timeout || ticked < timeout) {\n await new Promise(resolve => setTimeout(resolve, 1));\n\n if (!this._numProcessing) {\n return true;\n }\n ticked++;\n }\n\n return false;\n }\n\n /** Determines whether this SDK is enabled and a transport is present. */\n protected _isEnabled(): boolean {\n return this.getOptions().enabled !== false && this._transport !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param currentScope A scope containing event metadata.\n * @returns A new event with more information.\n */\n protected _prepareEvent(\n event: Event,\n hint: EventHint,\n currentScope: Scope,\n isolationScope: Scope,\n ): PromiseLike {\n const options = this.getOptions();\n const integrations = this.getIntegrationNames();\n if (!hint.integrations && integrations.length) {\n hint.integrations = integrations;\n }\n\n this.emit('preprocessEvent', event, hint);\n\n if (!event.type) {\n isolationScope.setLastEventId(event.event_id || hint.event_id);\n }\n\n return prepareEvent(options, event, hint, currentScope, this, isolationScope).then(evt => {\n if (evt === null) {\n return evt;\n }\n\n this.emit('postprocessEvent', evt, hint);\n\n evt.contexts = {\n trace: { ...evt.contexts?.trace, ...getTraceContextFromScope(currentScope) },\n ...evt.contexts,\n };\n\n const dynamicSamplingContext = getDynamicSamplingContextFromScope(this, currentScope);\n\n evt.sdkProcessingMetadata = {\n dynamicSamplingContext,\n ...evt.sdkProcessingMetadata,\n };\n\n return evt;\n });\n }\n\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n protected _captureEvent(\n event: Event,\n hint: EventHint = {},\n currentScope = getCurrentScope(),\n isolationScope = getIsolationScope(),\n ): PromiseLike {\n if (DEBUG_BUILD && isErrorEvent(event)) {\n debug.log(`Captured error event \\`${getPossibleEventMessages(event)[0] || ''}\\``);\n }\n\n return this._processEvent(event, hint, currentScope, isolationScope).then(\n finalEvent => {\n return finalEvent.event_id;\n },\n reason => {\n if (DEBUG_BUILD) {\n if (_isDoNotSendEventError(reason)) {\n debug.log(reason.message);\n } else if (_isInternalError(reason)) {\n debug.warn(reason.message);\n } else {\n debug.warn(reason);\n }\n }\n return undefined;\n },\n );\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param currentScope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n protected _processEvent(\n event: Event,\n hint: EventHint,\n currentScope: Scope,\n isolationScope: Scope,\n ): PromiseLike {\n const options = this.getOptions();\n const { sampleRate } = options;\n\n const isTransaction = isTransactionEvent(event);\n const isError = isErrorEvent(event);\n const eventType = event.type || 'error';\n const beforeSendLabel = `before send for type \\`${eventType}\\``;\n\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n const parsedSampleRate = typeof sampleRate === 'undefined' ? undefined : parseSampleRate(sampleRate);\n if (isError && typeof parsedSampleRate === 'number' && safeMathRandom() > parsedSampleRate) {\n this.recordDroppedEvent('sample_rate', 'error');\n return rejectedSyncPromise(\n _makeDoNotSendEventError(\n `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,\n ),\n );\n }\n\n const dataCategory = getDataCategoryByType(event.type);\n\n return this._prepareEvent(event, hint, currentScope, isolationScope)\n .then(prepared => {\n if (prepared === null) {\n this.recordDroppedEvent('event_processor', dataCategory);\n throw _makeDoNotSendEventError('An event processor returned `null`, will not send event.');\n }\n\n const isInternalException = (hint.data as { __sentry__: boolean })?.__sentry__ === true;\n if (isInternalException) {\n return prepared;\n }\n\n const result = processBeforeSend(this, options, prepared, hint);\n return _validateBeforeSendResult(result, beforeSendLabel);\n })\n .then(processedEvent => {\n if (processedEvent === null) {\n this.recordDroppedEvent('before_send', dataCategory);\n if (isTransaction) {\n const spans = event.spans || [];\n // the transaction itself counts as one span, plus all the child spans that are added\n const spanCount = 1 + spans.length;\n this.recordDroppedEvent('before_send', 'span', spanCount);\n }\n throw _makeDoNotSendEventError(`${beforeSendLabel} returned \\`null\\`, will not send event.`);\n }\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (isError && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n\n if (isTransaction) {\n const spanCountBefore = processedEvent.sdkProcessingMetadata?.spanCountBeforeProcessing || 0;\n const spanCountAfter = processedEvent.spans ? processedEvent.spans.length : 0;\n\n const droppedSpanCount = spanCountBefore - spanCountAfter;\n if (droppedSpanCount > 0) {\n this.recordDroppedEvent('before_send', 'span', droppedSpanCount);\n }\n }\n\n // None of the Sentry built event processor will update transaction name,\n // so if the transaction name has been changed by an event processor, we know\n // it has to come from custom event processor added by a user\n const transactionInfo = processedEvent.transaction_info;\n if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {\n const source = 'custom';\n processedEvent.transaction_info = {\n ...transactionInfo,\n source,\n };\n }\n\n this.sendEvent(processedEvent, hint);\n return processedEvent;\n })\n .then(null, reason => {\n if (_isDoNotSendEventError(reason) || _isInternalError(reason)) {\n throw reason;\n }\n\n this.captureException(reason, {\n mechanism: {\n handled: false,\n type: 'internal',\n },\n data: {\n __sentry__: true,\n },\n originalException: reason,\n });\n throw _makeInternalError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n }\n\n /**\n * Occupies the client with processing and event\n */\n protected _process(taskProducer: () => PromiseLike, dataCategory: DataCategory): void {\n this._numProcessing++;\n\n void this._promiseBuffer.add(taskProducer).then(\n value => {\n this._numProcessing--;\n return value;\n },\n reason => {\n this._numProcessing--;\n\n if (reason === SENTRY_BUFFER_FULL_ERROR) {\n this.recordDroppedEvent('queue_overflow', dataCategory);\n }\n\n return reason;\n },\n );\n }\n\n /**\n * Clears outcomes on this client and returns them.\n */\n protected _clearOutcomes(): Outcome[] {\n const outcomes = this._outcomes;\n this._outcomes = {};\n return Object.entries(outcomes).map(([key, quantity]) => {\n const [reason, category] = key.split(':') as [EventDropReason, DataCategory];\n return {\n reason,\n category,\n quantity,\n };\n });\n }\n\n /**\n * Sends client reports as an envelope.\n */\n protected _flushOutcomes(): void {\n DEBUG_BUILD && debug.log('Flushing outcomes...');\n\n const outcomes = this._clearOutcomes();\n\n if (outcomes.length === 0) {\n DEBUG_BUILD && debug.log('No outcomes to send');\n return;\n }\n\n // This is really the only place where we want to check for a DSN and only send outcomes then\n if (!this._dsn) {\n DEBUG_BUILD && debug.log('No dsn provided, will not send outcomes');\n return;\n }\n\n DEBUG_BUILD && debug.log('Sending outcomes:', outcomes);\n\n const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn));\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.\n */\n public abstract eventFromException(_exception: unknown, _hint?: EventHint): PromiseLike;\n\n /**\n * Creates an {@link Event} from primitive inputs to `captureMessage`.\n */\n public abstract eventFromMessage(\n _message: ParameterizedString,\n _level?: SeverityLevel,\n _hint?: EventHint,\n ): PromiseLike;\n}\n\nfunction getDataCategoryByType(type: EventType | 'replay_event' | undefined): DataCategory {\n return type === 'replay_event' ? 'replay' : type || 'error';\n}\n\n/**\n * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.\n */\nfunction _validateBeforeSendResult(\n beforeSendResult: PromiseLike | Event | null,\n beforeSendLabel: string,\n): PromiseLike | Event | null {\n const invalidValueError = `${beforeSendLabel} must return \\`null\\` or a valid event.`;\n if (isThenable(beforeSendResult)) {\n return beforeSendResult.then(\n event => {\n if (!isPlainObject(event) && event !== null) {\n throw _makeInternalError(invalidValueError);\n }\n return event;\n },\n e => {\n throw _makeInternalError(`${beforeSendLabel} rejected with ${e}`);\n },\n );\n } else if (!isPlainObject(beforeSendResult) && beforeSendResult !== null) {\n throw _makeInternalError(invalidValueError);\n }\n return beforeSendResult;\n}\n\n/**\n * Process the matching `beforeSendXXX` callback.\n */\nfunction processBeforeSend(\n client: Client,\n options: ClientOptions,\n event: Event,\n hint: EventHint,\n): PromiseLike | Event | null {\n const { beforeSend, beforeSendTransaction, ignoreSpans } = options;\n const beforeSendSpan = !isStreamedBeforeSendSpanCallback(options.beforeSendSpan) && options.beforeSendSpan;\n\n let processedEvent = event;\n\n if (isErrorEvent(processedEvent) && beforeSend) {\n return beforeSend(processedEvent, hint);\n }\n\n if (isTransactionEvent(processedEvent)) {\n // Avoid processing if we don't have to\n if (beforeSendSpan || ignoreSpans) {\n // 1. Process root span\n const rootSpanJson = convertTransactionEventToSpanJson(processedEvent);\n\n // 1.1 If the root span should be ignored, drop the whole transaction\n if (\n ignoreSpans?.length &&\n shouldIgnoreSpan(\n { description: rootSpanJson.description, op: rootSpanJson.op, attributes: rootSpanJson.data },\n ignoreSpans,\n )\n ) {\n // dropping the whole transaction!\n return null;\n }\n\n // 1.2 If a `beforeSendSpan` callback is defined, process the root span\n if (beforeSendSpan) {\n const processedRootSpanJson = beforeSendSpan(rootSpanJson);\n if (!processedRootSpanJson) {\n showSpanDropWarning();\n } else {\n // update event with processed root span values\n processedEvent = merge(event, convertSpanJsonToTransactionEvent(processedRootSpanJson));\n }\n }\n\n // 2. Process child spans\n if (processedEvent.spans) {\n const processedSpans: SpanJSON[] = [];\n\n const initialSpans = processedEvent.spans;\n\n for (const span of initialSpans) {\n // 2.a If the child span should be ignored, reparent it to the root span\n if (\n ignoreSpans?.length &&\n shouldIgnoreSpan({ description: span.description, op: span.op, attributes: span.data }, ignoreSpans)\n ) {\n reparentChildSpans(initialSpans, span);\n continue;\n }\n\n // 2.b If a `beforeSendSpan` callback is defined, process the child span\n if (beforeSendSpan) {\n const processedSpan = beforeSendSpan(span);\n if (!processedSpan) {\n showSpanDropWarning();\n processedSpans.push(span);\n } else {\n processedSpans.push(processedSpan);\n }\n } else {\n processedSpans.push(span);\n }\n }\n\n const droppedSpans = processedEvent.spans.length - processedSpans.length;\n if (droppedSpans) {\n client.recordDroppedEvent('before_send', 'span', droppedSpans);\n }\n\n processedEvent.spans = processedSpans;\n }\n }\n\n if (beforeSendTransaction) {\n if (processedEvent.spans) {\n // We store the # of spans before processing in SDK metadata,\n // so we can compare it afterwards to determine how many spans were dropped\n const spanCountBefore = processedEvent.spans.length;\n processedEvent.sdkProcessingMetadata = {\n ...event.sdkProcessingMetadata,\n spanCountBeforeProcessing: spanCountBefore,\n };\n }\n return beforeSendTransaction(processedEvent as TransactionEvent, hint);\n }\n }\n\n return processedEvent;\n}\n\nfunction isErrorEvent(event: Event): event is ErrorEvent {\n return event.type === undefined;\n}\n\nfunction isTransactionEvent(event: Event): event is TransactionEvent {\n return event.type === 'transaction';\n}\n\n/**\n * Estimate the size of a metric in bytes.\n *\n * @param metric - The metric to estimate the size of.\n * @returns The estimated size of the metric in bytes.\n */\nfunction estimateMetricSizeInBytes(metric: Metric): number {\n let weight = 0;\n\n // Estimate byte size of 2 bytes per character. This is a rough estimate JS strings are stored as UTF-16.\n if (metric.name) {\n weight += metric.name.length * 2;\n }\n\n // Add weight for number\n weight += 8;\n\n return weight + estimateAttributesSizeInBytes(metric.attributes);\n}\n\n/**\n * Estimate the size of a log in bytes.\n *\n * @param log - The log to estimate the size of.\n * @returns The estimated size of the log in bytes.\n */\nfunction estimateLogSizeInBytes(log: Log): number {\n let weight = 0;\n\n // Estimate byte size of 2 bytes per character. This is a rough estimate JS strings are stored as UTF-16.\n if (log.message) {\n weight += log.message.length * 2;\n }\n\n return weight + estimateAttributesSizeInBytes(log.attributes);\n}\n\n/**\n * Estimate the size of attributes in bytes.\n *\n * @param attributes - The attributes object to estimate the size of.\n * @returns The estimated size of the attributes in bytes.\n */\nfunction estimateAttributesSizeInBytes(attributes: Record | undefined): number {\n if (!attributes) {\n return 0;\n }\n\n let weight = 0;\n\n Object.values(attributes).forEach(value => {\n if (Array.isArray(value)) {\n weight += value.length * estimatePrimitiveSizeInBytes(value[0]);\n } else if (isPrimitive(value)) {\n weight += estimatePrimitiveSizeInBytes(value);\n } else {\n // For objects values, we estimate the size of the object as 100 bytes\n weight += 100;\n }\n });\n\n return weight;\n}\n\nfunction estimatePrimitiveSizeInBytes(value: Primitive): number {\n if (typeof value === 'string') {\n return value.length * 2;\n } else if (typeof value === 'number') {\n return 8;\n } else if (typeof value === 'boolean') {\n return 4;\n }\n\n return 0;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAM,kBAAA,GAAqB,6DAAA;AAC3B,MAAM,iCAA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