//#region src/bindings/bindings.d.ts /** * Auto-instrumentation for Cloudflare Workers bindings * * Note: This file uses Cloudflare Workers types (KVNamespace, R2Bucket, D1Database, Fetcher, etc.) * which are globally available via @cloudflare/workers-types when listed in tsconfig.json. * These types are devDependencies only - they're not runtime dependencies. * At runtime, Cloudflare Workers runtime provides the actual implementations. * * This module provides automatic tracing for Cloudflare bindings: * - KV (key-value operations) * - R2 (object storage operations) * - D1 (database operations) * - Service Bindings * - Events Engine * - Workers AI * - Vectorize * - Hyperdrive */ /** * Instrument KV namespace */ declare function instrumentKV(kv: K, namespaceName?: string): K; /** * Instrument R2 bucket */ declare function instrumentR2(r2: R, bucketName?: string): R; /** * Instrument D1 database */ declare function instrumentD1(d1: D, databaseName?: string): D; /** * Instrument service binding (Fetcher) * * Unlike other bindings, Fetcher objects are native Cloudflare C++ bindings * whose methods throw "Illegal invocation" when called through a Proxy with * a different `this` reference. We work around this by calling `target.fetch()` * directly on the original binding instead of using `Reflect.apply` on a * detached function reference. */ declare function instrumentServiceBinding(fetcher: F, serviceName?: string): F; declare function instrumentBindings(env: Record): Record; //#endregion //#region src/bindings/ai.d.ts /** * Workers AI binding instrumentation */ /** * Instrument Workers AI binding */ declare function instrumentAI(ai: T, bindingName?: string): T; //#endregion //#region src/bindings/vectorize.d.ts /** * Vectorize binding instrumentation */ /** * Instrument Vectorize index binding */ declare function instrumentVectorize(vectorize: T, indexName?: string): T; //#endregion //#region src/bindings/hyperdrive.d.ts /** * Hyperdrive binding instrumentation */ /** * Instrument Hyperdrive binding */ declare function instrumentHyperdrive(hyperdrive: T, bindingName?: string): T; //#endregion //#region src/bindings/queue-producer.d.ts /** * Queue producer binding instrumentation */ /** * Instrument Queue producer binding */ declare function instrumentQueueProducer(queue: T, queueName?: string): T; //#endregion //#region src/bindings/analytics-engine.d.ts /** * Analytics Engine binding instrumentation */ /** * Instrument Analytics Engine binding */ declare function instrumentAnalyticsEngine(ae: T, datasetName?: string): T; //#endregion //#region src/bindings/images.d.ts /** * Images binding instrumentation * * The Images binding uses a fluent chain: input() -> transform() -> draw() -> output() * We only create a span at the terminal output() call to avoid intermediate noise. * info() is a standalone operation and gets its own span. */ interface ImagesLike { info(blob: ReadableStream | ArrayBuffer | Blob): Promise<{ width: number; height: number; format: string; }>; input(blob: ReadableStream | ArrayBuffer | Blob): ImageTransformerLike; } interface ImageTransformerLike { transform(options: unknown): ImageTransformerLike; draw(image: unknown, options?: unknown): ImageTransformerLike; output(options?: unknown): Promise; } interface ImageOutputLike { response(): Response; blob(): Promise; arrayBuffer(): Promise; } /** * Instrument Images binding */ declare function instrumentImages(images: T, bindingName?: string): T; //#endregion //#region src/bindings/rate-limiter.d.ts /** * Rate Limiter binding instrumentation */ interface RateLimiterLike { limit(options: { key: string; }): Promise<{ success: boolean; }>; } /** * Instrument Rate Limiter binding (manual only — not auto-detected) */ declare function instrumentRateLimiter(limiter: T, bindingName?: string): T; //#endregion //#region src/bindings/browser-rendering.d.ts /** * Browser Rendering binding instrumentation */ interface BrowserRenderingLike { fetch(input: RequestInfo | URL, init?: RequestInit): Promise; } /** * Instrument Browser Rendering binding (manual only — not auto-detected) */ declare function instrumentBrowserRendering(browser: T, bindingName?: string): T; //#endregion export { instrumentQueueProducer as a, instrumentAI as c, instrumentKV as d, instrumentR2 as f, instrumentAnalyticsEngine as i, instrumentBindings as l, instrumentRateLimiter as n, instrumentHyperdrive as o, instrumentServiceBinding as p, instrumentImages as r, instrumentVectorize as s, instrumentBrowserRendering as t, instrumentD1 as u }; //# sourceMappingURL=bindings-xEZcXo5r.d.ts.map