import { env as cloudflareEnv, WorkerEntrypoint } from 'cloudflare:workers'; import { CloudflareOptions } from '../client'; export type WorkerEntrypointConstructor = new (ctx: ExecutionContext, env: typeof cloudflareEnv) => InstanceType>; /** * Instruments a WorkerEntrypoint class to capture errors and performance data. * * Instruments the following methods (same as `withSentry` for ExportedHandler): * - fetch (HTTP requests) * - scheduled (cron triggers) * - queue (queue consumers) * - email (email handlers) * - tail (tail workers) * * as well as any other public RPC methods on the WorkerEntrypoint instance. * * @param optionsCallback Function that returns the options for the SDK initialization. * @param WorkerEntrypointClass The WorkerEntrypoint class to instrument. * @returns The instrumented WorkerEntrypoint class. * * @example * ```ts * class MyWorkerBase extends WorkerEntrypoint { * async fetch(request: Request): Promise { * return new Response('Hello World!'); * } * * async myRpcMethod(arg: string): Promise { * return `Hello ${arg}!`; * } * } * * export default instrumentWorkerEntrypoint( * env => ({ * dsn: env.SENTRY_DSN, * tracesSampleRate: 1.0, * }), * MyWorkerBase, * ); * ``` */ export declare function instrumentWorkerEntrypoint(optionsCallback: (env: typeof cloudflareEnv) => CloudflareOptions | undefined, WorkerEntrypointClass: T): T; //# sourceMappingURL=instrumentWorkerEntrypoint.d.ts.map