import type { Span } from '@sentry/core';
import type { ServerResponse } from 'http';
/**
 * Wrap `res.end()` so that it ends the span and flushes events before letting the request finish.
 *
 * Note: This wraps a sync method with an async method. While in general that's not a great idea in terms of keeping
 * things in the right order, in this case it's safe, because the native `.end()` actually *is* (effectively) async, and
 * its run actually *is* (literally) awaited, just manually so (which reflects the fact that the core of the
 * request/response code in Node by far predates the introduction of `async`/`await`). When `.end()` is done, it emits
 * the `prefinish` event, and only once that fires does request processing continue. See
 * https://github.com/nodejs/node/commit/7c9b607048f13741173d397795bac37707405ba7.
 *
 * Also note: `res.end()` isn't called until *after* all response data and headers have been sent, so blocking inside of
 * `end` doesn't delay data getting to the end user. See
 * https://nodejs.org/api/http.html#responseenddata-encoding-callback.
 *
 * @param span The span tracking the request
 * @param res: The request's corresponding response
 */
export declare function autoEndSpanOnResponseEnd(span: Span, res: ServerResponse): void;
/** Finish the given response's span and set HTTP status data */
export declare function finishSpan(span: Span, res: ServerResponse): void;
/**
 * Flushes pending Sentry events with a 2 second timeout and in a way that cannot create unhandled promise rejections.
 */
export declare function flushSafelyWithTimeout(): Promise<void>;
/**
 * Uses platform-specific waitUntil function to wait for the provided task to complete without blocking.
 */
export declare function waitUntil(task: Promise<unknown>): void;
/**
 * Function that delays closing of a Cloudflare lambda until the provided promise is resolved.
 */
export declare function cloudflareWaitUntil(task: Promise<unknown>): void;
/**
 * Checks if the Cloudflare waitUntil function is available globally.
 */
export declare function isCloudflareWaitUntilAvailable(): boolean;
/**
 * Marks the async context strategy that `withSentry` of `@sentry/nextjs/cloudflare` installed. The mark is on the
 * strategy in the global carrier, because the Worker entry and the server build of Next.js each bundle their own copy
 * of `@sentry/nextjs`.
 */
export declare function markAsyncContextOwnedByNextjsCloudflare(): void;
/**
 * Whether `withSentry` of `@sentry/nextjs/cloudflare` set up the async context of this Worker, also outside a request.
 */
export declare function isAsyncContextOwnedByNextjsCloudflare(): boolean;
/**
 * Whether `withSentry` of `@sentry/nextjs/cloudflare` set up the async context of this Worker, or a request of
 * `withSentry` from `@sentry/cloudflare` runs. A client of `init` would then replace its async context strategy while
 * a request runs (#24603).
 */
export declare function isAsyncContextOwnedByCloudflare(): boolean;
/**
 * Sets the build release of `withSentryConfig` on the current client if it has none, and stores it for the clients
 * that `withSentry` of `@sentry/nextjs/cloudflare` creates later. Only code that Next.js compiles can read it.
 */
export declare function setCloudflareWorkerRelease(release: string | undefined): void;
//# sourceMappingURL=responseEnd.d.ts.map