clone

nostr relays on demand at <name>.bind.ws: claim one with your key, pay in zaps past the free allowance

main
bindws / worker-configuration.d.ts
worker-configuration.d.ts 578.8K
1/* eslint-disable */2// Generated by Wrangler by running `wrangler types` (hash: 1fd8b1adbc960eef3ef448f16b146ad9)3// Runtime types generated with workerd@1.20260831.1 2026-08-01 nodejs_compat4interface __BaseEnv_Env {5 HOSTS: KVNamespace;6 MEDIA: R2Bucket;7 LEASE_LIMIT_IP: RateLimit;8 LEASE_LIMIT_ALL: RateLimit;9 DOMAIN: "bind.ws";10 DEV_RELAY: "dev";11 PUSH_CALLBACK_ORIGINS: "[]";12 ZONE_ID: "" | "491aaf5e1c12976e9828199686a81733";13 CNAME_TARGET: "customers.bind.ws";14 LIGHTNING_ADDRESS: "" | "bindws@getalby.com";15 SERVICE_PUBKEY: "" | "6b559c0816c3b9ec03c2f0cedb8a56efe83746f8c56e543e36e1973c04ef0384";16 FREE_EVENTS_MB: "100";17 FREE_MEDIA_MB: "1024";18 FREE_ACTIVE_HOURS: "100";19 FREE_ROWS_WRITTEN: "250000";20 SATS_PER_GB_MONTH_EVENTS: "400";21 SATS_PER_GB_MONTH_MEDIA: "30";22 SATS_PER_ACTIVE_HOUR: "11";23 SATS_PER_MILLION_ROWS: "2000";24 RELAY: DurableObjectNamespace<import("./src/index").Relay>;25}26declare namespace Cloudflare {27 interface GlobalProps {28 mainModule: typeof import("./src/index");29 durableNamespaces: "Relay";30 }31 interface DevEnv {32 HOSTS: KVNamespace;33 MEDIA: R2Bucket;34 LEASE_LIMIT_IP: RateLimit;35 LEASE_LIMIT_ALL: RateLimit;36 DOMAIN: "bind.ws";37 DEV_RELAY: "dev";38 PUSH_CALLBACK_ORIGINS: "[]";39 ZONE_ID: "";40 CNAME_TARGET: "customers.bind.ws";41 LIGHTNING_ADDRESS: "";42 SERVICE_PUBKEY: "";43 FREE_EVENTS_MB: "100";44 FREE_MEDIA_MB: "1024";45 FREE_ACTIVE_HOURS: "100";46 FREE_ROWS_WRITTEN: "250000";47 SATS_PER_GB_MONTH_EVENTS: "400";48 SATS_PER_GB_MONTH_MEDIA: "30";49 SATS_PER_ACTIVE_HOUR: "11";50 SATS_PER_MILLION_ROWS: "2000";51 RELAY: DurableObjectNamespace<import("./src/index").Relay>;52 }53 interface Env extends __BaseEnv_Env {}54}55interface Env extends __BaseEnv_Env {}56type StringifyValues<EnvType extends Record<string, unknown>> = {57 [Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;58};59declare namespace NodeJS {60 interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "DOMAIN" | "DEV_RELAY" | "PUSH_CALLBACK_ORIGINS" | "ZONE_ID" | "CNAME_TARGET" | "LIGHTNING_ADDRESS" | "SERVICE_PUBKEY" | "FREE_EVENTS_MB" | "FREE_MEDIA_MB" | "FREE_ACTIVE_HOURS" | "FREE_ROWS_WRITTEN" | "SATS_PER_GB_MONTH_EVENTS" | "SATS_PER_GB_MONTH_MEDIA" | "SATS_PER_ACTIVE_HOUR" | "SATS_PER_MILLION_ROWS">> {}61}6263// Begin runtime types64/*! *****************************************************************************65Copyright (c) Cloudflare. All rights reserved.66Copyright (c) Microsoft Corporation. All rights reserved.6768Licensed under the Apache License, Version 2.0 (the "License"); you may not use69this file except in compliance with the License. You may obtain a copy of the70License at http://www.apache.org/licenses/LICENSE-2.071THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY72KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED73WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,74MERCHANTABLITY OR NON-INFRINGEMENT.75See the Apache Version 2.0 License for specific language governing permissions76and limitations under the License.77***************************************************************************** */78/* eslint-disable */79// noinspection JSUnusedGlobalSymbols80declare var onmessage: never;81/**82 * The **`DOMException`** interface represents an abnormal event (called an exception) that occurs as a result of calling a method or accessing a property of a web API. This is how error conditions are described in web APIs.83 *84 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)85 */86declare class DOMException extends Error {87 constructor(message?: string, name?: string);88 /**89 * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.90 *91 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)92 */93 readonly message: string;94 /**95 * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.96 *97 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)98 */99 readonly name: string;100 /**101 * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.102 * @deprecated103 *104 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)105 */106 readonly code: number;107 static readonly INDEX_SIZE_ERR: number;108 static readonly DOMSTRING_SIZE_ERR: number;109 static readonly HIERARCHY_REQUEST_ERR: number;110 static readonly WRONG_DOCUMENT_ERR: number;111 static readonly INVALID_CHARACTER_ERR: number;112 static readonly NO_DATA_ALLOWED_ERR: number;113 static readonly NO_MODIFICATION_ALLOWED_ERR: number;114 static readonly NOT_FOUND_ERR: number;115 static readonly NOT_SUPPORTED_ERR: number;116 static readonly INUSE_ATTRIBUTE_ERR: number;117 static readonly INVALID_STATE_ERR: number;118 static readonly SYNTAX_ERR: number;119 static readonly INVALID_MODIFICATION_ERR: number;120 static readonly NAMESPACE_ERR: number;121 static readonly INVALID_ACCESS_ERR: number;122 static readonly VALIDATION_ERR: number;123 static readonly TYPE_MISMATCH_ERR: number;124 static readonly SECURITY_ERR: number;125 static readonly NETWORK_ERR: number;126 static readonly ABORT_ERR: number;127 static readonly URL_MISMATCH_ERR: number;128 static readonly QUOTA_EXCEEDED_ERR: number;129 static readonly TIMEOUT_ERR: number;130 static readonly INVALID_NODE_TYPE_ERR: number;131 static readonly DATA_CLONE_ERR: number;132 get stack(): any;133 set stack(value: any);134}135type WorkerGlobalScopeEventMap = {136 fetch: FetchEvent;137 scheduled: ScheduledEvent;138 queue: QueueEvent;139 unhandledrejection: PromiseRejectionEvent;140 rejectionhandled: PromiseRejectionEvent;141};142declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {143 EventTarget: typeof EventTarget;144}145/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *146 * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).147 *148 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)149 */150interface Console {151 "assert"(condition?: boolean, ...data: any[]): void;152 /**153 * The **`console.clear()`** static method clears the console if possible.154 *155 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)156 */157 clear(): void;158 /**159 * The **`console.count()`** static method logs the number of times that this particular call to count() has been called.160 *161 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)162 */163 count(label?: string): void;164 /**165 * The **`console.countReset()`** static method resets counter used with console.count().166 *167 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)168 */169 countReset(label?: string): void;170 /**171 * The **`console.debug()`** static method outputs a message to the console at the "debug" log level. The message is only displayed to the user if the console is configured to display debug output. In most cases, the log level is configured within the console UI. This log level might correspond to the Debug or Verbose log level.172 *173 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)174 */175 debug(...data: any[]): void;176 /**177 * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object. In browser consoles, the output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects.178 *179 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)180 */181 dir(item?: any, options?: any): void;182 /**183 * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element. If it is not possible to display as an element the JavaScript Object view is shown instead. The output is presented as a hierarchical listing of expandable nodes that let you see the contents of child nodes.184 *185 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)186 */187 dirxml(...data: any[]): void;188 /**189 * The **`console.error()`** static method outputs a message to the console at the "error" log level. The message is only displayed to the user if the console is configured to display error output. In most cases, the log level is configured within the console UI. The message may be formatted as an error, with red colors and call stack information.190 *191 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)192 */193 error(...data: any[]): void;194 /**195 * The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console.groupEnd() is called.196 *197 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)198 */199 group(...data: any[]): void;200 /**201 * The **`console.groupCollapsed()`** static method creates a new inline group in the console. Unlike console.group(), however, the new group is created collapsed. The user will need to use the disclosure button next to it to expand it, revealing the entries created in the group.202 *203 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)204 */205 groupCollapsed(...data: any[]): void;206 /**207 * The **`console.groupEnd()`** static method exits the current inline group in the console. See Using groups in the console in the console documentation for details and examples.208 *209 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)210 */211 groupEnd(): void;212 /**213 * The **`console.info()`** static method outputs a message to the console at the "info" log level. The message is only displayed to the user if the console is configured to display info output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as a small "i" icon next to it.214 *215 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)216 */217 info(...data: any[]): void;218 /**219 * The **`console.log()`** static method outputs a message to the console.220 *221 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)222 */223 log(...data: any[]): void;224 /**225 * The **`console.table()`** static method displays tabular data as a table.226 *227 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)228 */229 table(tabularData?: any, properties?: string[]): void;230 /**231 * The **`console.time()`** static method starts a timer you can use to track how long an operation takes. You give each timer a unique name, and may have up to 10,000 timers running on a given page. When you call console.timeEnd() with the same name, the browser will output the time, in milliseconds, that elapsed since the timer was started.232 *233 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)234 */235 time(label?: string): void;236 /**237 * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time().238 *239 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)240 */241 timeEnd(label?: string): void;242 /**243 * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time().244 *245 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)246 */247 timeLog(label?: string, ...data: any[]): void;248 /* The **`console.timeStamp()`** static method adds a single marker to the browser's Performance tool (Firefox bug 1387528, Chrome). This lets you correlate a point in your code with the other events recorded in the timeline, such as layout and paint events. */249 timeStamp(label?: string): void;250 /**251 * The **`console.trace()`** static method outputs a stack trace to the console.252 *253 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)254 */255 trace(...data: any[]): void;256 /**257 * The **`console.warn()`** static method outputs a warning message to the console at the "warning" log level. The message is only displayed to the user if the console is configured to display warning output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as yellow colors and a warning icon.258 *259 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)260 */261 warn(...data: any[]): void;262}263declare const console: Console;264type BufferSource = ArrayBufferView | ArrayBuffer;265type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;266declare namespace WebAssembly {267 class CompileError extends Error {268 constructor(message?: string);269 }270 class RuntimeError extends Error {271 constructor(message?: string);272 }273 type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128";274 interface GlobalDescriptor {275 value: ValueType;276 mutable?: boolean;277 }278 class Global {279 constructor(descriptor: GlobalDescriptor, value?: any);280 value: any;281 valueOf(): any;282 }283 type ImportValue = ExportValue | number;284 type ModuleImports = Record<string, ImportValue>;285 type Imports = Record<string, ModuleImports>;286 type ExportValue = Function | Global | Memory | Table;287 type Exports = Record<string, ExportValue>;288 class Instance {289 constructor(module: Module, imports?: Imports);290 readonly exports: Exports;291 }292 interface MemoryDescriptor {293 initial: number;294 maximum?: number;295 shared?: boolean;296 }297 class Memory {298 constructor(descriptor: MemoryDescriptor);299 readonly buffer: ArrayBuffer;300 grow(delta: number): number;301 }302 type ImportExportKind = "function" | "global" | "memory" | "table";303 interface ModuleExportDescriptor {304 kind: ImportExportKind;305 name: string;306 }307 interface ModuleImportDescriptor {308 kind: ImportExportKind;309 module: string;310 name: string;311 }312 abstract class Module {313 static customSections(module: Module, sectionName: string): ArrayBuffer[];314 static exports(module: Module): ModuleExportDescriptor[];315 static imports(module: Module): ModuleImportDescriptor[];316 }317 type TableKind = "anyfunc" | "externref";318 interface TableDescriptor {319 element: TableKind;320 initial: number;321 maximum?: number;322 }323 class Table {324 constructor(descriptor: TableDescriptor, value?: any);325 readonly length: number;326 get(index: number): any;327 grow(delta: number, value?: any): number;328 set(index: number, value?: any): void;329 }330 function instantiate(module: Module, imports?: Imports): Promise<Instance>;331 function validate(bytes: BufferSource): boolean;332}333/**334 * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.335 * Available only in secure contexts.336 *337 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)338 */339interface ServiceWorkerGlobalScope extends WorkerGlobalScope {340 DOMException: typeof DOMException;341 WorkerGlobalScope: typeof WorkerGlobalScope;342 btoa(data: string): string;343 atob(data: string): string;344 setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;345 setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;346 clearTimeout(timeoutId: number | null): void;347 setInterval(callback: (...args: any[]) => void, msDelay?: number): number;348 setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;349 clearInterval(timeoutId: number | null): void;350 queueMicrotask(task: Function): void;351 structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;352 reportError(error: any): void;353 fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;354 self: ServiceWorkerGlobalScope;355 crypto: Crypto;356 caches: CacheStorage;357 scheduler: Scheduler;358 performance: Performance;359 Cloudflare: Cloudflare;360 readonly origin: string;361 Event: typeof Event;362 ExtendableEvent: typeof ExtendableEvent;363 CustomEvent: typeof CustomEvent;364 PromiseRejectionEvent: typeof PromiseRejectionEvent;365 FetchEvent: typeof FetchEvent;366 TailEvent: typeof TailEvent;367 TraceEvent: typeof TailEvent;368 ScheduledEvent: typeof ScheduledEvent;369 MessageEvent: typeof MessageEvent;370 CloseEvent: typeof CloseEvent;371 ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;372 ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;373 ReadableStream: typeof ReadableStream;374 WritableStream: typeof WritableStream;375 WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;376 TransformStream: typeof TransformStream;377 ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;378 CountQueuingStrategy: typeof CountQueuingStrategy;379 ErrorEvent: typeof ErrorEvent;380 MessageChannel: typeof MessageChannel;381 MessagePort: typeof MessagePort;382 EventSource: typeof EventSource;383 ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;384 ReadableStreamDefaultController: typeof ReadableStreamDefaultController;385 ReadableByteStreamController: typeof ReadableByteStreamController;386 WritableStreamDefaultController: typeof WritableStreamDefaultController;387 TransformStreamDefaultController: typeof TransformStreamDefaultController;388 CompressionStream: typeof CompressionStream;389 DecompressionStream: typeof DecompressionStream;390 TextEncoderStream: typeof TextEncoderStream;391 TextDecoderStream: typeof TextDecoderStream;392 Headers: typeof Headers;393 Body: typeof Body;394 Request: typeof Request;395 Response: typeof Response;396 WebSocket: typeof WebSocket;397 WebSocketPair: typeof WebSocketPair;398 WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;399 AbortController: typeof AbortController;400 AbortSignal: typeof AbortSignal;401 TextDecoder: typeof TextDecoder;402 TextEncoder: typeof TextEncoder;403 navigator: Navigator;404 Navigator: typeof Navigator;405 URL: typeof URL;406 URLSearchParams: typeof URLSearchParams;407 URLPattern: typeof URLPattern;408 Blob: typeof Blob;409 File: typeof File;410 FormData: typeof FormData;411 Crypto: typeof Crypto;412 SubtleCrypto: typeof SubtleCrypto;413 CryptoKey: typeof CryptoKey;414 CacheStorage: typeof CacheStorage;415 Cache: typeof Cache;416 FixedLengthStream: typeof FixedLengthStream;417 IdentityTransformStream: typeof IdentityTransformStream;418 HTMLRewriter: typeof HTMLRewriter;419}420declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;421declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;422/**423 * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().424 *425 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)426 */427declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;428/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */429declare function btoa(data: string): string;430/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */431declare function atob(data: string): string;432/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */433declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;434/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */435declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;436/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */437declare function clearTimeout(timeoutId: number | null): void;438/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */439declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;440/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */441declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;442/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */443declare function clearInterval(timeoutId: number | null): void;444/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */445declare function queueMicrotask(task: Function): void;446/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */447declare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;448/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */449declare function reportError(error: any): void;450/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */451declare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;452declare const self: ServiceWorkerGlobalScope;453/**454* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.455* The Workers runtime implements the full surface of this API, but with some differences in456* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)457* compared to those implemented in most browsers.458*459* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)460*/461declare const crypto: Crypto;462/**463* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.464*465* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)466*/467declare const caches: CacheStorage;468/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scheduler) */469declare const scheduler: Scheduler;470/**471* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,472* as well as timing of subrequests and other operations.473*474* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)475*/476declare const performance: Performance;477declare const Cloudflare: Cloudflare;478declare const origin: string;479declare const navigator: Navigator;480interface TestController {481}482interface ExecutionContext<Props = unknown> {483 waitUntil(promise: Promise<any>): void;484 passThroughOnException(): void;485 readonly exports: Cloudflare.Exports;486 readonly props: Props;487 cache?: CacheContext;488 readonly access?: CloudflareAccessContext;489 tracing: Tracing;490 abort(reason?: any): void;491}492type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;493type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;494type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;495type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;496type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;497type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;498type ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;499type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;500interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {501 fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;502 connect?: ExportedHandlerConnectHandler<Env, Props>;503 tail?: ExportedHandlerTailHandler<Env, Props>;504 trace?: ExportedHandlerTraceHandler<Env, Props>;505 tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;506 scheduled?: ExportedHandlerScheduledHandler<Env, Props>;507 test?: ExportedHandlerTestHandler<Env, Props>;508 email?: EmailExportedHandler<Env, Props>;509 queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;510}511interface StructuredSerializeOptions {512 transfer?: any[];513}514declare abstract class Navigator {515 sendBeacon(url: string, body?: BodyInit): boolean;516 readonly userAgent: string;517 readonly hardwareConcurrency: number;518 readonly platform: string;519 readonly language: string;520 readonly languages: string[];521}522interface AlarmInvocationInfo {523 readonly isRetry: boolean;524 readonly retryCount: number;525 readonly scheduledTime: number;526}527interface Cloudflare {528 readonly compatibilityFlags: Record<string, boolean>;529}530interface CachePurgeError {531 code: number;532 message: string;533}534interface CachePurgeResult {535 success: boolean;536 errors: CachePurgeError[];537}538interface CachePurgeOptions {539 tags?: string[];540 pathPrefixes?: string[];541 purgeEverything?: boolean;542}543interface CacheContext {544 purge(options: CachePurgeOptions): Promise<CachePurgeResult>;545}546interface CloudflareAccessContext {547 readonly aud: string;548 getIdentity(): Promise<CloudflareAccessIdentity | undefined>;549}550declare abstract class ColoLocalActorNamespace {551 get(actorId: string): Fetcher;552}553interface DurableObject {554 fetch(request: Request): Response | Promise<Response>;555 connect?(socket: Socket): void | Promise<void>;556 alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;557 webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;558 webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;559 webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;560}561type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"> & {562 readonly id: DurableObjectId;563 readonly name?: string;564};565interface DurableObjectId {566 toString(): string;567 equals(other: DurableObjectId): boolean;568 readonly name?: string;569 readonly jurisdiction?: string;570}571declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {572 newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;573 idFromName(name: string): DurableObjectId;574 idFromString(id: string): DurableObjectId;575 get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;576 getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;577 jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;578}579type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";580interface DurableObjectNamespaceNewUniqueIdOptions {581 jurisdiction?: DurableObjectJurisdiction;582}583type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "apac-ne" | "apac-se" | "oc" | "afr" | "me";584type DurableObjectRoutingMode = "primary-only";585interface DurableObjectNamespaceGetDurableObjectOptions {586 locationHint?: DurableObjectLocationHint;587 routingMode?: DurableObjectRoutingMode;588}589interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {590}591interface DurableObjectState<Props = unknown> {592 waitUntil(promise: Promise<any>): void;593 readonly exports: Cloudflare.Exports;594 readonly props: Props;595 readonly id: DurableObjectId;596 readonly storage: DurableObjectStorage;597 container?: Container;598 facets: DurableObjectFacets;599 blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;600 acceptWebSocket(ws: WebSocket, tags?: string[]): void;601 getWebSockets(tag?: string): WebSocket[];602 setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;603 getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;604 getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;605 setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;606 getHibernatableWebSocketEventTimeout(): number | null;607 getTags(ws: WebSocket): string[];608 abort(reason?: string, options?: DurableObjectAbortOptions): void;609}610interface DurableObjectTransaction {611 get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;612 get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;613 list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;614 put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;615 put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;616 delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;617 delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;618 rollback(): void;619 getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;620 setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;621 deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;622}623interface DurableObjectStorage {624 get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;625 get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;626 list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;627 put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;628 put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;629 delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;630 delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;631 deleteAll(options?: DurableObjectPutOptions): Promise<void>;632 transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;633 getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;634 setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;635 deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;636 sync(): Promise<void>;637 sql: SqlStorage;638 kv: SyncKvStorage;639 transactionSync<T>(closure: () => T): T;640 getCurrentBookmark(): Promise<string>;641 getBookmarkForTime(timestamp: number | Date): Promise<string>;642 onNextSessionRestoreBookmark(bookmark: string): Promise<string>;643}644interface DurableObjectAbortOptions {645 retryAlarm?: boolean;646}647interface DurableObjectListOptions {648 start?: string;649 startAfter?: string;650 end?: string;651 prefix?: string;652 reverse?: boolean;653 limit?: number;654 allowConcurrency?: boolean;655 noCache?: boolean;656}657interface DurableObjectGetOptions {658 allowConcurrency?: boolean;659 noCache?: boolean;660}661interface DurableObjectGetAlarmOptions {662 allowConcurrency?: boolean;663}664interface DurableObjectPutOptions {665 allowConcurrency?: boolean;666 allowUnconfirmed?: boolean;667 noCache?: boolean;668}669interface DurableObjectSetAlarmOptions {670 allowConcurrency?: boolean;671 allowUnconfirmed?: boolean;672}673declare class WebSocketRequestResponsePair {674 constructor(request: string, response: string);675 get request(): string;676 get response(): string;677}678interface DurableObjectFacets {679 get<T extends Rpc.DurableObjectBranded | undefined = undefined>(name: string, getStartupOptions: () => FacetStartupOptions<T> | Promise<FacetStartupOptions<T>>): Fetcher<T>;680 abort(name: string, reason: any): void;681 delete(name: string): void;682 clone(src: string, dst: string): void;683}684interface FacetStartupOptions<T extends Rpc.DurableObjectBranded | undefined = undefined> {685 id?: DurableObjectId | string;686 class: DurableObjectClass<T>;687}688interface AnalyticsEngineDataset {689 writeDataPoint(event?: AnalyticsEngineDataPoint): void;690}691interface AnalyticsEngineDataPoint {692 indexes?: ((ArrayBuffer | string) | null)[];693 doubles?: number[];694 blobs?: ((ArrayBuffer | string) | null)[];695}696/**697 * The **`Event`** interface represents an event which takes place on an EventTarget.698 *699 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)700 */701declare class Event {702 constructor(type: string, init?: EventInit);703 /**704 * The **`type`** read-only property of the Event interface returns a string containing the event's type. It is set when the event is constructed and is the name commonly used to refer to the specific event, such as click, load, or error.705 *706 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)707 */708 get type(): string;709 /**710 * The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.711 *712 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)713 */714 get eventPhase(): number;715 /**716 * The read-only **`composed`** property of the Event interface returns a boolean value which indicates whether or not the event will propagate across the shadow DOM boundary into the standard DOM.717 *718 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)719 */720 get composed(): boolean;721 /**722 * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.723 *724 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)725 */726 get bubbles(): boolean;727 /**728 * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.729 *730 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)731 */732 get cancelable(): boolean;733 /**734 * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.735 *736 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)737 */738 get defaultPrevented(): boolean;739 /**740 * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.741 * @deprecated742 *743 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)744 */745 get returnValue(): boolean;746 /**747 * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.748 *749 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)750 */751 get currentTarget(): EventTarget | undefined;752 /**753 * The read-only **`target`** property of the Event interface is a reference to the object onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event.754 *755 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)756 */757 get target(): EventTarget | undefined;758 /**759 * The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.760 * @deprecated761 *762 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)763 */764 get srcElement(): EventTarget | undefined;765 /**766 * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.767 *768 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)769 */770 get timeStamp(): number;771 /**772 * The **`isTrusted`** read-only property of the Event interface is a boolean value that is true when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and false when the event was dispatched via EventTarget.dispatchEvent(). The only exception is the click event, which initializes the isTrusted property to false in user agents.773 *774 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)775 */776 get isTrusted(): boolean;777 /**778 * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details.779 * @deprecated780 *781 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)782 */783 get cancelBubble(): boolean;784 /**785 * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details.786 * @deprecated787 *788 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)789 */790 set cancelBubble(value: boolean);791 /**792 * The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.793 *794 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)795 */796 stopImmediatePropagation(): void;797 /**798 * The **`preventDefault()`** method of the Event interface tells the user agent that the event is being explicitly handled, so its default action, such as page scrolling, link navigation, or pasting text, should not be taken.799 *800 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)801 */802 preventDefault(): void;803 /**804 * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault() method. It also does not prevent propagation to other event-handlers of the current element. If you want to stop those, see stopImmediatePropagation().805 *806 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)807 */808 stopPropagation(): void;809 /**810 * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked. This does not include nodes in shadow trees if the shadow root was created with its ShadowRoot.mode closed.811 *812 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)813 */814 composedPath(): EventTarget[];815 static readonly NONE: number;816 static readonly CAPTURING_PHASE: number;817 static readonly AT_TARGET: number;818 static readonly BUBBLING_PHASE: number;819}820interface EventInit {821 bubbles?: boolean;822 cancelable?: boolean;823 composed?: boolean;824}825type EventListener<EventType extends Event = Event> = (event: EventType) => void;826interface EventListenerObject<EventType extends Event = Event> {827 handleEvent(event: EventType): void;828}829type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;830/**831 * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them. In other words, any target of events implements the three methods associated with this interface.832 *833 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)834 */835declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {836 constructor();837 /**838 * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.839 *840 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)841 */842 addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;843 /**844 * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.845 *846 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)847 */848 removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;849 /**850 * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().851 *852 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)853 */854 dispatchEvent(event: EventMap[keyof EventMap]): boolean;855}856interface EventTargetEventListenerOptions {857 capture?: boolean;858}859interface EventTargetAddEventListenerOptions {860 capture?: boolean;861 passive?: boolean;862 once?: boolean;863 signal?: AbortSignal;864}865interface EventTargetHandlerObject {866 handleEvent: (event: Event) => any | undefined;867}868/**869 * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.870 *871 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)872 */873declare class AbortController {874 constructor();875 /**876 * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.877 *878 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)879 */880 get signal(): AbortSignal;881 /**882 * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed. This is able to abort fetch requests, the consumption of any response bodies, or streams.883 *884 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)885 */886 abort(reason?: any): void;887}888/**889 * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.890 *891 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)892 */893declare abstract class AbortSignal extends EventTarget {894 /**895 * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an abort event).896 *897 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)898 */899 static abort(reason?: any): AbortSignal;900 /**901 * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.902 *903 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)904 */905 static timeout(delay: number): AbortSignal;906 /**907 * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal. The returned abort signal is aborted when any of the input iterable abort signals are aborted. The abort reason will be set to the reason of the first signal that is aborted. If any of the given abort signals are already aborted then so will be the returned AbortSignal.908 *909 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)910 */911 static any(signals: AbortSignal[]): AbortSignal;912 /**913 * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (true) or not (false).914 *915 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)916 */917 get aborted(): boolean;918 /**919 * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.920 *921 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)922 */923 get reason(): any;924 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */925 get onabort(): any | null;926 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */927 set onabort(value: any | null);928 /**929 * The **`throwIfAborted()`** method throws the signal's abort reason if the signal has been aborted; otherwise it does nothing.930 *931 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)932 */933 throwIfAborted(): void;934}935/**936 * The **`Scheduler`** interface of the Prioritized Task Scheduling API provides methods for scheduling prioritized tasks.937 *938 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Scheduler)939 */940interface Scheduler {941 wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;942}943interface SchedulerWaitOptions {944 signal?: AbortSignal;945}946/**947 * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.948 *949 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)950 */951declare abstract class ExtendableEvent extends Event {952 /**953 * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.954 *955 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)956 */957 waitUntil(promise: Promise<any>): void;958}959/**960 * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.961 *962 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)963 */964declare class CustomEvent<T = any> extends Event {965 constructor(type: string, init?: CustomEventCustomEventInit);966 /**967 * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.968 *969 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)970 */971 get detail(): T;972}973interface CustomEventCustomEventInit {974 bubbles?: boolean;975 cancelable?: boolean;976 composed?: boolean;977 detail?: any;978}979/**980 * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.981 *982 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)983 */984declare class Blob {985 constructor(bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);986 /**987 * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.988 *989 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)990 */991 get size(): number;992 /**993 * The **`type`** read-only property of the Blob interface returns the MIME type of the file.994 *995 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)996 */997 get type(): string;998 /**999 * The **`slice()`** method of the Blob interface creates and returns a new Blob object which contains data from a subset of the blob on which it's called.1000 *1001 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)1002 */1003 slice(start?: number, end?: number, type?: string): Blob;1004 /**1005 * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.1006 *1007 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)1008 */1009 arrayBuffer(): Promise<ArrayBuffer>;1010 /**1011 * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.1012 *1013 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)1014 */1015 bytes(): Promise<Uint8Array>;1016 /**1017 * The **`text()`** method of the Blob interface returns a Promise that resolves with a string containing the contents of the blob, interpreted as UTF-8.1018 *1019 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)1020 */1021 text(): Promise<string>;1022 /**1023 * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob.1024 *1025 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)1026 */1027 stream(): ReadableStream;1028}1029interface BlobOptions {1030 type?: string;1031}1032/**1033 * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.1034 *1035 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)1036 */1037declare class File extends Blob {1038 constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);1039 /**1040 * The **`name`** read-only property of the File interface returns the name of the file represented by a File object. For security reasons, the path is excluded from this property.1041 *1042 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)1043 */1044 get name(): string;1045 /**1046 * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.1047 *1048 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)1049 */1050 get lastModified(): number;1051}1052interface FileOptions {1053 type?: string;1054 lastModified?: number;1055}1056/**1057* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.1058*1059* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)1060*/1061declare abstract class CacheStorage {1062 /**1063 * The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.1064 *1065 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)1066 */1067 open(cacheName: string): Promise<Cache>;1068 readonly default: Cache;1069}1070/**1071* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.1072*1073* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)1074*/1075declare abstract class Cache {1076 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */1077 delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;1078 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */1079 match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;1080 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */1081 put(request: RequestInfo | URL, response: Response): Promise<void>;1082}1083interface CacheQueryOptions {1084 ignoreMethod?: boolean;1085}1086/**1087* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.1088* The Workers runtime implements the full surface of this API, but with some differences in1089* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)1090* compared to those implemented in most browsers.1091*1092* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)1093*/1094declare abstract class Crypto {1095 /**1096 * The **`Crypto.subtle`** read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations.1097 * Available only in secure contexts.1098 *1099 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)1100 */1101 get subtle(): SubtleCrypto;1102 /**1103 * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values. The array given as the parameter is filled with random numbers (random in its cryptographic meaning).1104 *1105 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)1106 */1107 getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;1108 /**1109 * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.1110 * Available only in secure contexts.1111 *1112 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)1113 */1114 randomUUID(): string;1115 DigestStream: typeof DigestStream;1116}1117/**1118 * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.1119 * Available only in secure contexts.1120 *1121 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)1122 */1123declare abstract class SubtleCrypto {1124 /**1125 * The **`encrypt()`** method of the SubtleCrypto interface encrypts data.1126 *1127 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)1128 */1129 encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1130 /**1131 * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data. It takes as arguments a key to decrypt with, some optional extra parameters, and the data to decrypt (also known as "ciphertext"). It returns a Promise which will be fulfilled with the decrypted data (also known as "plaintext").1132 *1133 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)1134 */1135 decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1136 /**1137 * The **`sign()`** method of the SubtleCrypto interface generates a digital signature.1138 *1139 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)1140 */1141 sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1142 /**1143 * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.1144 *1145 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)1146 */1147 verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;1148 /**1149 * The **`digest()`** method of the SubtleCrypto interface generates a digest of the given data, using the specified hash function. A digest is a short fixed-length value derived from some variable-length input. Cryptographic digests should exhibit collision-resistance, meaning that it's hard to come up with two different inputs that have the same digest value.1150 *1151 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)1152 */1153 digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1154 /**1155 * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).1156 *1157 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)1158 */1159 generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;1160 /**1161 * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.1162 *1163 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)1164 */1165 deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;1166 /**1167 * The **`deriveBits()`** method of the SubtleCrypto interface can be used to derive an array of bits from a base key.1168 *1169 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)1170 */1171 deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;1172 /**1173 * The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.1174 *1175 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)1176 */1177 importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;1178 /**1179 * The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.1180 *1181 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)1182 */1183 exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;1184 /**1185 * The **`wrapKey()`** method of the SubtleCrypto interface "wraps" a key. This means that it exports the key in an external, portable format, then encrypts the exported key. Wrapping a key helps protect it in untrusted environments, such as inside an otherwise unprotected data store or in transmission over an unprotected network.1186 *1187 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)1188 */1189 wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;1190 /**1191 * The **`unwrapKey()`** method of the SubtleCrypto interface "unwraps" a key. This means that it takes as its input a key that has been exported and then encrypted (also called "wrapped"). It decrypts the key and then imports it, returning a CryptoKey object that can be used in the Web Crypto API.1192 *1193 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)1194 */1195 unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;1196 timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;1197}1198/**1199 * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods generateKey(), deriveKey(), importKey(), or unwrapKey().1200 * Available only in secure contexts.1201 *1202 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)1203 */1204declare abstract class CryptoKey {1205 /**1206 * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object. It can have the following values:1207 *1208 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)1209 */1210 readonly type: string;1211 /**1212 * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using SubtleCrypto.exportKey() or SubtleCrypto.wrapKey().1213 *1214 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)1215 */1216 readonly extractable: boolean;1217 /**1218 * The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.1219 *1220 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)1221 */1222 readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;1223 /**1224 * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.1225 *1226 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)1227 */1228 readonly usages: string[];1229}1230interface CryptoKeyPair {1231 publicKey: CryptoKey;1232 privateKey: CryptoKey;1233}1234interface JsonWebKey {1235 kty: string;1236 use?: string;1237 key_ops?: string[];1238 alg?: string;1239 ext?: boolean;1240 crv?: string;1241 x?: string;1242 y?: string;1243 d?: string;1244 n?: string;1245 e?: string;1246 p?: string;1247 q?: string;1248 dp?: string;1249 dq?: string;1250 qi?: string;1251 oth?: RsaOtherPrimesInfo[];1252 k?: string;1253}1254interface RsaOtherPrimesInfo {1255 r?: string;1256 d?: string;1257 t?: string;1258}1259interface SubtleCryptoDeriveKeyAlgorithm {1260 name: string;1261 salt?: (ArrayBuffer | ArrayBufferView);1262 iterations?: number;1263 hash?: (string | SubtleCryptoHashAlgorithm);1264 $public?: CryptoKey;1265 info?: (ArrayBuffer | ArrayBufferView);1266}1267interface SubtleCryptoEncryptAlgorithm {1268 name: string;1269 iv?: (ArrayBuffer | ArrayBufferView);1270 additionalData?: (ArrayBuffer | ArrayBufferView);1271 tagLength?: number;1272 counter?: (ArrayBuffer | ArrayBufferView);1273 length?: number;1274 label?: (ArrayBuffer | ArrayBufferView);1275}1276interface SubtleCryptoGenerateKeyAlgorithm {1277 name: string;1278 hash?: (string | SubtleCryptoHashAlgorithm);1279 modulusLength?: number;1280 publicExponent?: (ArrayBuffer | ArrayBufferView);1281 length?: number;1282 namedCurve?: string;1283}1284interface SubtleCryptoHashAlgorithm {1285 name: string;1286}1287interface SubtleCryptoImportKeyAlgorithm {1288 name: string;1289 hash?: (string | SubtleCryptoHashAlgorithm);1290 length?: number;1291 namedCurve?: string;1292 compressed?: boolean;1293}1294interface SubtleCryptoSignAlgorithm {1295 name: string;1296 hash?: (string | SubtleCryptoHashAlgorithm);1297 dataLength?: number;1298 saltLength?: number;1299}1300interface CryptoKeyKeyAlgorithm {1301 name: string;1302}1303interface CryptoKeyAesKeyAlgorithm {1304 name: string;1305 length: number;1306}1307interface CryptoKeyHmacKeyAlgorithm {1308 name: string;1309 hash: CryptoKeyKeyAlgorithm;1310 length: number;1311}1312interface CryptoKeyRsaKeyAlgorithm {1313 name: string;1314 modulusLength: number;1315 publicExponent: ArrayBuffer | ArrayBufferView;1316 hash?: CryptoKeyKeyAlgorithm;1317}1318interface CryptoKeyEllipticKeyAlgorithm {1319 name: string;1320 namedCurve: string;1321}1322interface CryptoKeyArbitraryKeyAlgorithm {1323 name: string;1324 hash?: CryptoKeyKeyAlgorithm;1325 namedCurve?: string;1326 length?: number;1327}1328declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {1329 constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);1330 readonly digest: Promise<ArrayBuffer>;1331 get bytesWritten(): number | bigint;1332}1333interface DigestStreamOptions {1334 toWellFormed?: boolean;1335}1336/**1337 * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as UTF-8, ISO-8859-2, or GBK. A decoder takes an array of bytes as input and returns a JavaScript string.1338 *1339 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)1340 */1341declare class TextDecoder {1342 constructor(label?: string, options?: TextDecoderConstructorOptions);1343 /**1344 * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.1345 *1346 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)1347 */1348 decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string;1349 get encoding(): string;1350 get fatal(): boolean;1351 get ignoreBOM(): boolean;1352}1353/**1354 * The **`TextEncoder`** interface enables you to encode a JavaScript string using UTF-8.1355 *1356 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)1357 */1358declare class TextEncoder {1359 constructor();1360 /**1361 * The **`TextEncoder.encode()`** method takes a string as input, and returns a Uint8Array containing the string encoded using UTF-8.1362 *1363 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)1364 */1365 encode(input?: string): Uint8Array;1366 /**1367 * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns an object indicating the progress of the encoding. This is potentially more performant than the encode() method — especially when the target buffer is a view into a Wasm heap.1368 *1369 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)1370 */1371 encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;1372 get encoding(): string;1373}1374interface TextDecoderConstructorOptions {1375 fatal: boolean;1376 ignoreBOM: boolean;1377}1378interface TextDecoderDecodeOptions {1379 stream: boolean;1380}1381interface TextEncoderEncodeIntoResult {1382 read: number;1383 written: number;1384}1385/**1386 * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.1387 *1388 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)1389 */1390declare class ErrorEvent extends Event {1391 constructor(type: string, init?: ErrorEventErrorEventInit);1392 /**1393 * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.1394 *1395 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)1396 */1397 get filename(): string;1398 /**1399 * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.1400 *1401 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)1402 */1403 get message(): string;1404 /**1405 * The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.1406 *1407 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)1408 */1409 get lineno(): number;1410 /**1411 * The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred.1412 *1413 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)1414 */1415 get colno(): number;1416 /**1417 * The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.1418 *1419 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)1420 */1421 get error(): any;1422}1423interface ErrorEventErrorEventInit {1424 bubbles?: boolean;1425 cancelable?: boolean;1426 composed?: boolean;1427 message?: string;1428 filename?: string;1429 lineno?: number;1430 colno?: number;1431 error?: any;1432}1433/**1434 * The **`MessageEvent`** interface represents a message received by a target object.1435 *1436 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)1437 */1438declare class MessageEvent extends Event {1439 constructor(type: string, initializer?: MessageEventInit);1440 /**1441 * The **`data`** read-only property of the MessageEvent interface represents the data sent by the message emitter.1442 *1443 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)1444 */1445 readonly data: any;1446 /**1447 * The **`origin`** read-only property of the MessageEvent interface is a string representing the origin of the message emitter.1448 *1449 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)1450 */1451 readonly origin: string | null;1452 /**1453 * The **`lastEventId`** read-only property of the MessageEvent interface is a string representing a unique ID for the event.1454 *1455 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)1456 */1457 readonly lastEventId: string;1458 /**1459 * The **`source`** read-only property of the MessageEvent interface is a MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter.1460 *1461 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)1462 */1463 readonly source: MessagePort | null;1464 /**1465 * The **`ports`** read-only property of the MessageEvent interface is an array of MessagePort objects containing all MessagePort objects sent with the message, in order.1466 *1467 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)1468 */1469 readonly ports: MessagePort[];1470}1471interface MessageEventInit {1472 bubbles?: boolean;1473 cancelable?: boolean;1474 composed?: boolean;1475 data?: any;1476 origin?: string;1477 lastEventId?: string;1478 source?: MessagePort;1479 ports?: MessagePort[];1480}1481/**1482 * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected. These events are particularly useful for telemetry and debugging purposes.1483 *1484 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)1485 */1486declare abstract class PromiseRejectionEvent extends Event {1487 /**1488 * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript Promise which was rejected. You can examine the event's PromiseRejectionEvent.reason property to learn why the promise was rejected.1489 *1490 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)1491 */1492 readonly promise: Promise<any>;1493 /**1494 * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). This in theory provides information about why the promise was rejected.1495 *1496 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)1497 */1498 readonly reason: any;1499}1500/**1501 * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data".1502 *1503 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)1504 */1505declare class FormData {1506 constructor();1507 /**1508 * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.1509 *1510 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)1511 */1512 append(name: string, value: string | Blob): void;1513 /**1514 * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.1515 *1516 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)1517 */1518 append(name: string, value: string): void;1519 /**1520 * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.1521 *1522 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)1523 */1524 append(name: string, value: Blob, filename?: string): void;1525 /**1526 * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a FormData object.1527 *1528 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)1529 */1530 delete(name: string): void;1531 /**1532 * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a FormData object. If you expect multiple values and want all of them, use the getAll() method instead.1533 *1534 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)1535 */1536 get(name: string): (File | string) | null;1537 /**1538 * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a FormData object.1539 *1540 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)1541 */1542 getAll(name: string): (File | string)[];1543 /**1544 * The **`has()`** method of the FormData interface returns whether a FormData object contains a certain key.1545 *1546 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)1547 */1548 has(name: string): boolean;1549 /**1550 * The **`set()`** method of the FormData interface sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.1551 *1552 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)1553 */1554 set(name: string, value: string | Blob): void;1555 /**1556 * The **`set()`** method of the FormData interface sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.1557 *1558 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)1559 */1560 set(name: string, value: string): void;1561 /**1562 * The **`set()`** method of the FormData interface sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.1563 *1564 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)1565 */1566 set(name: string, value: Blob, filename?: string): void;1567 entries(): IterableIterator<[1568 key: string,1569 value: File | string1570 ]>;1571 keys(): IterableIterator<string>;1572 values(): IterableIterator<(File | string)>;1573 forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;1574 [Symbol.iterator](): IterableIterator<[1575 key: string,1576 value: File | string1577 ]>;1578}1579interface ContentOptions {1580 html?: boolean;1581}1582declare class HTMLRewriter {1583 constructor();1584 on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;1585 onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;1586 transform(response: Response): Response;1587}1588interface HTMLRewriterElementContentHandlers {1589 element?(element: Element): void | Promise<void>;1590 comments?(comment: Comment): void | Promise<void>;1591 text?(element: Text): void | Promise<void>;1592}1593interface HTMLRewriterDocumentContentHandlers {1594 doctype?(doctype: Doctype): void | Promise<void>;1595 comments?(comment: Comment): void | Promise<void>;1596 text?(text: Text): void | Promise<void>;1597 end?(end: DocumentEnd): void | Promise<void>;1598}1599interface Doctype {1600 readonly name: string | null;1601 readonly publicId: string | null;1602 readonly systemId: string | null;1603}1604interface Element {1605 tagName: string;1606 readonly attributes: IterableIterator<string[]>;1607 readonly removed: boolean;1608 readonly namespaceURI: string;1609 getAttribute(name: string): string | null;1610 hasAttribute(name: string): boolean;1611 setAttribute(name: string, value: string): Element;1612 removeAttribute(name: string): Element;1613 before(content: string | ReadableStream | Response, options?: ContentOptions): Element;1614 after(content: string | ReadableStream | Response, options?: ContentOptions): Element;1615 prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;1616 append(content: string | ReadableStream | Response, options?: ContentOptions): Element;1617 replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;1618 remove(): Element;1619 removeAndKeepContent(): Element;1620 setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;1621 onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;1622}1623interface EndTag {1624 name: string;1625 before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;1626 after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;1627 remove(): EndTag;1628}1629interface Comment {1630 text: string;1631 readonly removed: boolean;1632 before(content: string, options?: ContentOptions): Comment;1633 after(content: string, options?: ContentOptions): Comment;1634 replace(content: string, options?: ContentOptions): Comment;1635 remove(): Comment;1636}1637interface Text {1638 readonly text: string;1639 readonly lastInTextNode: boolean;1640 readonly removed: boolean;1641 before(content: string | ReadableStream | Response, options?: ContentOptions): Text;1642 after(content: string | ReadableStream | Response, options?: ContentOptions): Text;1643 replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;1644 remove(): Text;1645}1646interface DocumentEnd {1647 append(content: string, options?: ContentOptions): DocumentEnd;1648}1649/**1650 * This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.1651 *1652 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)1653 */1654declare abstract class FetchEvent extends ExtendableEvent {1655 /**1656 * The **`request`** read-only property of the FetchEvent interface returns the Request that triggered the event handler.1657 *1658 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)1659 */1660 readonly request: Request;1661 /**1662 * The **`respondWith()`** method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself.1663 *1664 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)1665 */1666 respondWith(promise: Response | Promise<Response>): void;1667 passThroughOnException(): void;1668}1669type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;1670/**1671 * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing headers from the list of the request's headers.1672 *1673 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)1674 */1675declare class Headers {1676 constructor(init?: HeadersInit);1677 /**1678 * The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a Headers object with a given name. If the requested header doesn't exist in the Headers object, it returns null.1679 *1680 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)1681 */1682 get(name: string): string | null;1683 getAll(name: string): string[];1684 /**1685 * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response. This allows Headers objects to handle having multiple Set-Cookie headers, which wasn't possible prior to its implementation.1686 *1687 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)1688 */1689 getSetCookie(): string[];1690 /**1691 * The **`has()`** method of the Headers interface returns a boolean stating whether a Headers object contains a certain header.1692 *1693 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)1694 */1695 has(name: string): boolean;1696 /**1697 * The **`set()`** method of the Headers interface sets a new value for an existing header inside a Headers object, or adds the header if it does not already exist.1698 *1699 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)1700 */1701 set(name: string, value: string): void;1702 /**1703 * The **`append()`** method of the Headers interface appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist.1704 *1705 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)1706 */1707 append(name: string, value: string): void;1708 /**1709 * The **`delete()`** method of the Headers interface deletes a header from the current Headers object.1710 *1711 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)1712 */1713 delete(name: string): void;1714 forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;1715 entries(): IterableIterator<[1716 key: string,1717 value: string1718 ]>;1719 keys(): IterableIterator<string>;1720 values(): IterableIterator<string>;1721 [Symbol.iterator](): IterableIterator<[1722 key: string,1723 value: string1724 ]>;1725}1726type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;1727declare abstract class Body {1728 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */1729 get body(): ReadableStream | null;1730 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */1731 get bodyUsed(): boolean;1732 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */1733 arrayBuffer(): Promise<ArrayBuffer>;1734 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */1735 bytes(): Promise<Uint8Array>;1736 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */1737 text(): Promise<string>;1738 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */1739 json<T>(): Promise<T>;1740 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */1741 formData(): Promise<FormData>;1742 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */1743 blob(): Promise<Blob>;1744}1745/**1746 * The **`Response`** interface of the Fetch API represents the response to a request.1747 *1748 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)1749 */1750declare var Response: {1751 prototype: Response;1752 new (body?: BodyInit | null, init?: ResponseInit): Response;1753 error(): Response;1754 redirect(url: string, status?: number): Response;1755 json(any: any, maybeInit?: (ResponseInit | Response)): Response;1756};1757/**1758 * The **`Response`** interface of the Fetch API represents the response to a request.1759 *1760 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)1761 */1762interface Response extends Body {1763 /**1764 * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.1765 *1766 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)1767 */1768 clone(): Response;1769 /**1770 * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.1771 *1772 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)1773 */1774 status: number;1775 /**1776 * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.1777 *1778 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)1779 */1780 statusText: string;1781 /**1782 * The **`headers`** read-only property of the Response interface contains the Headers object associated with the response.1783 *1784 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)1785 */1786 headers: Headers;1787 /**1788 * The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.1789 *1790 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)1791 */1792 ok: boolean;1793 /**1794 * The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.1795 *1796 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)1797 */1798 redirected: boolean;1799 /**1800 * The **`url`** read-only property of the Response interface contains the URL of the response. The value of the url property will be the final URL obtained after any redirects.1801 *1802 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)1803 */1804 url: string;1805 webSocket: WebSocket | null;1806 cf: any | undefined;1807 /**1808 * The **`type`** read-only property of the Response interface contains the type of the response. The type determines whether scripts are able to access the response body and headers.1809 *1810 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)1811 */1812 type: "default" | "error";1813}1814interface ResponseInit {1815 status?: number;1816 statusText?: string;1817 headers?: HeadersInit;1818 cf?: any;1819 webSocket?: (WebSocket | null);1820 encodeBody?: "automatic" | "manual";1821}1822type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;1823/**1824 * The **`Request`** interface of the Fetch API represents a resource request.1825 *1826 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)1827 */1828declare var Request: {1829 prototype: Request;1830 new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;1831};1832/**1833 * The **`Request`** interface of the Fetch API represents a resource request.1834 *1835 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)1836 */1837interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {1838 /**1839 * The **`clone()`** method of the Request interface creates a copy of the current Request object.1840 *1841 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)1842 */1843 clone(): Request<CfHostMetadata, Cf>;1844 /**1845 * The **`method`** read-only property of the Request interface contains the request's method (GET, POST, etc.)1846 *1847 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)1848 */1849 method: string;1850 /**1851 * The **`url`** read-only property of the Request interface contains the URL of the request.1852 *1853 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)1854 */1855 url: string;1856 /**1857 * The **`headers`** read-only property of the Request interface contains the Headers object associated with the request.1858 *1859 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)1860 */1861 headers: Headers;1862 /**1863 * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.1864 *1865 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)1866 */1867 redirect: string;1868 fetcher: Fetcher | null;1869 /**1870 * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.1871 *1872 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)1873 */1874 signal: AbortSignal;1875 cf?: Cf;1876 /**1877 * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.1878 *1879 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)1880 */1881 integrity: string;1882 /**1883 * The **`keepalive`** read-only property of the Request interface contains the request's keepalive setting (true or false), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.1884 *1885 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)1886 */1887 keepalive: boolean;1888 /**1889 * The **`cache`** read-only property of the Request interface contains the cache mode of the request. It controls how the request will interact with the browser's HTTP cache.1890 *1891 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)1892 */1893 cache?: "no-store" | "no-cache";1894}1895interface RequestInit<Cf = CfProperties> {1896 /* A string to set request's method. */1897 method?: string;1898 /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */1899 headers?: HeadersInit;1900 /* A BodyInit object or null to set request's body. */1901 body?: BodyInit | null;1902 /* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */1903 redirect?: string;1904 fetcher?: (Fetcher | null);1905 cf?: Cf;1906 /* A string indicating how the request will interact with the browser's cache to set request's cache. */1907 cache?: "no-store" | "no-cache";1908 /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */1909 integrity?: string;1910 /* An AbortSignal to set request's signal. */1911 signal?: (AbortSignal | null);1912 encodeResponseBody?: "automatic" | "manual";1913}1914type Service<T extends (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher<InstanceType<T>> : T extends Rpc.WorkerEntrypointBranded ? Fetcher<T> : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded> ? never : Fetcher<undefined>;1915type Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | "fetch" | "connect"> : unknown) & {1916 fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;1917 connect(address: SocketAddress | string, options?: SocketOptions): Socket;1918};1919interface KVNamespaceListKey<Metadata, Key extends string = string> {1920 name: Key;1921 expiration?: number;1922 metadata?: Metadata;1923}1924type KVNamespaceListResult<Metadata, Key extends string = string> = {1925 list_complete: false;1926 keys: KVNamespaceListKey<Metadata, Key>[];1927 cursor: string;1928 cacheStatus: string | null;1929} | {1930 list_complete: true;1931 keys: KVNamespaceListKey<Metadata, Key>[];1932 cacheStatus: string | null;1933};1934interface KVNamespace<Key extends string = string> {1935 get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;1936 get(key: Key, type: "text"): Promise<string | null>;1937 get<ExpectedValue = unknown>(key: Key, type: "json"): Promise<ExpectedValue | null>;1938 get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;1939 get(key: Key, type: "stream"): Promise<ReadableStream | null>;1940 get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise<string | null>;1941 get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<"json">): Promise<ExpectedValue | null>;1942 get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise<ArrayBuffer | null>;1943 get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise<ReadableStream | null>;1944 get(key: Array<Key>, type: "text"): Promise<Map<string, string | null>>;1945 get<ExpectedValue = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, ExpectedValue | null>>;1946 get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;1947 get(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, string | null>>;1948 get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, ExpectedValue | null>>;1949 list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;1950 put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;1951 getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;1952 getWithMetadata<Metadata = unknown>(key: Key, type: "text"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;1953 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: "json"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;1954 getWithMetadata<Metadata = unknown>(key: Key, type: "arrayBuffer"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;1955 getWithMetadata<Metadata = unknown>(key: Key, type: "stream"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;1956 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"text">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;1957 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"json">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;1958 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;1959 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"stream">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;1960 getWithMetadata<Metadata = unknown>(key: Array<Key>, type: "text"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;1961 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;1962 getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;1963 getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;1964 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;1965 delete(key: Key): Promise<void>;1966}1967interface KVNamespaceListOptions {1968 limit?: number;1969 prefix?: (string | null);1970 cursor?: (string | null);1971}1972interface KVNamespaceGetOptions<Type> {1973 type: Type;1974 cacheTtl?: number;1975}1976interface KVNamespacePutOptions {1977 expiration?: number;1978 expirationTtl?: number;1979 metadata?: (any | null);1980}1981interface KVNamespaceGetWithMetadataResult<Value, Metadata> {1982 value: Value | null;1983 metadata: Metadata | null;1984 cacheStatus: string | null;1985}1986type QueueContentType = "text" | "bytes" | "json" | "v8";1987interface Queue<Body = unknown> {1988 metrics(): Promise<QueueMetrics>;1989 send(message: Body, options?: QueueSendOptions): Promise<QueueSendResponse>;1990 sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<QueueSendBatchResponse>;1991}1992interface QueueSendMetrics {1993 backlogCount: number;1994 backlogBytes: number;1995 oldestMessageTimestamp?: Date;1996}1997interface QueueSendMetadata {1998 metrics: QueueSendMetrics;1999}2000interface QueueSendResponse {2001 metadata: QueueSendMetadata;2002}2003interface QueueSendBatchMetrics {2004 backlogCount: number;2005 backlogBytes: number;2006 oldestMessageTimestamp?: Date;2007}2008interface QueueSendBatchMetadata {2009 metrics: QueueSendBatchMetrics;2010}2011interface QueueSendBatchResponse {2012 metadata: QueueSendBatchMetadata;2013}2014interface QueueSendOptions {2015 contentType?: QueueContentType;2016 delaySeconds?: number;2017}2018interface QueueSendBatchOptions {2019 delaySeconds?: number;2020}2021interface MessageSendRequest<Body = unknown> {2022 body: Body;2023 contentType?: QueueContentType;2024 delaySeconds?: number;2025}2026interface QueueMetrics {2027 backlogCount: number;2028 backlogBytes: number;2029 oldestMessageTimestamp?: Date;2030}2031interface MessageBatchMetrics {2032 backlogCount: number;2033 backlogBytes: number;2034 oldestMessageTimestamp?: Date;2035}2036interface MessageBatchMetadata {2037 metrics: MessageBatchMetrics;2038}2039interface QueueRetryOptions {2040 delaySeconds?: number;2041}2042interface Message<Body = unknown> {2043 readonly id: string;2044 readonly timestamp: Date;2045 readonly body: Body;2046 readonly attempts: number;2047 retry(options?: QueueRetryOptions): void;2048 ack(): void;2049}2050interface QueueEvent<Body = unknown> extends ExtendableEvent {2051 readonly messages: readonly Message<Body>[];2052 readonly queue: string;2053 readonly metadata: MessageBatchMetadata;2054 retryAll(options?: QueueRetryOptions): void;2055 ackAll(): void;2056}2057interface MessageBatch<Body = unknown> {2058 readonly messages: readonly Message<Body>[];2059 readonly queue: string;2060 readonly metadata: MessageBatchMetadata;2061 retryAll(options?: QueueRetryOptions): void;2062 ackAll(): void;2063}2064interface R2Error extends Error {2065 readonly name: string;2066 readonly code: number;2067 readonly message: string;2068 readonly action: string;2069 readonly stack: any;2070}2071interface R2ListOptions {2072 limit?: number;2073 prefix?: string;2074 cursor?: string;2075 delimiter?: string;2076 startAfter?: string;2077 include?: ("httpMetadata" | "customMetadata")[];2078}2079interface R2Bucket {2080 head(key: string): Promise<R2Object | null>;2081 get(key: string, options: R2GetOptions & {2082 onlyIf: R2Conditional | Headers;2083 }): Promise<R2ObjectBody | R2Object | null>;2084 get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;2085 put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & {2086 onlyIf: R2Conditional | Headers;2087 }): Promise<R2Object | null>;2088 put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>;2089 createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;2090 resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;2091 delete(keys: string | string[]): Promise<void>;2092 list(options?: R2ListOptions): Promise<R2Objects>;2093}2094interface R2MultipartUpload {2095 readonly key: string;2096 readonly uploadId: string;2097 uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>;2098 abort(): Promise<void>;2099 complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;2100}2101interface R2UploadedPart {2102 partNumber: number;2103 etag: string;2104}2105declare abstract class R2Object {2106 readonly key: string;2107 readonly version: string;2108 readonly size: number;2109 readonly etag: string;2110 readonly httpEtag: string;2111 readonly checksums: R2Checksums;2112 readonly uploaded: Date;2113 readonly httpMetadata?: R2HTTPMetadata;2114 readonly customMetadata?: Record<string, string>;2115 readonly range?: R2Range;2116 readonly storageClass: string;2117 readonly ssecKeyMd5?: string;2118 writeHttpMetadata(headers: Headers): void;2119}2120interface R2ObjectBody extends R2Object {2121 get body(): ReadableStream;2122 get bodyUsed(): boolean;2123 arrayBuffer(): Promise<ArrayBuffer>;2124 bytes(): Promise<Uint8Array>;2125 text(): Promise<string>;2126 json<T>(): Promise<T>;2127 blob(): Promise<Blob>;2128}2129type R2Range = {2130 offset: number;2131 length?: number;2132} | {2133 offset?: number;2134 length: number;2135} | {2136 suffix: number;2137};2138interface R2Conditional {2139 etagMatches?: string;2140 etagDoesNotMatch?: string;2141 uploadedBefore?: Date;2142 uploadedAfter?: Date;2143 secondsGranularity?: boolean;2144}2145interface R2GetOptions {2146 onlyIf?: (R2Conditional | Headers);2147 range?: (R2Range | Headers);2148 ssecKey?: (ArrayBuffer | string);2149}2150interface R2PutOptions {2151 onlyIf?: (R2Conditional | Headers);2152 httpMetadata?: (R2HTTPMetadata | Headers);2153 customMetadata?: Record<string, string>;2154 md5?: ((ArrayBuffer | ArrayBufferView) | string);2155 sha1?: ((ArrayBuffer | ArrayBufferView) | string);2156 sha256?: ((ArrayBuffer | ArrayBufferView) | string);2157 sha384?: ((ArrayBuffer | ArrayBufferView) | string);2158 sha512?: ((ArrayBuffer | ArrayBufferView) | string);2159 storageClass?: string;2160 ssecKey?: (ArrayBuffer | string);2161}2162interface R2MultipartOptions {2163 httpMetadata?: (R2HTTPMetadata | Headers);2164 customMetadata?: Record<string, string>;2165 storageClass?: string;2166 ssecKey?: (ArrayBuffer | string);2167}2168interface R2Checksums {2169 readonly md5?: ArrayBuffer;2170 readonly sha1?: ArrayBuffer;2171 readonly sha256?: ArrayBuffer;2172 readonly sha384?: ArrayBuffer;2173 readonly sha512?: ArrayBuffer;2174 toJSON(): R2StringChecksums;2175}2176interface R2StringChecksums {2177 md5?: string;2178 sha1?: string;2179 sha256?: string;2180 sha384?: string;2181 sha512?: string;2182}2183interface R2HTTPMetadata {2184 contentType?: string;2185 contentLanguage?: string;2186 contentDisposition?: string;2187 contentEncoding?: string;2188 cacheControl?: string;2189 cacheExpiry?: Date;2190}2191type R2Objects = {2192 objects: R2Object[];2193 delimitedPrefixes: string[];2194} & ({2195 truncated: true;2196 cursor: string;2197} | {2198 truncated: false;2199});2200interface R2UploadPartOptions {2201 ssecKey?: (ArrayBuffer | string);2202}2203declare abstract class ScheduledEvent extends ExtendableEvent {2204 readonly scheduledTime: number;2205 readonly cron: string;2206 noRetry(): void;2207}2208interface ScheduledController {2209 readonly scheduledTime: number;2210 readonly cron: string;2211 noRetry(): void;2212}2213interface QueuingStrategy<T = any> {2214 highWaterMark?: (number | bigint);2215 size?: (chunk: T) => number | bigint;2216}2217interface UnderlyingSink<W = any> {2218 type?: string;2219 start?: (controller: WritableStreamDefaultController) => void | Promise<void>;2220 write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;2221 abort?: (reason: any) => void | Promise<void>;2222 close?: () => void | Promise<void>;2223}2224interface UnderlyingByteSource {2225 type: "bytes";2226 autoAllocateChunkSize?: number;2227 start?: (controller: ReadableByteStreamController) => void | Promise<void>;2228 pull?: (controller: ReadableByteStreamController) => void | Promise<void>;2229 cancel?: (reason: any) => void | Promise<void>;2230}2231interface UnderlyingSource<R = any> {2232 type?: "" | undefined;2233 start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;2234 pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;2235 cancel?: (reason: any) => void | Promise<void>;2236 expectedLength?: (number | bigint);2237}2238interface Transformer<I = any, O = any> {2239 readableType?: string;2240 writableType?: string;2241 start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;2242 transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;2243 flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;2244 cancel?: (reason: any) => void | Promise<void>;2245 expectedLength?: number;2246}2247interface StreamPipeOptions {2248 preventAbort?: boolean;2249 preventCancel?: boolean;2250 /**2251 * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.2252 *2253 * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.2254 *2255 * Errors and closures of the source and destination streams propagate as follows:2256 *2257 * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.2258 *2259 * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.2260 *2261 * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.2262 *2263 * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.2264 *2265 * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.2266 */2267 preventClose?: boolean;2268 signal?: AbortSignal;2269}2270type ReadableStreamReadResult<R = any> = {2271 done: false;2272 value: R;2273} | {2274 done: true;2275 value?: undefined;2276};2277/**2278 * The **`ReadableStream`** interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.2279 *2280 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)2281 */2282interface ReadableStream<R = any> {2283 /**2284 * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.2285 *2286 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)2287 */2288 get locked(): boolean;2289 /**2290 * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.2291 *2292 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)2293 */2294 cancel(reason?: any): Promise<void>;2295 /**2296 * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. While the stream is locked, no other reader can be acquired until this one is released.2297 *2298 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)2299 */2300 getReader(): ReadableStreamDefaultReader<R>;2301 /**2302 * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. While the stream is locked, no other reader can be acquired until this one is released.2303 *2304 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)2305 */2306 getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;2307 /**2308 * The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.2309 *2310 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)2311 */2312 pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;2313 /**2314 * The **`pipeTo()`** method of the ReadableStream interface pipes the current ReadableStream to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.2315 *2316 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)2317 */2318 pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;2319 /**2320 * The **`tee()`** method of the ReadableStream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances.2321 *2322 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)2323 */2324 tee(): [2325 ReadableStream<R>,2326 ReadableStream<R>2327 ];2328 values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;2329 [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;2330}2331/**2332 * The **`ReadableStream`** interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.2333 *2334 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)2335 */2336declare const ReadableStream: {2337 prototype: ReadableStream;2338 new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;2339 new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;2340};2341/**2342 * The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).2343 *2344 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)2345 */2346declare class ReadableStreamDefaultReader<R = any> {2347 constructor(stream: ReadableStream);2348 get closed(): Promise<void>;2349 cancel(reason?: any): Promise<void>;2350 /**2351 * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.2352 *2353 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)2354 */2355 read(): Promise<ReadableStreamReadResult<R>>;2356 /**2357 * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.2358 *2359 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)2360 */2361 releaseLock(): void;2362}2363/**2364 * The **`ReadableStreamBYOBReader`** interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files.2365 *2366 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)2367 */2368declare class ReadableStreamBYOBReader {2369 constructor(stream: ReadableStream);2370 get closed(): Promise<void>;2371 cancel(reason?: any): Promise<void>;2372 /**2373 * The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream. A request for data will be satisfied from the stream's internal queues if there is any data present. If the stream queues are empty, the request may be supplied as a zero-copy transfer from the underlying byte source.2374 *2375 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)2376 */2377 read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;2378 /**2379 * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream. After the lock is released, the reader is no longer active.2380 *2381 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)2382 */2383 releaseLock(): void;2384 readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;2385}2386interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {2387 min?: number;2388}2389interface ReadableStreamGetReaderOptions {2390 /**2391 * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.2392 *2393 * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.2394 */2395 mode: "byob";2396}2397/**2398 * The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a "pull request" for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).2399 *2400 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)2401 */2402declare abstract class ReadableStreamBYOBRequest {2403 /**2404 * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.2405 *2406 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)2407 */2408 get view(): Uint8Array | null;2409 /**2410 * The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.2411 *2412 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)2413 */2414 respond(bytesWritten: number): void;2415 /**2416 * The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.2417 *2418 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)2419 */2420 respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;2421 get atLeast(): number | null;2422}2423/**2424 * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. Default controllers are for streams that are not byte streams.2425 *2426 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)2427 */2428declare abstract class ReadableStreamDefaultController<R = any> {2429 /**2430 * The **`desiredSize`** read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue.2431 *2432 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)2433 */2434 get desiredSize(): number | null;2435 /**2436 * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.2437 *2438 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)2439 */2440 close(): void;2441 /**2442 * The **`enqueue()`** method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream.2443 *2444 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)2445 */2446 enqueue(chunk?: R): void;2447 /**2448 * The **`error()`** method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error.2449 *2450 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)2451 */2452 error(reason: any): void;2453}2454/**2455 * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream. It allows control of the state and internal queue of a ReadableStream with an underlying byte source, and enables efficient zero-copy transfer of data from the underlying source to a consumer when the stream's internal queue is empty.2456 *2457 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)2458 */2459declare abstract class ReadableByteStreamController {2460 /**2461 * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests.2462 *2463 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)2464 */2465 get byobRequest(): ReadableStreamBYOBRequest | null;2466 /**2467 * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its "desired size".2468 *2469 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)2470 */2471 get desiredSize(): number | null;2472 /**2473 * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.2474 *2475 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)2476 */2477 close(): void;2478 /**2479 * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is transferred into the stream's internal queues).2480 *2481 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)2482 */2483 enqueue(chunk: ArrayBuffer | ArrayBufferView): void;2484 /**2485 * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.2486 *2487 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)2488 */2489 error(reason: any): void;2490}2491/**2492 * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.2493 *2494 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)2495 */2496declare abstract class WritableStreamDefaultController {2497 /**2498 * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.2499 *2500 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)2501 */2502 get signal(): AbortSignal;2503 /**2504 * The **`error()`** method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error.2505 *2506 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)2507 */2508 error(reason?: any): void;2509}2510/**2511 * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.2512 *2513 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)2514 */2515declare abstract class TransformStreamDefaultController<O = any> {2516 /**2517 * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.2518 *2519 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)2520 */2521 get desiredSize(): number | null;2522 /**2523 * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.2524 *2525 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)2526 */2527 enqueue(chunk?: O): void;2528 /**2529 * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream. Any further interactions with it will fail with the given error message, and any chunks in the queue will be discarded.2530 *2531 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)2532 */2533 error(reason: any): void;2534 /**2535 * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.2536 *2537 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)2538 */2539 terminate(): void;2540}2541interface ReadableWritablePair<R = any, W = any> {2542 readable: ReadableStream<R>;2543 /**2544 * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.2545 *2546 * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.2547 */2548 writable: WritableStream<W>;2549}2550/**2551 * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.2552 *2553 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)2554 */2555declare class WritableStream<W = any> {2556 constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);2557 /**2558 * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the WritableStream is locked to a writer.2559 *2560 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)2561 */2562 get locked(): boolean;2563 /**2564 * The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.2565 *2566 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)2567 */2568 abort(reason?: any): Promise<void>;2569 /**2570 * The **`close()`** method of the WritableStream interface closes the associated stream. All chunks written before this method is called are sent before the returned promise is fulfilled.2571 *2572 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)2573 */2574 close(): Promise<void>;2575 /**2576 * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. While the stream is locked, no other writer can be acquired until this one is released.2577 *2578 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)2579 */2580 getWriter(): WritableStreamDefaultWriter<W>;2581}2582/**2583 * The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the WritableStream ensuring that no other streams can write to the underlying sink.2584 *2585 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)2586 */2587declare class WritableStreamDefaultWriter<W = any> {2588 constructor(stream: WritableStream);2589 /**2590 * The **`closed`** read-only property of the WritableStreamDefaultWriter interface returns a Promise that fulfills if the stream becomes closed, or rejects if the stream errors or the writer's lock is released.2591 *2592 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)2593 */2594 get closed(): Promise<void>;2595 /**2596 * The **`ready`** read-only property of the WritableStreamDefaultWriter interface returns a Promise that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.2597 *2598 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)2599 */2600 get ready(): Promise<void>;2601 /**2602 * The **`desiredSize`** read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue.2603 *2604 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)2605 */2606 get desiredSize(): number | null;2607 /**2608 * The **`abort()`** method of the WritableStreamDefaultWriter interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.2609 *2610 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)2611 */2612 abort(reason?: any): Promise<void>;2613 /**2614 * The **`close()`** method of the WritableStreamDefaultWriter interface closes the associated writable stream.2615 *2616 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)2617 */2618 close(): Promise<void>;2619 /**2620 * The **`write()`** method of the WritableStreamDefaultWriter interface writes a passed chunk of data to a WritableStream and its underlying sink, then returns a Promise that resolves to indicate the success or failure of the write operation.2621 *2622 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)2623 */2624 write(chunk?: W): Promise<void>;2625 /**2626 * The **`releaseLock()`** method of the WritableStreamDefaultWriter interface releases the writer's lock on the corresponding stream. After the lock is released, the writer is no longer active. If the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed.2627 *2628 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)2629 */2630 releaseLock(): void;2631}2632/**2633 * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain transform stream concept.2634 *2635 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)2636 */2637declare class TransformStream<I = any, O = any> {2638 constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);2639 /**2640 * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this TransformStream. This stream emits the transformed output data.2641 *2642 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)2643 */2644 get readable(): ReadableStream<O>;2645 /**2646 * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this TransformStream. This stream accepts input data that will be transformed and emitted to the readable stream.2647 *2648 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)2649 */2650 get writable(): WritableStream<I>;2651}2652declare class FixedLengthStream extends IdentityTransformStream {2653 constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);2654}2655declare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {2656 constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);2657}2658interface IdentityTransformStreamQueuingStrategy {2659 highWaterMark?: (number | bigint);2660}2661interface ReadableStreamValuesOptions {2662 preventCancel?: boolean;2663}2664/**2665 * The **`CompressionStream`** interface of the Compression Streams API compresses a stream of data. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods.2666 *2667 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)2668 */2669declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {2670 constructor(format: "gzip" | "deflate" | "deflate-raw");2671}2672/**2673 * The **`DecompressionStream`** interface of the Compression Streams API decompresses a stream of data. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods.2674 *2675 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)2676 */2677declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {2678 constructor(format: "gzip" | "deflate" | "deflate-raw");2679}2680/**2681 * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. It is the streaming equivalent of TextEncoder. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods.2682 *2683 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)2684 */2685declare class TextEncoderStream extends TransformStream<string, Uint8Array> {2686 constructor();2687 get encoding(): string;2688}2689/**2690 * The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings. It is the streaming equivalent of TextDecoder. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods.2691 *2692 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)2693 */2694declare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {2695 constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);2696 get encoding(): string;2697 get fatal(): boolean;2698 get ignoreBOM(): boolean;2699}2700interface TextDecoderStreamTextDecoderStreamInit {2701 fatal?: boolean;2702 ignoreBOM?: boolean;2703}2704/**2705 * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.2706 *2707 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)2708 */2709declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {2710 constructor(init: QueuingStrategyInit);2711 /**2712 * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.2713 *2714 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)2715 */2716 get highWaterMark(): number;2717 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */2718 get size(): (chunk?: any) => number;2719}2720/**2721 * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.2722 *2723 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)2724 */2725declare class CountQueuingStrategy implements QueuingStrategy {2726 constructor(init: QueuingStrategyInit);2727 /**2728 * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.2729 *2730 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)2731 */2732 get highWaterMark(): number;2733 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */2734 get size(): (chunk?: any) => number;2735}2736interface QueuingStrategyInit {2737 /**2738 * Creates a new ByteLengthQueuingStrategy with the provided high water mark.2739 *2740 * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.2741 */2742 highWaterMark: number;2743}2744interface TracePreviewInfo {2745 id: string;2746 slug: string;2747 name: string;2748}2749interface ScriptVersion {2750 id?: string;2751 tag?: string;2752 message?: string;2753}2754declare abstract class TailEvent extends ExtendableEvent {2755 readonly events: TraceItem[];2756 readonly traces: TraceItem[];2757}2758interface TraceItem {2759 readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemConnectEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null;2760 readonly eventTimestamp: number | null;2761 readonly logs: TraceLog[];2762 readonly exceptions: TraceException[];2763 readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];2764 readonly scriptName: string | null;2765 readonly entrypoint?: string;2766 readonly scriptVersion?: ScriptVersion;2767 readonly dispatchNamespace?: string;2768 readonly scriptTags?: string[];2769 readonly tailAttributes?: Record<string, boolean | number | string>;2770 readonly preview?: TracePreviewInfo;2771 readonly durableObjectId?: string;2772 readonly outcome: string;2773 readonly executionModel: string;2774 readonly truncated: boolean;2775 readonly cpuTime: number;2776 readonly wallTime: number;2777}2778interface TraceItemAlarmEventInfo {2779 readonly scheduledTime: Date;2780}2781interface TraceItemConnectEventInfo {2782}2783interface TraceItemCustomEventInfo {2784}2785interface TraceItemScheduledEventInfo {2786 readonly scheduledTime: number;2787 readonly cron: string;2788}2789interface TraceItemQueueEventInfo {2790 readonly queue: string;2791 readonly batchSize: number;2792}2793interface TraceItemEmailEventInfo {2794 readonly mailFrom: string;2795 readonly rcptTo: string;2796 readonly rawSize: number;2797}2798interface TraceItemTailEventInfo {2799 readonly consumedEvents: TraceItemTailEventInfoTailItem[];2800}2801interface TraceItemTailEventInfoTailItem {2802 readonly scriptName: string | null;2803}2804interface TraceItemFetchEventInfo {2805 readonly response?: TraceItemFetchEventInfoResponse;2806 readonly request: TraceItemFetchEventInfoRequest;2807}2808interface TraceItemFetchEventInfoRequest {2809 readonly cf?: any;2810 readonly headers: Record<string, string>;2811 readonly method: string;2812 readonly url: string;2813 getUnredacted(): TraceItemFetchEventInfoRequest;2814}2815interface TraceItemFetchEventInfoResponse {2816 readonly status: number;2817}2818interface TraceItemJsRpcEventInfo {2819 readonly rpcMethod: string;2820}2821interface TraceItemHibernatableWebSocketEventInfo {2822 readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError;2823}2824interface TraceItemHibernatableWebSocketEventInfoMessage {2825 readonly webSocketEventType: string;2826}2827interface TraceItemHibernatableWebSocketEventInfoClose {2828 readonly webSocketEventType: string;2829 readonly code: number;2830 readonly wasClean: boolean;2831}2832interface TraceItemHibernatableWebSocketEventInfoError {2833 readonly webSocketEventType: string;2834}2835interface TraceLog {2836 readonly timestamp: number;2837 readonly level: string;2838 readonly message: any;2839 readonly errorInfo?: (TraceLogErrorInfo | null)[];2840}2841interface TraceLogErrorInfo {2842 name: string;2843 message: string;2844 stack?: string;2845}2846interface TraceException {2847 readonly timestamp: number;2848 readonly message: string;2849 readonly name: string;2850 readonly stack?: string;2851}2852interface TraceDiagnosticChannelEvent {2853 readonly timestamp: number;2854 readonly channel: string;2855 readonly message: any;2856}2857interface TraceMetrics {2858 readonly cpuTime: number;2859 readonly wallTime: number;2860}2861interface UnsafeTraceMetrics {2862 fromTrace(item: TraceItem): TraceMetrics;2863}2864/**2865 * The **`URL`** interface is used to parse, construct, normalize, and encode URLs. It works by providing properties which allow you to easily read and modify the components of a URL.2866 *2867 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)2868 */2869declare class URL {2870 constructor(url: string | URL, base?: string | URL);2871 /**2872 * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.2873 *2874 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)2875 */2876 get origin(): string;2877 /**2878 * The **`href`** property of the URL interface is a string containing the whole URL.2879 *2880 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)2881 */2882 get href(): string;2883 /**2884 * The **`href`** property of the URL interface is a string containing the whole URL.2885 *2886 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)2887 */2888 set href(value: string);2889 /**2890 * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":".2891 *2892 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)2893 */2894 get protocol(): string;2895 /**2896 * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":".2897 *2898 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)2899 */2900 set protocol(value: string);2901 /**2902 * The **`username`** property of the URL interface is a string containing the username component of the URL. If the URL does not have a username, this property contains an empty string, "".2903 *2904 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)2905 */2906 get username(): string;2907 /**2908 * The **`username`** property of the URL interface is a string containing the username component of the URL. If the URL does not have a username, this property contains an empty string, "".2909 *2910 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)2911 */2912 set username(value: string);2913 /**2914 * The **`password`** property of the URL interface is a string containing the password component of the URL. If the URL does not have a password, this property contains an empty string, "".2915 *2916 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)2917 */2918 get password(): string;2919 /**2920 * The **`password`** property of the URL interface is a string containing the password component of the URL. If the URL does not have a password, this property contains an empty string, "".2921 *2922 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)2923 */2924 set password(value: string);2925 /**2926 * The **`host`** property of the URL interface is a string containing the host, which is the hostname, and then, if the port of the URL is nonempty, a ":", followed by the port of the URL. If the URL does not have a hostname, this property contains an empty string, "".2927 *2928 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)2929 */2930 get host(): string;2931 /**2932 * The **`host`** property of the URL interface is a string containing the host, which is the hostname, and then, if the port of the URL is nonempty, a ":", followed by the port of the URL. If the URL does not have a hostname, this property contains an empty string, "".2933 *2934 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)2935 */2936 set host(value: string);2937 /**2938 * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. If the URL does not have a hostname, this property contains an empty string, "". IPv4 and IPv6 addresses are normalized, such as stripping leading zeros, and domain names are converted to IDN.2939 *2940 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)2941 */2942 get hostname(): string;2943 /**2944 * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. If the URL does not have a hostname, this property contains an empty string, "". IPv4 and IPv6 addresses are normalized, such as stripping leading zeros, and domain names are converted to IDN.2945 *2946 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)2947 */2948 set hostname(value: string);2949 /**2950 * The **`port`** property of the URL interface is a string containing the port number of the URL. If the port is the default for the protocol (80 for ws: and http:, 443 for wss: and https:, and 21 for ftp:), this property contains an empty string, "".2951 *2952 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)2953 */2954 get port(): string;2955 /**2956 * The **`port`** property of the URL interface is a string containing the port number of the URL. If the port is the default for the protocol (80 for ws: and http:, 443 for wss: and https:, and 21 for ftp:), this property contains an empty string, "".2957 *2958 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)2959 */2960 set port(value: string);2961 /**2962 * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of path segments, each of which is prefixed by a / character.2963 *2964 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)2965 */2966 get pathname(): string;2967 /**2968 * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of path segments, each of which is prefixed by a / character.2969 *2970 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)2971 */2972 set pathname(value: string);2973 /**2974 * The **`search`** property of the URL interface is a search string, also called a query string, that is a string containing a "?" followed by the parameters of the URL. If the URL does not have a search query, this property contains an empty string, "".2975 *2976 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)2977 */2978 get search(): string;2979 /**2980 * The **`search`** property of the URL interface is a search string, also called a query string, that is a string containing a "?" followed by the parameters of the URL. If the URL does not have a search query, this property contains an empty string, "".2981 *2982 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)2983 */2984 set search(value: string);2985 /**2986 * The **`hash`** property of the URL interface is a string containing a "#" followed by the fragment identifier of the URL. If the URL does not have a fragment identifier, this property contains an empty string, "".2987 *2988 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)2989 */2990 get hash(): string;2991 /**2992 * The **`hash`** property of the URL interface is a string containing a "#" followed by the fragment identifier of the URL. If the URL does not have a fragment identifier, this property contains an empty string, "".2993 *2994 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)2995 */2996 set hash(value: string);2997 /**2998 * The **`searchParams`** read-only property of the URL interface returns a URLSearchParams object allowing access to the GET decoded query arguments contained in the URL.2999 *3000 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)3001 */3002 get searchParams(): URLSearchParams;3003 /**3004 * The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as URL.toString().3005 *3006 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)3007 */3008 toJSON(): string;3009 /*function toString() { [native code] }*/3010 toString(): string;3011 /**3012 * The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.3013 *3014 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)3015 */3016 static canParse(url: string, base?: string): boolean;3017 /**3018 * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.3019 *3020 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)3021 */3022 static parse(url: string, base?: string): URL | null;3023 /**3024 * The **`createObjectURL()`** static method of the URL interface creates a string containing a blob URL pointing to the object given in the parameter.3025 *3026 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)3027 */3028 static createObjectURL(object: File | Blob): string;3029 /**3030 * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL().3031 *3032 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)3033 */3034 static revokeObjectURL(object_url: string): void;3035}3036/**3037 * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.3038 *3039 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)3040 */3041declare class URLSearchParams {3042 constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));3043 /**3044 * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.3045 *3046 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)3047 */3048 get size(): number;3049 /**3050 * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.3051 *3052 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)3053 */3054 append(name: string, value: string): void;3055 /**3056 * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.3057 *3058 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)3059 */3060 delete(name: string, value?: string): void;3061 /**3062 * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.3063 *3064 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)3065 */3066 get(name: string): string | null;3067 /**3068 * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.3069 *3070 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)3071 */3072 getAll(name: string): string[];3073 /**3074 * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.3075 *3076 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)3077 */3078 has(name: string, value?: string): boolean;3079 /**3080 * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it.3081 *3082 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)3083 */3084 set(name: string, value: string): void;3085 /**3086 * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns undefined. Key/value pairs are sorted by the values of the UTF-16 code units of the keys. This method uses a stable sorting algorithm (i.e., the relative order between key/value pairs with equal keys will be preserved).3087 *3088 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)3089 */3090 sort(): void;3091 entries(): IterableIterator<[3092 key: string,3093 value: string3094 ]>;3095 keys(): IterableIterator<string>;3096 values(): IterableIterator<string>;3097 forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;3098 /*function toString() { [native code] }*/3099 toString(): string;3100 [Symbol.iterator](): IterableIterator<[3101 key: string,3102 value: string3103 ]>;3104}3105/**3106 * The **`URLPattern`** interface of the URL Pattern API matches URLs or parts of URLs against a pattern. The pattern can contain capturing groups that extract parts of the matched URL.3107 *3108 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern)3109 */3110declare class URLPattern {3111 constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions);3112 /**3113 * The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL.3114 *3115 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol)3116 */3117 get protocol(): string;3118 /**3119 * The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL.3120 *3121 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username)3122 */3123 get username(): string;3124 /**3125 * The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL.3126 *3127 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password)3128 */3129 get password(): string;3130 /**3131 * The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL.3132 *3133 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname)3134 */3135 get hostname(): string;3136 /**3137 * The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL.3138 *3139 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port)3140 */3141 get port(): string;3142 /**3143 * The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL.3144 *3145 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname)3146 */3147 get pathname(): string;3148 /**3149 * The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL.3150 *3151 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search)3152 */3153 get search(): string;3154 /**3155 * The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL.3156 *3157 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash)3158 */3159 get hash(): string;3160 /**3161 * The **`hasRegExpGroups`** read-only property of the URLPattern interface is a boolean indicating whether or not any of the URLPattern components contain regular expression capturing groups.3162 *3163 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hasRegExpGroups)3164 */3165 get hasRegExpGroups(): boolean;3166 /**3167 * The **`test()`** method of the URLPattern interface takes a URL string or object of URL parts, and returns a boolean indicating if the given input matches the current pattern.3168 *3169 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test)3170 */3171 test(input?: (string | URLPatternInit), baseURL?: string): boolean;3172 /**3173 * The **`exec()`** method of the URLPattern interface takes a URL or object of URL parts, and returns either an object containing the results of matching the URL to the pattern, or null if the URL does not match the pattern.3174 *3175 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec)3176 */3177 exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null;3178}3179interface URLPatternInit {3180 protocol?: string;3181 username?: string;3182 password?: string;3183 hostname?: string;3184 port?: string;3185 pathname?: string;3186 search?: string;3187 hash?: string;3188 baseURL?: string;3189}3190interface URLPatternComponentResult {3191 input: string;3192 groups: Record<string, string>;3193}3194interface URLPatternResult {3195 inputs: (string | URLPatternInit)[];3196 protocol: URLPatternComponentResult;3197 username: URLPatternComponentResult;3198 password: URLPatternComponentResult;3199 hostname: URLPatternComponentResult;3200 port: URLPatternComponentResult;3201 pathname: URLPatternComponentResult;3202 search: URLPatternComponentResult;3203 hash: URLPatternComponentResult;3204}3205interface URLPatternOptions {3206 ignoreCase?: boolean;3207}3208/**3209 * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.3210 *3211 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)3212 */3213declare class CloseEvent extends Event {3214 constructor(type: string, initializer?: CloseEventInit);3215 /**3216 * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.3217 *3218 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)3219 */3220 readonly code: number;3221 /**3222 * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.3223 *3224 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)3225 */3226 readonly reason: string;3227 /**3228 * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.3229 *3230 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)3231 */3232 readonly wasClean: boolean;3233}3234interface CloseEventInit {3235 bubbles?: boolean;3236 cancelable?: boolean;3237 composed?: boolean;3238 code?: number;3239 reason?: string;3240 wasClean?: boolean;3241}3242type WebSocketEventMap = {3243 close: CloseEvent;3244 message: MessageEvent;3245 open: Event;3246 error: ErrorEvent;3247};3248/**3249 * The **`WebSocket`** object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.3250 *3251 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)3252 */3253declare var WebSocket: {3254 prototype: WebSocket;3255 new (url: string, protocols?: (string[] | string)): WebSocket;3256 readonly READY_STATE_CONNECTING: number;3257 readonly CONNECTING: number;3258 readonly READY_STATE_OPEN: number;3259 readonly OPEN: number;3260 readonly READY_STATE_CLOSING: number;3261 readonly CLOSING: number;3262 readonly READY_STATE_CLOSED: number;3263 readonly CLOSED: number;3264};3265/**3266 * The **`WebSocket`** object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.3267 *3268 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)3269 */3270interface WebSocket extends EventTarget<WebSocketEventMap> {3271 accept(options?: WebSocketAcceptOptions): void;3272 /**3273 * The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of bufferedAmount by the number of bytes needed to contain the data. If the data can't be sent (for example, because it needs to be buffered but the buffer is full), the socket is closed automatically. The browser will throw an exception if you call send() when the connection is in the CONNECTING state. If you call send() when the connection is in the CLOSING or CLOSED states, the browser will silently discard the data.3274 *3275 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)3276 */3277 send(message: (ArrayBuffer | ArrayBufferView) | string): void;3278 /**3279 * The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.3280 *3281 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)3282 */3283 close(code?: number, reason?: string): void;3284 serializeAttachment(attachment: any): void;3285 deserializeAttachment(): any | null;3286 /**3287 * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.3288 *3289 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)3290 */3291 readyState: number;3292 /**3293 * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.3294 *3295 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)3296 */3297 url: string | null;3298 /**3299 * The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the protocols parameter when creating the WebSocket object, or the empty string if no connection is established.3300 *3301 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)3302 */3303 protocol: string | null;3304 /**3305 * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server. This is currently only the empty string or a list of extensions as negotiated by the connection.3306 *3307 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)3308 */3309 extensions: string | null;3310 /**3311 * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.3312 *3313 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)3314 */3315 binaryType: "blob" | "arraybuffer";3316}3317interface WebSocketAcceptOptions {3318 /**3319 * When set to `true`, receiving a server-initiated WebSocket Close frame will not3320 * automatically send a reciprocal Close frame, leaving the connection in a half-open3321 * state. This is useful for proxying scenarios where you need to coordinate closing3322 * both sides independently. Defaults to `false` when the3323 * `no_web_socket_half_open_by_default` compatibility flag is enabled.3324 */3325 allowHalfOpen?: boolean;3326}3327declare const WebSocketPair: {3328 new (): {3329 0: WebSocket;3330 1: WebSocket;3331 };3332};3333interface SqlStorage {3334 exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;3335 get databaseSize(): number;3336 Cursor: typeof SqlStorageCursor;3337 Statement: typeof SqlStorageStatement;3338}3339declare abstract class SqlStorageStatement {3340}3341type SqlStorageValue = ArrayBuffer | string | number | null;3342declare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> {3343 next(): {3344 done?: false;3345 value: T;3346 } | {3347 done: true;3348 value?: never;3349 };3350 toArray(): T[];3351 one(): T;3352 raw<U extends SqlStorageValue[]>(): IterableIterator<U>;3353 columnNames: string[];3354 get rowsRead(): number;3355 get rowsWritten(): number;3356 [Symbol.iterator](): IterableIterator<T>;3357}3358interface Socket {3359 get readable(): ReadableStream;3360 get writable(): WritableStream;3361 get closed(): Promise<void>;3362 get opened(): Promise<SocketInfo>;3363 get upgraded(): boolean;3364 get secureTransport(): "on" | "off" | "starttls";3365 close(): Promise<void>;3366 startTls(options?: TlsOptions): Socket;3367}3368interface SocketOptions {3369 secureTransport?: string;3370 allowHalfOpen: boolean;3371 highWaterMark?: (number | bigint);3372}3373interface SocketAddress {3374 hostname: string;3375 port: number;3376}3377interface TlsOptions {3378 expectedServerHostname?: string;3379}3380interface SocketInfo {3381 remoteAddress?: string;3382 localAddress?: string;3383}3384/**3385 * The **`EventSource`** interface is web content's interface to server-sent events.3386 *3387 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)3388 */3389declare class EventSource extends EventTarget {3390 constructor(url: string, init?: EventSourceEventSourceInit);3391 /**3392 * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed).3393 *3394 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)3395 */3396 close(): void;3397 /**3398 * The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.3399 *3400 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)3401 */3402 get url(): string;3403 /**3404 * The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.3405 *3406 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)3407 */3408 get withCredentials(): boolean;3409 /**3410 * The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.3411 *3412 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)3413 */3414 get readyState(): number;3415 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */3416 get onopen(): any | null;3417 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */3418 set onopen(value: any | null);3419 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */3420 get onmessage(): any | null;3421 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */3422 set onmessage(value: any | null);3423 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */3424 get onerror(): any | null;3425 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */3426 set onerror(value: any | null);3427 static readonly CONNECTING: number;3428 static readonly OPEN: number;3429 static readonly CLOSED: number;3430 static from(stream: ReadableStream): EventSource;3431}3432interface EventSourceEventSourceInit {3433 withCredentials?: boolean;3434 fetcher?: Fetcher;3435}3436interface ExecOutput {3437 readonly stdout: ArrayBuffer;3438 readonly stderr: ArrayBuffer;3439 readonly exitCode: number;3440}3441interface ContainerExecOptions {3442 cwd?: string;3443 env?: Record<string, string>;3444 user?: string;3445 signal?: AbortSignal;3446 pty?: boolean | ContainerExecPtyOptions;3447 stdin?: ReadableStream | "pipe";3448 stdout?: "pipe" | "ignore";3449 stderr?: "pipe" | "ignore" | "combined";3450}3451interface ContainerExecPtyOptions {3452 cols?: number;3453 rows?: number;3454}3455interface ExecProcess {3456 readonly stdin: WritableStream | null;3457 readonly stdout: ReadableStream | null;3458 readonly stderr: ReadableStream | null;3459 readonly pid: number;3460 readonly isPty: boolean;3461 readonly exitCode: Promise<number>;3462 output(): Promise<ExecOutput>;3463 kill(signal?: number): void;3464 resize(cols: number, rows: number): void;3465}3466interface Container {3467 get running(): boolean;3468 start(options?: ContainerStartupOptions): void;3469 monitor(): Promise<void>;3470 destroy(error?: any): Promise<void>;3471 signal(signo: number): void;3472 getTcpPort(port: number): Fetcher;3473 setInactivityTimeout(durationMs: number | bigint): Promise<void>;3474 interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;3475 interceptAllOutboundHttp(binding: Fetcher): Promise<void>;3476 snapshotDirectory(options: ContainerDirectorySnapshotOptions): Promise<ContainerDirectorySnapshot>;3477 snapshotContainer(options: ContainerSnapshotOptions): Promise<ContainerSnapshot>;3478 interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;3479 exec(cmd: string[], options?: ContainerExecOptions): Promise<ExecProcess>;3480}3481interface ContainerDirectorySnapshot {3482 id: string;3483 size: number;3484 dir: string;3485 name?: string;3486}3487interface ContainerDirectorySnapshotOptions {3488 dir: string;3489 name?: string;3490}3491type ContainerDirectorySnapshotRestoreParams = {3492 snapshot: ContainerDirectorySnapshot;3493 mountPoint?: string;3494} | {3495 snapshot?: undefined;3496 mountPoint: string;3497};3498interface ContainerSnapshot {3499 id: string;3500 size: number;3501 name?: string;3502}3503interface ContainerSnapshotRestoreParams {3504 id: string;3505}3506interface ContainerSnapshotOptions {3507 name?: string;3508}3509type ContainerStartupOptions = {3510 entrypoint?: string[];3511 enableInternet: boolean;3512 env?: Record<string, string>;3513 instance?: "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | ContainerStartResources;3514 labels?: Record<string, string>;3515 directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];3516} & ({3517 image: string;3518 containerSnapshot?: never;3519} | {3520 image?: never;3521 containerSnapshot?: ContainerSnapshotRestoreParams;3522});3523interface ContainerStartResources {3524 vcpu: number;3525 memoryMib: number;3526 diskMb: number;3527}3528/**3529 * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.3530 *3531 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)3532 */3533declare abstract class MessagePort extends EventTarget {3534 /**3535 * The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.3536 *3537 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)3538 */3539 postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;3540 /**3541 * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port.3542 *3543 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)3544 */3545 close(): void;3546 /**3547 * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage.3548 *3549 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)3550 */3551 start(): void;3552 get onmessage(): any | null;3553 set onmessage(value: any | null);3554}3555/**3556 * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.3557 *3558 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)3559 */3560declare class MessageChannel {3561 constructor();3562 /**3563 * The **`port1`** read-only property of the MessageChannel interface returns the first port of the message channel — the port attached to the context that originated the channel.3564 *3565 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)3566 */3567 readonly port1: MessagePort;3568 /**3569 * The **`port2`** read-only property of the MessageChannel interface returns the second port of the message channel — the port attached to the context at the other end of the channel, which the message is initially sent to.3570 *3571 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)3572 */3573 readonly port2: MessagePort;3574}3575interface MessagePortPostMessageOptions {3576 transfer?: any[];3577}3578type LoopbackForExport<T extends (new (...args: any[]) => Rpc.EntrypointBranded) | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? LoopbackServiceStub<InstanceType<T>> : T extends new (...args: any[]) => Rpc.DurableObjectBranded ? LoopbackDurableObjectClass<InstanceType<T>> : T extends ExportedHandler<any, any, any> ? LoopbackServiceStub<undefined> : undefined;3579type LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: {3580 props?: Props;3581}) => Fetcher<T> : (opts: {3582 props?: any;3583}) => Fetcher<T>);3584type LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: {3585 props?: Props;3586}) => DurableObjectClass<T> : (opts: {3587 props?: any;3588}) => DurableObjectClass<T>);3589interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {3590}3591interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {3592}3593interface SyncKvStorage {3594 get<T = unknown>(key: string): T | undefined;3595 list<T = unknown>(options?: SyncKvListOptions): Iterable<[3596 string,3597 T3598 ]>;3599 put<T>(key: string, value: T): void;3600 delete(key: string): boolean;3601}3602interface SyncKvListOptions {3603 start?: string;3604 startAfter?: string;3605 end?: string;3606 prefix?: string;3607 reverse?: boolean;3608 limit?: number;3609}3610interface WorkerStub {3611 getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>;3612 getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): DurableObjectClass<T>;3613}3614interface WorkerStubEntrypointOptions {3615 props?: any;3616 limits?: workerdResourceLimits;3617}3618interface WorkerLoader {3619 get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;3620 load(code: WorkerLoaderWorkerCode): WorkerStub;3621}3622interface WorkerLoaderModule {3623 js?: string;3624 cjs?: string;3625 text?: string;3626 data?: ArrayBuffer;3627 json?: any;3628 py?: string;3629 wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;3630}3631interface WorkerLoaderWorkerCode {3632 compatibilityDate: string;3633 compatibilityFlags?: string[];3634 allowExperimental?: boolean;3635 limits?: workerdResourceLimits;3636 mainModule: string;3637 modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;3638 env?: any;3639 globalOutbound?: (Fetcher | null);3640 tails?: Fetcher[];3641 streamingTails?: Fetcher[];3642}3643interface workerdResourceLimits {3644 cpuMs?: number;3645 subRequests?: number;3646}3647/**3648* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,3649* as well as timing of subrequests and other operations.3650*3651* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)3652*/3653declare abstract class Performance {3654 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */3655 get timeOrigin(): number;3656 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */3657 now(): number;3658 /**3659 * The **`toJSON()`** method of the Performance interface is a serializer; it returns a JSON representation of the Performance object.3660 *3661 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)3662 */3663 toJSON(): object;3664}3665interface Tracing {3666 enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;3667 startActiveSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;3668 startSpan(name: string): Span;3669 Span: typeof Span;3670}3671declare abstract class Span {3672 get isTraced(): boolean;3673 setAttribute(key: string, value: boolean | number | string): this;3674 setAttributes(attributes: Record<string, boolean | number | string | undefined>): this;3675 end(): void;3676}3677/**3678 * Represents the identity of a user authenticated via Cloudflare Access.3679 * This matches the result of calling /cdn-cgi/access/get-identity.3680 *3681 * The exact structure of the returned object depends on the identity provider3682 * configuration for the Access application. The fields below represent commonly3683 * available properties, but additional provider-specific fields may be present.3684 */3685interface CloudflareAccessIdentity extends Record<string, unknown> {3686 /** The user's email address, if available from the identity provider. */3687 email?: string;3688 /** The user's display name. */3689 name?: string;3690 /** The user's unique identifier. */3691 user_uuid?: string;3692 /** The Cloudflare account ID. */3693 account_id?: string;3694 /** Login timestamp (Unix epoch seconds). */3695 iat?: number;3696 /** The user's IP address at authentication time. */3697 ip?: string;3698 /** Authentication methods used (e.g., "pwd"). */3699 amr?: string[];3700 /** Identity provider information. */3701 idp?: {3702 id: string;3703 type: string;3704 };3705 /** Geographic information about where the user authenticated. */3706 geo?: {3707 country: string;3708 };3709 /** Group memberships from the identity provider. */3710 groups?: Array<{3711 id: string;3712 name: string;3713 email?: string;3714 }>;3715 /** Device posture check results, keyed by check ID. */3716 devicePosture?: Record<string, unknown>;3717 /** True if the user connected via Cloudflare WARP. */3718 is_warp?: boolean;3719 /** True if the user is authenticated via Cloudflare Gateway. */3720 is_gateway?: boolean;3721}3722// ============================================================================3723// Agent Memory3724//3725// Public type surface for user Workers binding to an Agent Memory namespace.3726// ============================================================================3727/** Memory type — every memory is classified into exactly one. */3728type AgentMemoryMemoryType = "fact" | "event" | "instruction" | "task";3729/** Search intensity for recall. */3730type AgentMemoryThinkingLevel = "low" | "medium" | "high";3731/** Response verbosity for recall. */3732type AgentMemoryResponseLength = "short" | "medium" | "long";3733/** A conversation message passed to ingest(). */3734interface AgentMemoryMessage {3735 role: "system" | "user" | "assistant";3736 content: string;3737 /** Optional message timestamp. */3738 timestamp?: Date;3739}3740/** Raw memory content passed to remember(). */3741interface AgentMemoryIncomingMemory {3742 /** Raw memory content. The service classifies and summarizes automatically. */3743 content: string;3744 /** Optional session identifier to associate with this memory. */3745 sessionId?: string | null | undefined;3746}3747/** A stored memory returned from remember(), get(), and delete(). */3748interface AgentMemoryMemory {3749 /** Memory ID. */3750 id: string;3751 /** Memory type. */3752 type: AgentMemoryMemoryType;3753 /** Text summary. */3754 summary: string;3755 /** Memory text. */3756 content: string;3757 /** Session that created this memory. */3758 sessionId: string | null;3759 /** Memory creation time. */3760 createdAt: Date;3761 /** Memory last-update time. */3762 updatedAt: Date;3763}3764/** Single entry in a list() response. Same shape as Memory minus full content. */3765type AgentMemoryMemoryListEntry = Omit<AgentMemoryMemory, "content">;3766/** A scored memory candidate in a recall result. */3767interface AgentMemoryScoredCandidate {3768 /** Candidate ID. */3769 id: string;3770 /** Text summary. */3771 summary: string;3772 /** Session that created this candidate, when known. */3773 sessionId: string | null;3774 /** Relevance score (higher is better). Comparable only within a single query. */3775 score: number;3776}3777/** Options for the ingest() method. */3778interface AgentMemoryIngestOptions {3779 /** Session identifier to associate with memories created during ingestion. */3780 sessionId?: string | null | undefined;3781}3782/** Options for the getSummary() method. */3783interface AgentMemoryGetSummaryOptions {3784 /** Session identifier to retrieve session summary for. */3785 sessionId?: string | null | undefined;3786}3787/** Response from the getSummary() method. */3788interface AgentMemoryGetSummaryResponse {3789 /** Markdown summary. */3790 summary: string;3791}3792/**3793 * Options for the recall() method.3794 *3795 * `referenceDate` accepts a Date object, an ISO-8601 date string3796 * (YYYY-MM-DD), or a full ISO-8601 datetime string. When provided, this3797 * date is used as "today" for resolving relative time references3798 * ("how many days ago", "last week") instead of the server's wall-clock time.3799 */3800interface AgentMemoryRecallOptions {3801 /** Recall intensity: "low" (default), "medium", or "high". */3802 thinkingLevel?: AgentMemoryThinkingLevel;3803 /** Response verbosity: "short", "medium" (default), or "long". */3804 responseLength?: AgentMemoryResponseLength;3805 /** Temporal anchor for date arithmetic. */3806 referenceDate?: Date | string;3807}3808/** Response from the recall() method. */3809interface AgentMemoryRecallResult {3810 /** Number of memories retrieved. */3811 count: number;3812 /** LLM-generated answer synthesizing the matching memories. */3813 answer: string;3814 /** Matching memories ranked by relevance. */3815 candidates: AgentMemoryScoredCandidate[];3816}3817/**3818 * Options for the list() method.3819 *3820 * `cursor` is the opaque continuation token returned by the previous page;3821 * pass it back unchanged to fetch the next page. `sessionId` and `type`3822 * are exact-match filters; combining them is allowed.3823 */3824interface AgentMemoryListMemoriesOptions {3825 /** Maximum number of memories to return. Default 20, max 500. */3826 limit?: number;3827 /** Opaque cursor from a previous page. */3828 cursor?: string;3829 /** Exact-match session filter. */3830 sessionId?: string;3831 /** Exact-match memory-type filter. */3832 type?: AgentMemoryMemoryType;3833}3834/** Response from the list() method. */3835interface AgentMemoryListMemoriesResult {3836 memories: AgentMemoryMemoryListEntry[];3837 /** Continuation cursor; absent when this page exhausted the result set. */3838 cursor?: string;3839}3840/**3841 * A single Agent Memory profile, scoped to a profile name.3842 *3843 * Returned by {@link AgentMemoryNamespace.getProfile}.3844 */3845declare abstract class AgentMemoryProfile {3846 /**3847 * Retrieve a memory by ID.3848 *3849 * @param memoryId - ULID of the memory to retrieve.3850 * @throws if the memory does not exist.3851 */3852 get(memoryId: string): Promise<AgentMemoryMemory>;3853 /**3854 * Delete a memory by ID.3855 *3856 * Removes the memory and any source messages linked by the memory's3857 * source message IDs.3858 *3859 * @param memoryId - ULID of the memory to delete.3860 * @throws if the memory does not exist.3861 */3862 delete(memoryId: string): Promise<AgentMemoryMemory>;3863 /**3864 * Store a memory in this profile. The content is automatically classified,3865 * summarized, and indexed.3866 *3867 * @param memory - Raw memory content to persist.3868 */3869 remember(memory: AgentMemoryIncomingMemory): Promise<AgentMemoryMemory>;3870 /**3871 * Extract memories from a conversation.3872 *3873 * @param messages - Conversation messages to extract memories from.3874 * @param options - Optional ingest options.3875 */3876 ingest(messages: Iterable<AgentMemoryMessage>, options?: AgentMemoryIngestOptions): Promise<void>;3877 /**3878 * Get a profile summary.3879 *3880 * @param options - Optional getSummary options.3881 */3882 getSummary(options?: AgentMemoryGetSummaryOptions): Promise<AgentMemoryGetSummaryResponse>;3883 /**3884 * Recall memories in this profile.3885 *3886 * @param query - Recall query matched against memory content and keywords.3887 * @param options - Optional recall parameters.3888 * @returns Matching memories with relevance scores and a synthesized answer.3889 */3890 recall(query: string, options?: AgentMemoryRecallOptions): Promise<AgentMemoryRecallResult>;3891 /**3892 * List active memories in this profile.3893 *3894 * Returns a paginated, filterable view of stored memories. Superseded3895 * versions are excluded. Use the returned `cursor` (when present) to3896 * fetch the next page.3897 *3898 * @param options - Optional pagination and filter options.3899 */3900 list(options?: AgentMemoryListMemoriesOptions): Promise<AgentMemoryListMemoriesResult>;3901 /**3902 * Soft-delete every memory and message in this profile that is tagged3903 * with `sessionId`.3904 *3905 * Idempotent: deleting a sessionId that has no rows is a no-op.3906 *3907 * @param sessionId - Session to delete.3908 */3909 deleteSession(sessionId: string): Promise<void>;3910}3911/**3912 * Namespace-level Agent Memory binding.3913 *3914 * Used as the type of an `env.MEMORY`-style binding backed by the Agent3915 * Memory product.3916 *3917 * @example3918 * ```ts3919 * export default {3920 * async fetch(_request: Request, env: Env): Promise<Response> {3921 * const profile = await env.MEMORY.getProfile("wrangler-e2e");3922 * const summary = await profile.getSummary();3923 * return Response.json(summary);3924 * },3925 * };3926 * ```3927 */3928declare abstract class AgentMemoryNamespace {3929 /**3930 * Get a memory profile by name. Profiles are isolated by namespace and3931 * addressed by a compound key (namespaceId:profileName).3932 *3933 * @param profileName - Profile name (validated against naming rules).3934 * @returns RPC target for interacting with the profile.3935 */3936 getProfile(profileName: string): Promise<AgentMemoryProfile>;3937 /**3938 * Soft-delete a profile and schedule deferred purge. Marks all3939 * memories and messages as deleted.3940 *3941 * @param profileName - Name of the profile to delete.3942 */3943 deleteProfile(profileName: string): Promise<void>;3944}3945// ============ AI Search Error Interfaces ============3946interface AiSearchInternalError extends Error {3947}3948interface AiSearchNotFoundError extends Error {3949}3950// ============ AI Search Common Types ============3951/** A single message in a conversation-style search or chat request. */3952type AiSearchMessage = {3953 role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';3954 content: string | null;3955};3956/**3957 * Common shape for `ai_search_options` used by both single-instance and multi-instance requests.3958 * Contains retrieval, query rewrite, reranking, and cache sub-options.3959 */3960type AiSearchOptions = {3961 retrieval?: {3962 /** Which retrieval backend to use. Defaults to the instance's configured index_method. */3963 retrieval_type?: 'vector' | 'keyword' | 'hybrid';3964 /** Fusion method for combining vector + keyword results. */3965 fusion_method?: 'max' | 'rrf';3966 /** How keyword terms are combined: "and" = all terms must match, "or" = any term matches. */3967 keyword_match_mode?: 'and' | 'or';3968 /** Minimum similarity score (0-1) for a result to be included. Default 0.4. */3969 match_threshold?: number;3970 /** Maximum number of results to return (1-50). Default 10. */3971 max_num_results?: number;3972 /** Vectorize metadata filters applied to the search. */3973 filters?: VectorizeVectorMetadataFilter;3974 /** Number of surrounding chunks to include for context (0-3). Default 0. */3975 context_expansion?: number;3976 /** If true, return only item metadata without chunk text. */3977 metadata_only?: boolean;3978 /** If true (default), return empty results on retrieval failure instead of throwing. */3979 return_on_failure?: boolean;3980 /** Boost results by metadata field values. Max 3 entries. */3981 boost_by?: Array<{3982 field: string;3983 direction?: 'asc' | 'desc' | 'exists' | 'not_exists';3984 }>;3985 [key: string]: unknown;3986 };3987 query_rewrite?: {3988 enabled?: boolean;3989 model?: string;3990 rewrite_prompt?: string;3991 [key: string]: unknown;3992 };3993 reranking?: {3994 enabled?: boolean;3995 model?: string;3996 /** Match threshold (0-1, default 0.4) */3997 match_threshold?: number;3998 [key: string]: unknown;3999 };4000 cache?: {4001 enabled?: boolean;4002 cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';4003 };4004 [key: string]: unknown;4005};4006// ============ AI Search Request Types ============4007/**4008 * Request body for single-instance search.4009 * Exactly one of `query` or `messages` must be provided.4010 */4011type AiSearchSearchRequest = {4012 /** Simple query string. */4013 query: string;4014 messages?: never;4015 ai_search_options?: AiSearchOptions;4016} | {4017 query?: never;4018 /** Conversation-style input. At least one user message with non-empty content is required. */4019 messages: AiSearchMessage[];4020 ai_search_options?: AiSearchOptions;4021};4022type AiSearchChatCompletionsRequest = {4023 messages: AiSearchMessage[];4024 model?: string;4025 stream?: boolean;4026 ai_search_options?: AiSearchOptions;4027 [key: string]: unknown;4028};4029// ============ AI Search Multi-Instance Types (Namespace-Scoped) ============4030/** `ai_search_options` shape for multi-instance requests — requires `instance_ids`. */4031type AiSearchMultiSearchOptions = AiSearchOptions & {4032 /** Instance IDs to search across (1-10). */4033 instance_ids: string[];4034};4035/**4036 * Request for searching across multiple instances within a namespace.4037 * `ai_search_options` is required and must include `instance_ids`.4038 * Exactly one of `query` or `messages` must be provided.4039 */4040type AiSearchMultiSearchRequest = {4041 /** Simple query string. */4042 query: string;4043 messages?: never;4044 ai_search_options: AiSearchMultiSearchOptions;4045} | {4046 query?: never;4047 /** Conversation-style input. */4048 messages: AiSearchMessage[];4049 ai_search_options: AiSearchMultiSearchOptions;4050};4051/** A search result chunk tagged with the instance it originated from. */4052type AiSearchMultiSearchChunk = AiSearchSearchResponse['chunks'][number] & {4053 instance_id: string;4054};4055/** Describes a per-instance error during a multi-instance operation. */4056type AiSearchMultiSearchError = {4057 instance_id: string;4058 message: string;4059};4060/** Response from a multi-instance search, with chunks tagged by instance and optional partial-failure errors. */4061type AiSearchMultiSearchResponse = {4062 search_query: string;4063 chunks: AiSearchMultiSearchChunk[];4064 errors?: AiSearchMultiSearchError[];4065};4066/** Request for chat completions across multiple instances within a namespace. `ai_search_options` is required and must include `instance_ids`. */4067type AiSearchMultiChatCompletionsRequest = Omit<AiSearchChatCompletionsRequest, 'ai_search_options'> & {4068 ai_search_options: AiSearchMultiSearchOptions;4069};4070/** Response from multi-instance chat completions, with chunks tagged by instance and optional partial-failure errors. */4071type AiSearchMultiChatCompletionsResponse = Omit<AiSearchChatCompletionsResponse, 'chunks'> & {4072 chunks: AiSearchMultiSearchChunk[];4073 errors?: AiSearchMultiSearchError[];4074};4075// ============ AI Search Response Types ============4076type AiSearchSearchResponse = {4077 search_query: string;4078 chunks: Array<{4079 id: string;4080 type: string;4081 /** Match score (0-1) */4082 score: number;4083 text: string;4084 item: {4085 timestamp?: number;4086 key: string;4087 metadata?: Record<string, unknown>;4088 };4089 scoring_details?: {4090 /** Keyword match score (0-1) */4091 keyword_score?: number;4092 /** Vector similarity score (0-1) */4093 vector_score?: number;4094 /** Keyword rank position */4095 keyword_rank?: number;4096 /** Vector rank position */4097 vector_rank?: number;4098 /** Reranking model score */4099 reranking_score?: number;4100 /** Fusion method used to combine results */4101 fusion_method?: 'rrf' | 'max';4102 [key: string]: unknown;4103 };4104 }>;4105};4106type AiSearchChatCompletionsResponse = {4107 id?: string;4108 object?: string;4109 model?: string;4110 choices: Array<{4111 index?: number;4112 message: {4113 role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';4114 content: string | null;4115 [key: string]: unknown;4116 };4117 [key: string]: unknown;4118 }>;4119 chunks: AiSearchSearchResponse['chunks'];4120 [key: string]: unknown;4121};4122type AiSearchStatsResponse = {4123 queued?: number;4124 running?: number;4125 completed?: number;4126 error?: number;4127 skipped?: number;4128 outdated?: number;4129 last_activity?: string;4130 /** Storage engine statistics. */4131 engine?: {4132 vectorize?: {4133 vectorsCount: number;4134 dimensions: number;4135 };4136 r2?: {4137 payloadSizeBytes: number;4138 metadataSizeBytes: number;4139 objectCount: number;4140 };4141 };4142};4143// ============ AI Search Instance Info Types ============4144type AiSearchInstanceInfo = {4145 id: string;4146 type?: 'r2' | 'web-crawler' | string;4147 source?: string;4148 source_params?: unknown;4149 paused?: boolean;4150 status?: string;4151 namespace?: string;4152 created_at?: string;4153 modified_at?: string;4154 token_id?: string;4155 ai_gateway_id?: string;4156 rewrite_query?: boolean;4157 reranking?: boolean;4158 embedding_model?: string;4159 ai_search_model?: string;4160 rewrite_model?: string;4161 reranking_model?: string;4162 /** @deprecated Use index_method instead. */4163 hybrid_search_enabled?: boolean;4164 /** Controls which storage backends are active. */4165 index_method?: {4166 vector?: boolean;4167 keyword?: boolean;4168 };4169 /** Fusion method for combining vector and keyword results. */4170 fusion_method?: 'max' | 'rrf';4171 indexing_options?: {4172 keyword_tokenizer?: 'porter' | 'trigram';4173 } | null;4174 retrieval_options?: {4175 keyword_match_mode?: 'and' | 'or';4176 boost_by?: Array<{4177 field: string;4178 direction?: 'asc' | 'desc' | 'exists' | 'not_exists';4179 }>;4180 } | null;4181 chunk?: boolean;4182 chunk_size?: number;4183 chunk_overlap?: number;4184 score_threshold?: number;4185 max_num_results?: number;4186 cache?: boolean;4187 cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';4188 custom_metadata?: Array<{4189 field_name: string;4190 data_type: 'text' | 'number' | 'boolean' | 'datetime';4191 }>;4192 /** Sync interval in seconds. */4193 sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400;4194 metadata?: Record<string, unknown>;4195 [key: string]: unknown;4196};4197/** Pagination, search, and ordering parameters for listing instances within a namespace. */4198type AiSearchListInstancesParams = {4199 page?: number;4200 per_page?: number;4201 /** Search instances by ID. */4202 search?: string;4203 /** Field to sort by. */4204 order_by?: 'created_at';4205 /** Sort direction. */4206 order_by_direction?: 'asc' | 'desc';4207};4208type AiSearchListResponse = {4209 result: AiSearchInstanceInfo[];4210 result_info?: {4211 count: number;4212 page: number;4213 per_page: number;4214 total_count: number;4215 };4216};4217// ============ AI Search Config Types ============4218type AiSearchConfig = {4219 /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */4220 id: string;4221 /** Instance type. Omit to create with built-in storage. */4222 type?: 'r2' | 'web-crawler' | string;4223 /** Source URL (required for web-crawler type). */4224 source?: string;4225 source_params?: unknown;4226 /** Token ID (UUID format) */4227 token_id?: string;4228 ai_gateway_id?: string;4229 /** Enable query rewriting (default false) */4230 rewrite_query?: boolean;4231 /** Enable reranking (default false) */4232 reranking?: boolean;4233 embedding_model?: string;4234 ai_search_model?: string;4235 rewrite_model?: string;4236 reranking_model?: string;4237 /** @deprecated Use index_method instead. */4238 hybrid_search_enabled?: boolean;4239 /** Controls which storage backends are used during indexing. Defaults to vector-only. */4240 index_method?: {4241 vector?: boolean;4242 keyword?: boolean;4243 };4244 /** Fusion method for combining vector and keyword results. "rrf" = reciprocal rank fusion (default), "max" = maximum score. */4245 fusion_method?: 'max' | 'rrf';4246 indexing_options?: {4247 keyword_tokenizer?: 'porter' | 'trigram';4248 } | null;4249 retrieval_options?: {4250 keyword_match_mode?: 'and' | 'or';4251 boost_by?: Array<{4252 field: string;4253 direction?: 'asc' | 'desc' | 'exists' | 'not_exists';4254 }>;4255 } | null;4256 chunk?: boolean;4257 chunk_size?: number;4258 chunk_overlap?: number;4259 /** Minimum similarity score (0-1) for a result to be included. */4260 score_threshold?: number;4261 max_num_results?: number;4262 cache?: boolean;4263 /** Similarity threshold for cache hits. Stricter = fewer cache hits but higher relevance. */4264 cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';4265 custom_metadata?: Array<{4266 field_name: string;4267 data_type: 'text' | 'number' | 'boolean' | 'datetime';4268 }>;4269 namespace?: string;4270 /** Sync interval in seconds. 3600=1h, 7200=2h, 14400=4h, 21600=6h, 43200=12h, 86400=24h. */4271 sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400;4272 metadata?: Record<string, unknown>;4273 [key: string]: unknown;4274};4275// ============ AI Search Item Types ============4276type AiSearchItemInfo = {4277 id: string;4278 key: string;4279 status: 'completed' | 'error' | 'skipped' | 'queued' | 'running' | 'outdated';4280 next_action?: 'INDEX' | 'DELETE' | null;4281 error?: string;4282 checksum?: string;4283 namespace?: string;4284 chunks_count?: number | null;4285 file_size?: number | null;4286 source_id?: string | null;4287 last_seen_at?: string;4288 created_at?: string;4289 metadata?: Record<string, unknown>;4290 [key: string]: unknown;4291};4292type AiSearchItemContentResult = {4293 body: ReadableStream;4294 contentType: string;4295 filename: string;4296 size: number;4297};4298type AiSearchUploadItemOptions = {4299 metadata?: Record<string, unknown>;4300};4301type AiSearchListItemsParams = {4302 page?: number;4303 per_page?: number;4304 /** Search items by key name. */4305 search?: string;4306 /** Sort order for results. */4307 sort_by?: 'status' | 'modified_at';4308 /** Filter items by processing status. */4309 status?: 'queued' | 'running' | 'completed' | 'error' | 'skipped' | 'outdated';4310 /** Filter items by source (e.g. "builtin" or "web-crawler:https://example.com"). */4311 source?: string;4312 /** JSON-encoded Vectorize filter for metadata filtering. */4313 metadata_filter?: string;4314 /** Filter items by their unique ID. Returns at most one item. */4315 item_id?: string;4316 /**4317 * Filter items by their exact key (object key / filename). Keys are unique4318 * per source, so combine with `source` to disambiguate across data sources.4319 */4320 key?: string;4321};4322type AiSearchListItemsResponse = {4323 result: AiSearchItemInfo[];4324 result_info?: {4325 count: number;4326 page: number;4327 per_page: number;4328 total_count: number;4329 };4330};4331// ============ AI Search Item Logs Types ============4332type AiSearchItemLogsParams = {4333 /** Maximum number of log entries to return (1-100, default 50). */4334 limit?: number;4335 /** Opaque cursor for pagination. Pass the `cursor` value from a previous response. */4336 cursor?: string;4337};4338type AiSearchItemLog = {4339 timestamp: string;4340 action: string;4341 message: string;4342 fileKey?: string;4343 chunkCount?: number;4344 processingTimeMs?: number;4345 errorType?: string;4346};4347/** Paginated response for item processing logs (cursor-based). */4348type AiSearchItemLogsResponse = {4349 result: AiSearchItemLog[];4350 result_info: {4351 count: number;4352 per_page: number;4353 cursor: string | null;4354 truncated: boolean;4355 };4356};4357// ============ AI Search Item Chunks Types ============4358type AiSearchItemChunksParams = {4359 /** Maximum number of chunks to return (1-100, default 20). */4360 limit?: number;4361 /** Offset into the chunks list (default 0). */4362 offset?: number;4363};4364/** A single indexed chunk belonging to an item, including its text content and byte range. */4365type AiSearchItemChunk = {4366 id: string;4367 text: string;4368 start_byte: number;4369 end_byte: number;4370 item?: {4371 timestamp?: number;4372 key: string;4373 metadata?: Record<string, unknown>;4374 };4375};4376/** Paginated response for item chunks (offset-based). */4377type AiSearchItemChunksResponse = {4378 result: AiSearchItemChunk[];4379 result_info: {4380 count: number;4381 total: number;4382 limit: number;4383 offset: number;4384 };4385};4386// ============ AI Search Job Types ============4387type AiSearchJobInfo = {4388 id: string;4389 source: 'user' | 'schedule';4390 description?: string;4391 last_seen_at?: string;4392 started_at?: string;4393 ended_at?: string;4394 end_reason?: string;4395};4396type AiSearchJobLog = {4397 id: number;4398 message: string;4399 message_type: number;4400 created_at: number;4401};4402type AiSearchCreateJobParams = {4403 description?: string;4404};4405type AiSearchListJobsParams = {4406 page?: number;4407 per_page?: number;4408};4409type AiSearchListJobsResponse = {4410 result: AiSearchJobInfo[];4411 result_info?: {4412 count: number;4413 page: number;4414 per_page: number;4415 total_count: number;4416 };4417};4418type AiSearchJobLogsParams = {4419 page?: number;4420 per_page?: number;4421};4422type AiSearchJobLogsResponse = {4423 result: AiSearchJobLog[];4424 result_info?: {4425 count: number;4426 page: number;4427 per_page: number;4428 total_count: number;4429 };4430};4431// ============ AI Search Sub-Service Classes ============4432/**4433 * Single item service for an AI Search instance.4434 * Provides info, download, sync, logs, and chunks operations on a specific item.4435 */4436declare abstract class AiSearchItem {4437 /** Get metadata about this item. */4438 info(): Promise<AiSearchItemInfo>;4439 /**4440 * Download the item's content.4441 * @returns Object with body stream, content type, filename, and size.4442 */4443 download(): Promise<AiSearchItemContentResult>;4444 /**4445 * Trigger re-indexing of this item.4446 * @returns The updated item info.4447 */4448 sync(): Promise<AiSearchItemInfo>;4449 /**4450 * Retrieve processing logs for this item (cursor-based pagination).4451 * @param params Optional pagination parameters (limit, cursor).4452 * @returns Paginated log entries for this item.4453 */4454 logs(params?: AiSearchItemLogsParams): Promise<AiSearchItemLogsResponse>;4455 /**4456 * List indexed chunks for this item (offset-based pagination).4457 * @param params Optional pagination parameters (limit, offset).4458 * @returns Paginated chunk entries for this item.4459 */4460 chunks(params?: AiSearchItemChunksParams): Promise<AiSearchItemChunksResponse>;4461}4462/**4463 * Items collection service for an AI Search instance.4464 * Provides list, upload, and access to individual items.4465 */4466declare abstract class AiSearchItems {4467 /** List items in this instance. */4468 list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;4469 /**4470 * Upload a file as an item. Behaves as an upsert: if an item with the same4471 * filename already exists, it is overwritten and re-indexed.4472 * @param name Filename for the uploaded item.4473 * @param content File content as a ReadableStream, Blob, or string.4474 * @param options Optional metadata to attach to the item.4475 * @returns The created item info.4476 */4477 upload(name: string, content: ReadableStream | Blob | string, options?: AiSearchUploadItemOptions): Promise<AiSearchItemInfo>;4478 /**4479 * Upload a file and poll until processing completes.4480 * Behaves as an upsert: if an item with the same filename already exists,4481 * it is overwritten and re-indexed.4482 * @param name Filename for the uploaded item.4483 * @param content File content as a ReadableStream, Blob, or string.4484 * @param options Optional metadata and polling configuration.4485 * @returns The item info after processing completes (or timeout).4486 */4487 uploadAndPoll(name: string, content: ReadableStream | Blob | string, options?: AiSearchUploadItemOptions & {4488 /** Polling interval in milliseconds (default 1000). */4489 pollIntervalMs?: number;4490 /** Maximum time to wait in milliseconds (default 30000). */4491 timeoutMs?: number;4492 }): Promise<AiSearchItemInfo>;4493 /**4494 * Get an item by ID.4495 * @param itemId The item identifier.4496 * @returns Item service for info, download, sync, logs, and chunks operations.4497 */4498 get(itemId: string): AiSearchItem;4499 /**4500 * Delete an item from the instance.4501 * @param itemId The item identifier.4502 */4503 delete(itemId: string): Promise<void>;4504}4505/**4506 * Single job service for an AI Search instance.4507 * Provides info, logs, and cancel operations for a specific job.4508 */4509declare abstract class AiSearchJob {4510 /** Get metadata about this job. */4511 info(): Promise<AiSearchJobInfo>;4512 /** Get logs for this job. */4513 logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;4514 /**4515 * Cancel a running job.4516 * @returns The updated job info.4517 * @throws AiSearchNotFoundError if the job does not exist.4518 */4519 cancel(): Promise<AiSearchJobInfo>;4520}4521/**4522 * Jobs collection service for an AI Search instance.4523 * Provides list, create, and access to individual jobs.4524 */4525declare abstract class AiSearchJobs {4526 /** List jobs for this instance. */4527 list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;4528 /**4529 * Create a new indexing job.4530 * @param params Optional job parameters.4531 * @returns The created job info.4532 */4533 create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;4534 /**4535 * Get a job by ID.4536 * @param jobId The job identifier.4537 * @returns Job service for info, logs, and cancel operations.4538 */4539 get(jobId: string): AiSearchJob;4540}4541// ============ AI Search Binding Classes ============4542/**4543 * Instance-level AI Search service.4544 *4545 * Used as:4546 * - The return type of `AiSearchNamespace.get(name)` (namespace binding)4547 * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)4548 *4549 * Provides search, chat, update, stats, items, and jobs operations.4550 *4551 * @example4552 * ```ts4553 * // Via namespace binding4554 * const instance = env.AI_SEARCH.get("blog");4555 * const results = await instance.search({4556 * query: "How does caching work?",4557 * });4558 *4559 * // Via single instance binding4560 * const results = await env.BLOG_SEARCH.search({4561 * messages: [{ role: "user", content: "How does caching work?" }],4562 * });4563 * ```4564 */4565declare abstract class AiSearchInstance {4566 /**4567 * Search the AI Search instance for relevant chunks.4568 * @param params Search request with query or messages and optional AI search options.4569 * @returns Search response with matching chunks and search query.4570 */4571 search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;4572 /**4573 * Generate chat completions with AI Search context (streaming).4574 * @param params Chat completions request with stream: true.4575 * @returns ReadableStream of server-sent events.4576 */4577 chatCompletions(params: AiSearchChatCompletionsRequest & {4578 stream: true;4579 }): Promise<ReadableStream>;4580 /**4581 * Generate chat completions with AI Search context.4582 * @param params Chat completions request.4583 * @returns Chat completion response with choices and RAG chunks.4584 */4585 chatCompletions(params: AiSearchChatCompletionsRequest): Promise<AiSearchChatCompletionsResponse>;4586 /**4587 * Update the instance configuration.4588 * @param config Partial configuration to update.4589 * @returns Updated instance info.4590 */4591 update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;4592 /** Get metadata about this instance. */4593 info(): Promise<AiSearchInstanceInfo>;4594 /**4595 * Get instance statistics (item count, indexing status, etc.).4596 * @returns Statistics with counts per status, last activity time, and engine details.4597 */4598 stats(): Promise<AiSearchStatsResponse>;4599 /** Items collection — list, upload, and manage items in this instance. */4600 get items(): AiSearchItems;4601 /** Jobs collection — list, create, and inspect indexing jobs. */4602 get jobs(): AiSearchJobs;4603}4604/**4605 * Namespace-level AI Search service.4606 *4607 * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).4608 * Scoped to a single namespace. Provides dynamic instance access, creation, deletion,4609 * and multi-instance search/chat operations.4610 *4611 * @example4612 * ```ts4613 * // Access an instance within the namespace4614 * const blog = env.AI_SEARCH.get("blog");4615 * const results = await blog.search({ query: "How does caching work?" });4616 *4617 * // List all instances in the namespace4618 * const instances = await env.AI_SEARCH.list();4619 *4620 * // Create a new instance with built-in storage4621 * const tenant = await env.AI_SEARCH.create({ id: "tenant-123" });4622 *4623 * // Upload items into the instance4624 * await tenant.items.upload("doc.pdf", fileContent);4625 *4626 * // Search across multiple instances4627 * const multi = await env.AI_SEARCH.search({4628 * query: "caching",4629 * ai_search_options: { instance_ids: ["blog", "docs"] },4630 * });4631 *4632 * // Delete an instance4633 * await env.AI_SEARCH.delete("tenant-123");4634 * ```4635 */4636declare abstract class AiSearchNamespace {4637 /**4638 * Get an instance by name within the bound namespace.4639 * @param name Instance name.4640 * @returns Instance service for search, chat, update, stats, items, and jobs.4641 */4642 get(name: string): AiSearchInstance;4643 /**4644 * List instances in the bound namespace.4645 * @param params Optional pagination, search, and ordering parameters.4646 * @returns Array of instance metadata with pagination info.4647 */4648 list(params?: AiSearchListInstancesParams): Promise<AiSearchListResponse>;4649 /**4650 * Create a new instance within the bound namespace.4651 * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.4652 * @returns Instance service for the newly created instance.4653 *4654 * @example4655 * ```ts4656 * // Create with built-in storage (upload items manually)4657 * const instance = await env.AI_SEARCH.create({ id: "my-search" });4658 *4659 * // Create with web crawler source4660 * const instance = await env.AI_SEARCH.create({4661 * id: "docs-search",4662 * type: "web-crawler",4663 * source: "https://developers.cloudflare.com",4664 * });4665 * ```4666 */4667 create(config: AiSearchConfig): Promise<AiSearchInstance>;4668 /**4669 * Delete an instance from the bound namespace.4670 * @param name Instance name to delete.4671 */4672 delete(name: string): Promise<void>;4673 /**4674 * Search across multiple instances within the bound namespace.4675 * Fans out to the specified instance_ids and merges results.4676 * @param params Search request with required `ai_search_options.instance_ids`.4677 * @returns Search response with chunks tagged by instance_id and optional partial-failure errors.4678 */4679 search(params: AiSearchMultiSearchRequest): Promise<AiSearchMultiSearchResponse>;4680 /**4681 * Generate chat completions across multiple instances within the bound namespace (streaming).4682 * Fans out to the specified instance_ids, merges context, and generates a response.4683 * @param params Chat completions request with stream: true and required `ai_search_options.instance_ids`.4684 * @returns ReadableStream of server-sent events.4685 */4686 chatCompletions(params: AiSearchMultiChatCompletionsRequest & {4687 stream: true;4688 }): Promise<ReadableStream>;4689 /**4690 * Generate chat completions across multiple instances within the bound namespace.4691 * Fans out to the specified instance_ids, merges context, and generates a response.4692 * @param params Chat completions request with required `ai_search_options.instance_ids`.4693 * @returns Chat completion response with choices, chunks tagged by instance_id, and optional partial-failure errors.4694 */4695 chatCompletions(params: AiSearchMultiChatCompletionsRequest): Promise<AiSearchMultiChatCompletionsResponse>;4696}4697type AiImageClassificationInput = {4698 image: number[];4699};4700type AiImageClassificationOutput = {4701 score?: number;4702 label?: string;4703}[];4704declare abstract class BaseAiImageClassification {4705 inputs: AiImageClassificationInput;4706 postProcessedOutputs: AiImageClassificationOutput;4707}4708type AiImageToTextInput = {4709 image: number[];4710 prompt?: string;4711 max_tokens?: number;4712 temperature?: number;4713 top_p?: number;4714 top_k?: number;4715 seed?: number;4716 repetition_penalty?: number;4717 frequency_penalty?: number;4718 presence_penalty?: number;4719 raw?: boolean;4720 messages?: RoleScopedChatInput[];4721};4722type AiImageToTextOutput = {4723 description: string;4724};4725declare abstract class BaseAiImageToText {4726 inputs: AiImageToTextInput;4727 postProcessedOutputs: AiImageToTextOutput;4728}4729type AiImageTextToTextInput = {4730 image: string;4731 prompt?: string;4732 max_tokens?: number;4733 temperature?: number;4734 ignore_eos?: boolean;4735 top_p?: number;4736 top_k?: number;4737 seed?: number;4738 repetition_penalty?: number;4739 frequency_penalty?: number;4740 presence_penalty?: number;4741 raw?: boolean;4742 messages?: RoleScopedChatInput[];4743};4744type AiImageTextToTextOutput = {4745 description: string;4746};4747declare abstract class BaseAiImageTextToText {4748 inputs: AiImageTextToTextInput;4749 postProcessedOutputs: AiImageTextToTextOutput;4750}4751type AiMultimodalEmbeddingsInput = {4752 image: string;4753 text: string[];4754};4755type AiIMultimodalEmbeddingsOutput = {4756 data: number[][];4757 shape: number[];4758};4759declare abstract class BaseAiMultimodalEmbeddings {4760 inputs: AiImageTextToTextInput;4761 postProcessedOutputs: AiImageTextToTextOutput;4762}4763type AiObjectDetectionInput = {4764 image: number[];4765};4766type AiObjectDetectionOutput = {4767 score?: number;4768 label?: string;4769}[];4770declare abstract class BaseAiObjectDetection {4771 inputs: AiObjectDetectionInput;4772 postProcessedOutputs: AiObjectDetectionOutput;4773}4774type AiSentenceSimilarityInput = {4775 source: string;4776 sentences: string[];4777};4778type AiSentenceSimilarityOutput = number[];4779declare abstract class BaseAiSentenceSimilarity {4780 inputs: AiSentenceSimilarityInput;4781 postProcessedOutputs: AiSentenceSimilarityOutput;4782}4783type AiAutomaticSpeechRecognitionInput = {4784 audio: number[];4785};4786type AiAutomaticSpeechRecognitionOutput = {4787 text?: string;4788 words?: {4789 word: string;4790 start: number;4791 end: number;4792 }[];4793 vtt?: string;4794};4795declare abstract class BaseAiAutomaticSpeechRecognition {4796 inputs: AiAutomaticSpeechRecognitionInput;4797 postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;4798}4799type AiSummarizationInput = {4800 input_text: string;4801 max_length?: number;4802};4803type AiSummarizationOutput = {4804 summary: string;4805};4806declare abstract class BaseAiSummarization {4807 inputs: AiSummarizationInput;4808 postProcessedOutputs: AiSummarizationOutput;4809}4810type AiTextClassificationInput = {4811 text: string;4812};4813type AiTextClassificationOutput = {4814 score?: number;4815 label?: string;4816}[];4817declare abstract class BaseAiTextClassification {4818 inputs: AiTextClassificationInput;4819 postProcessedOutputs: AiTextClassificationOutput;4820}4821type AiTextEmbeddingsInput = {4822 text: string | string[];4823};4824type AiTextEmbeddingsOutput = {4825 shape: number[];4826 data: number[][];4827};4828declare abstract class BaseAiTextEmbeddings {4829 inputs: AiTextEmbeddingsInput;4830 postProcessedOutputs: AiTextEmbeddingsOutput;4831}4832type RoleScopedChatInput = {4833 role: "user" | "assistant" | "system" | "tool" | (string & NonNullable<unknown>);4834 content: string;4835 name?: string;4836};4837type AiTextGenerationToolLegacyInput = {4838 name: string;4839 description: string;4840 parameters?: {4841 type: "object" | (string & NonNullable<unknown>);4842 properties: {4843 [key: string]: {4844 type: string;4845 description?: string;4846 };4847 };4848 required: string[];4849 };4850};4851type AiTextGenerationToolInput = {4852 type: "function" | (string & NonNullable<unknown>);4853 function: {4854 name: string;4855 description: string;4856 parameters?: {4857 type: "object" | (string & NonNullable<unknown>);4858 properties: {4859 [key: string]: {4860 type: string;4861 description?: string;4862 };4863 };4864 required: string[];4865 };4866 };4867};4868type AiTextGenerationFunctionsInput = {4869 name: string;4870 code: string;4871};4872type AiTextGenerationResponseFormat = {4873 type: string;4874 json_schema?: any;4875};4876type AiTextGenerationInput = {4877 prompt?: string;4878 raw?: boolean;4879 stream?: boolean;4880 max_tokens?: number;4881 temperature?: number;4882 top_p?: number;4883 top_k?: number;4884 seed?: number;4885 repetition_penalty?: number;4886 frequency_penalty?: number;4887 presence_penalty?: number;4888 messages?: RoleScopedChatInput[];4889 response_format?: AiTextGenerationResponseFormat;4890 tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>);4891 functions?: AiTextGenerationFunctionsInput[];4892};4893type AiTextGenerationToolLegacyOutput = {4894 name: string;4895 arguments: unknown;4896};4897type AiTextGenerationToolOutput = {4898 id: string;4899 type: "function";4900 function: {4901 name: string;4902 arguments: string;4903 };4904};4905type UsageTags = {4906 prompt_tokens: number;4907 completion_tokens: number;4908 total_tokens: number;4909};4910type AiTextGenerationOutput = {4911 response?: string;4912 tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[];4913 usage?: UsageTags;4914};4915declare abstract class BaseAiTextGeneration {4916 inputs: AiTextGenerationInput;4917 postProcessedOutputs: AiTextGenerationOutput;4918}4919type AiTextToSpeechInput = {4920 prompt: string;4921 lang?: string;4922};4923type AiTextToSpeechOutput = Uint8Array | {4924 audio: string;4925};4926declare abstract class BaseAiTextToSpeech {4927 inputs: AiTextToSpeechInput;4928 postProcessedOutputs: AiTextToSpeechOutput;4929}4930type AiTextToImageInput = {4931 prompt: string;4932 negative_prompt?: string;4933 height?: number;4934 width?: number;4935 image?: number[];4936 image_b64?: string;4937 mask?: number[];4938 num_steps?: number;4939 strength?: number;4940 guidance?: number;4941 seed?: number;4942};4943type AiTextToImageOutput = ReadableStream<Uint8Array>;4944declare abstract class BaseAiTextToImage {4945 inputs: AiTextToImageInput;4946 postProcessedOutputs: AiTextToImageOutput;4947}4948type AiTranslationInput = {4949 text: string;4950 target_lang: string;4951 source_lang?: string;4952};4953type AiTranslationOutput = {4954 translated_text?: string;4955};4956declare abstract class BaseAiTranslation {4957 inputs: AiTranslationInput;4958 postProcessedOutputs: AiTranslationOutput;4959}4960/**4961 * Workers AI support for OpenAI's Chat Completions API4962 */4963type ChatCompletionContentPartText = {4964 type: "text";4965 text: string;4966};4967type ChatCompletionContentPartImage = {4968 type: "image_url";4969 image_url: {4970 url: string;4971 detail?: "auto" | "low" | "high";4972 };4973};4974type ChatCompletionContentPartInputAudio = {4975 type: "input_audio";4976 input_audio: {4977 /** Base64 encoded audio data. */4978 data: string;4979 format: "wav" | "mp3";4980 };4981};4982type ChatCompletionContentPartFile = {4983 type: "file";4984 file: {4985 /** Base64 encoded file data. */4986 file_data?: string;4987 /** The ID of an uploaded file. */4988 file_id?: string;4989 filename?: string;4990 };4991};4992type ChatCompletionContentPartRefusal = {4993 type: "refusal";4994 refusal: string;4995};4996type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage | ChatCompletionContentPartInputAudio | ChatCompletionContentPartFile;4997type FunctionDefinition = {4998 name: string;4999 description?: string;5000 parameters?: Record<string, unknown>;5001 strict?: boolean | null;5002};5003type ChatCompletionFunctionTool = {5004 type: "function";5005 function: FunctionDefinition;5006};5007type ChatCompletionCustomToolGrammarFormat = {5008 type: "grammar";5009 grammar: {5010 definition: string;5011 syntax: "lark" | "regex";5012 };5013};5014type ChatCompletionCustomToolTextFormat = {5015 type: "text";5016};5017type ChatCompletionCustomToolFormat = ChatCompletionCustomToolTextFormat | ChatCompletionCustomToolGrammarFormat;5018type ChatCompletionCustomTool = {5019 type: "custom";5020 custom: {5021 name: string;5022 description?: string;5023 format?: ChatCompletionCustomToolFormat;5024 };5025};5026type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool;5027type ChatCompletionMessageFunctionToolCall = {5028 id: string;5029 type: "function";5030 function: {5031 name: string;5032 /** JSON-encoded arguments string. */5033 arguments: string;5034 };5035};5036type ChatCompletionMessageCustomToolCall = {5037 id: string;5038 type: "custom";5039 custom: {5040 name: string;5041 input: string;5042 };5043};5044type ChatCompletionMessageToolCall = ChatCompletionMessageFunctionToolCall | ChatCompletionMessageCustomToolCall;5045type ChatCompletionToolChoiceFunction = {5046 type: "function";5047 function: {5048 name: string;5049 };5050};5051type ChatCompletionToolChoiceCustom = {5052 type: "custom";5053 custom: {5054 name: string;5055 };5056};5057type ChatCompletionToolChoiceAllowedTools = {5058 type: "allowed_tools";5059 allowed_tools: {5060 mode: "auto" | "required";5061 tools: Array<Record<string, unknown>>;5062 };5063};5064type ChatCompletionToolChoiceOption = "none" | "auto" | "required" | ChatCompletionToolChoiceFunction | ChatCompletionToolChoiceCustom | ChatCompletionToolChoiceAllowedTools;5065type DeveloperMessage = {5066 role: "developer";5067 content: string | Array<{5068 type: "text";5069 text: string;5070 }>;5071 name?: string;5072};5073type SystemMessage = {5074 role: "system";5075 content: string | Array<{5076 type: "text";5077 text: string;5078 }>;5079 name?: string;5080};5081/**5082 * Permissive merged content part used inside UserMessage arrays.5083 *5084 * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination5085 * inside nested array items does not correctly match different branches for5086 * different array elements, so the schema uses a single merged object.5087 */5088type UserMessageContentPart = {5089 type: "text" | "image_url" | "input_audio" | "file";5090 text?: string;5091 image_url?: {5092 url?: string;5093 detail?: "auto" | "low" | "high";5094 };5095 input_audio?: {5096 data?: string;5097 format?: "wav" | "mp3";5098 };5099 file?: {5100 file_data?: string;5101 file_id?: string;5102 filename?: string;5103 };5104};5105type UserMessage = {5106 role: "user";5107 content: string | Array<UserMessageContentPart>;5108 name?: string;5109};5110type AssistantMessageContentPart = {5111 type: "text" | "refusal";5112 text?: string;5113 refusal?: string;5114};5115type AssistantMessage = {5116 role: "assistant";5117 content?: string | null | Array<AssistantMessageContentPart>;5118 refusal?: string | null;5119 name?: string;5120 audio?: {5121 id: string;5122 };5123 tool_calls?: Array<ChatCompletionMessageToolCall>;5124 function_call?: {5125 name: string;5126 arguments: string;5127 };5128};5129type ToolMessage = {5130 role: "tool";5131 content: string | Array<{5132 type: "text";5133 text: string;5134 }>;5135 tool_call_id: string;5136};5137type FunctionMessage = {5138 role: "function";5139 content: string;5140 name: string;5141};5142type ChatCompletionMessageParam = DeveloperMessage | SystemMessage | UserMessage | AssistantMessage | ToolMessage | FunctionMessage;5143type ChatCompletionsResponseFormatText = {5144 type: "text";5145};5146type ChatCompletionsResponseFormatJSONObject = {5147 type: "json_object";5148};5149type ResponseFormatJSONSchema = {5150 type: "json_schema";5151 json_schema: {5152 name: string;5153 description?: string;5154 schema?: Record<string, unknown>;5155 strict?: boolean | null;5156 };5157};5158type ResponseFormat = ChatCompletionsResponseFormatText | ChatCompletionsResponseFormatJSONObject | ResponseFormatJSONSchema;5159type ChatCompletionsStreamOptions = {5160 include_usage?: boolean;5161 include_obfuscation?: boolean;5162};5163type PredictionContent = {5164 type: "content";5165 content: string | Array<{5166 type: "text";5167 text: string;5168 }>;5169};5170type AudioParams = {5171 voice: string | {5172 id: string;5173 };5174 format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";5175};5176type WebSearchUserLocation = {5177 type: "approximate";5178 approximate: {5179 city?: string;5180 country?: string;5181 region?: string;5182 timezone?: string;5183 };5184};5185type WebSearchOptions = {5186 search_context_size?: "low" | "medium" | "high";5187 user_location?: WebSearchUserLocation;5188};5189type ChatTemplateKwargs = {5190 /** Whether to enable reasoning, enabled by default. */5191 enable_thinking?: boolean;5192 /** If false, preserves reasoning context between turns. */5193 clear_thinking?: boolean;5194};5195/** Shared optional properties used by both Prompt and Messages input branches. */5196type ChatCompletionsCommonOptions = {5197 model?: string;5198 audio?: AudioParams;5199 frequency_penalty?: number | null;5200 logit_bias?: Record<string, unknown> | null;5201 logprobs?: boolean | null;5202 top_logprobs?: number | null;5203 max_tokens?: number | null;5204 max_completion_tokens?: number | null;5205 metadata?: Record<string, unknown> | null;5206 modalities?: Array<"text" | "audio"> | null;5207 n?: number | null;5208 parallel_tool_calls?: boolean;5209 prediction?: PredictionContent;5210 presence_penalty?: number | null;5211 reasoning_effort?: "low" | "medium" | "high" | null;5212 chat_template_kwargs?: ChatTemplateKwargs;5213 response_format?: ResponseFormat;5214 seed?: number | null;5215 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;5216 stop?: string | Array<string> | null;5217 store?: boolean | null;5218 stream?: boolean | null;5219 stream_options?: ChatCompletionsStreamOptions;5220 temperature?: number | null;5221 tool_choice?: ChatCompletionToolChoiceOption;5222 tools?: Array<ChatCompletionTool>;5223 top_p?: number | null;5224 user?: string;5225 web_search_options?: WebSearchOptions;5226 function_call?: "none" | "auto" | {5227 name: string;5228 };5229 functions?: Array<FunctionDefinition>;5230};5231type PromptTokensDetails = {5232 cached_tokens?: number;5233 audio_tokens?: number;5234};5235type CompletionTokensDetails = {5236 reasoning_tokens?: number;5237 audio_tokens?: number;5238 accepted_prediction_tokens?: number;5239 rejected_prediction_tokens?: number;5240};5241type CompletionUsage = {5242 prompt_tokens: number;5243 completion_tokens: number;5244 total_tokens: number;5245 prompt_tokens_details?: PromptTokensDetails;5246 completion_tokens_details?: CompletionTokensDetails;5247};5248type ChatCompletionTopLogprob = {5249 token: string;5250 logprob: number;5251 bytes: Array<number> | null;5252};5253type ChatCompletionTokenLogprob = {5254 token: string;5255 logprob: number;5256 bytes: Array<number> | null;5257 top_logprobs: Array<ChatCompletionTopLogprob>;5258};5259type ChatCompletionAudio = {5260 id: string;5261 /** Base64 encoded audio bytes. */5262 data: string;5263 expires_at: number;5264 transcript: string;5265};5266type ChatCompletionUrlCitation = {5267 type: "url_citation";5268 url_citation: {5269 url: string;5270 title: string;5271 start_index: number;5272 end_index: number;5273 };5274};5275type ChatCompletionResponseMessage = {5276 role: "assistant";5277 content: string | null;5278 refusal: string | null;5279 annotations?: Array<ChatCompletionUrlCitation>;5280 audio?: ChatCompletionAudio;5281 tool_calls?: Array<ChatCompletionMessageToolCall>;5282 function_call?: {5283 name: string;5284 arguments: string;5285 } | null;5286};5287type ChatCompletionLogprobs = {5288 content: Array<ChatCompletionTokenLogprob> | null;5289 refusal?: Array<ChatCompletionTokenLogprob> | null;5290};5291type ChatCompletionChoice = {5292 index: number;5293 message: ChatCompletionResponseMessage;5294 finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call";5295 logprobs: ChatCompletionLogprobs | null;5296};5297type ChatCompletionsMessagesInput = {5298 messages: Array<ChatCompletionMessageParam>;5299} & ChatCompletionsCommonOptions;5300type ChatCompletionsOutput = {5301 id: string;5302 object: string;5303 created: number;5304 model: string;5305 choices: Array<ChatCompletionChoice>;5306 usage?: CompletionUsage;5307 system_fingerprint?: string | null;5308 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;5309};5310/**5311 * Workers AI support for OpenAI's Responses API5312 * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts5313 *5314 * It's a stripped down version from its source.5315 * It currently supports basic function calling, json mode and accepts images as input.5316 *5317 * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools.5318 * We plan to add those incrementally as model + platform capabilities evolve.5319 */5320type ResponsesInput = {5321 background?: boolean | null;5322 conversation?: string | ResponseConversationParam | null;5323 include?: Array<ResponseIncludable> | null;5324 input?: string | ResponseInput;5325 instructions?: string | null;5326 max_output_tokens?: number | null;5327 parallel_tool_calls?: boolean | null;5328 previous_response_id?: string | null;5329 prompt_cache_key?: string;5330 reasoning?: Reasoning | null;5331 safety_identifier?: string;5332 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;5333 stream?: boolean | null;5334 stream_options?: StreamOptions | null;5335 temperature?: number | null;5336 text?: ResponseTextConfig;5337 tool_choice?: ToolChoiceOptions | ToolChoiceFunction;5338 tools?: Array<Tool>;5339 top_p?: number | null;5340 truncation?: "auto" | "disabled" | null;5341};5342type ResponsesOutput = {5343 id?: string;5344 created_at?: number;5345 output_text?: string;5346 error?: ResponseError | null;5347 incomplete_details?: ResponseIncompleteDetails | null;5348 instructions?: string | Array<ResponseInputItem> | null;5349 object?: "response";5350 output?: Array<ResponseOutputItem>;5351 parallel_tool_calls?: boolean;5352 temperature?: number | null;5353 tool_choice?: ToolChoiceOptions | ToolChoiceFunction;5354 tools?: Array<Tool>;5355 top_p?: number | null;5356 max_output_tokens?: number | null;5357 previous_response_id?: string | null;5358 prompt?: ResponsePrompt | null;5359 reasoning?: Reasoning | null;5360 safety_identifier?: string;5361 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;5362 status?: ResponseStatus;5363 text?: ResponseTextConfig;5364 truncation?: "auto" | "disabled" | null;5365 usage?: ResponseUsage;5366};5367type EasyInputMessage = {5368 content: string | ResponseInputMessageContentList;5369 role: "user" | "assistant" | "system" | "developer";5370 type?: "message";5371};5372type ResponsesFunctionTool = {5373 name: string;5374 parameters: {5375 [key: string]: unknown;5376 } | null;5377 strict: boolean | null;5378 type: "function";5379 description?: string | null;5380};5381type ResponseIncompleteDetails = {5382 reason?: "max_output_tokens" | "content_filter";5383};5384type ResponsePrompt = {5385 id: string;5386 variables?: {5387 [key: string]: string | ResponseInputText | ResponseInputImage;5388 } | null;5389 version?: string | null;5390};5391type Reasoning = {5392 effort?: ReasoningEffort | null;5393 generate_summary?: "auto" | "concise" | "detailed" | null;5394 summary?: "auto" | "concise" | "detailed" | null;5395};5396type ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText;5397type ResponseContentReasoningText = {5398 text: string;5399 type: "reasoning_text";5400};5401type ResponseConversationParam = {5402 id: string;5403};5404type ResponseCreatedEvent = {5405 response: Response;5406 sequence_number: number;5407 type: "response.created";5408};5409type ResponseCustomToolCallOutput = {5410 call_id: string;5411 output: string | Array<ResponseInputText | ResponseInputImage>;5412 type: "custom_tool_call_output";5413 id?: string;5414};5415type ResponseError = {5416 code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | "vector_store_timeout" | "invalid_image" | "invalid_image_format" | "invalid_base64_image" | "invalid_image_url" | "image_too_large" | "image_too_small" | "image_parse_error" | "image_content_policy_violation" | "invalid_image_mode" | "image_file_too_large" | "unsupported_image_media_type" | "empty_image_file" | "failed_to_download_image" | "image_file_not_found";5417 message: string;5418};5419type ResponseErrorEvent = {5420 code: string | null;5421 message: string;5422 param: string | null;5423 sequence_number: number;5424 type: "error";5425};5426type ResponseFailedEvent = {5427 response: Response;5428 sequence_number: number;5429 type: "response.failed";5430};5431type ResponseFormatText = {5432 type: "text";5433};5434type ResponseFormatJSONObject = {5435 type: "json_object";5436};5437type ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject;5438type ResponseFormatTextJSONSchemaConfig = {5439 name: string;5440 schema: {5441 [key: string]: unknown;5442 };5443 type: "json_schema";5444 description?: string;5445 strict?: boolean | null;5446};5447type ResponseFunctionCallArgumentsDeltaEvent = {5448 delta: string;5449 item_id: string;5450 output_index: number;5451 sequence_number: number;5452 type: "response.function_call_arguments.delta";5453};5454type ResponseFunctionCallArgumentsDoneEvent = {5455 arguments: string;5456 item_id: string;5457 name: string;5458 output_index: number;5459 sequence_number: number;5460 type: "response.function_call_arguments.done";5461};5462type ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent;5463type ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>;5464type ResponseFunctionToolCall = {5465 arguments: string;5466 call_id: string;5467 name: string;5468 type: "function_call";5469 id?: string;5470 status?: "in_progress" | "completed" | "incomplete";5471};5472interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {5473 id: string;5474}5475type ResponseFunctionToolCallOutputItem = {5476 id: string;5477 call_id: string;5478 output: string | Array<ResponseInputText | ResponseInputImage>;5479 type: "function_call_output";5480 status?: "in_progress" | "completed" | "incomplete";5481};5482type ResponseIncludable = "message.input_image.image_url" | "message.output_text.logprobs";5483type ResponseIncompleteEvent = {5484 response: Response;5485 sequence_number: number;5486 type: "response.incomplete";5487};5488type ResponseInput = Array<ResponseInputItem>;5489type ResponseInputContent = ResponseInputText | ResponseInputImage;5490type ResponseInputImage = {5491 detail: "low" | "high" | "auto";5492 type: "input_image";5493 /**5494 * Base64 encoded image5495 */5496 image_url?: string | null;5497};5498type ResponseInputImageContent = {5499 type: "input_image";5500 detail?: "low" | "high" | "auto" | null;5501 /**5502 * Base64 encoded image5503 */5504 image_url?: string | null;5505};5506type ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem;5507type ResponseInputItemFunctionCallOutput = {5508 call_id: string;5509 output: string | ResponseFunctionCallOutputItemList;5510 type: "function_call_output";5511 id?: string | null;5512 status?: "in_progress" | "completed" | "incomplete" | null;5513};5514type ResponseInputItemMessage = {5515 content: ResponseInputMessageContentList;5516 role: "user" | "system" | "developer";5517 status?: "in_progress" | "completed" | "incomplete";5518 type?: "message";5519};5520type ResponseInputMessageContentList = Array<ResponseInputContent>;5521type ResponseInputMessageItem = {5522 id: string;5523 content: ResponseInputMessageContentList;5524 role: "user" | "system" | "developer";5525 status?: "in_progress" | "completed" | "incomplete";5526 type?: "message";5527};5528type ResponseInputText = {5529 text: string;5530 type: "input_text";5531};5532type ResponseInputTextContent = {5533 text: string;5534 type: "input_text";5535};5536type ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem;5537type ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem;5538type ResponseOutputItemAddedEvent = {5539 item: ResponseOutputItem;5540 output_index: number;5541 sequence_number: number;5542 type: "response.output_item.added";5543};5544type ResponseOutputItemDoneEvent = {5545 item: ResponseOutputItem;5546 output_index: number;5547 sequence_number: number;5548 type: "response.output_item.done";5549};5550type ResponseOutputMessage = {5551 id: string;5552 content: Array<ResponseOutputText | ResponseOutputRefusal>;5553 role: "assistant";5554 status: "in_progress" | "completed" | "incomplete";5555 type: "message";5556};5557type ResponseOutputRefusal = {5558 refusal: string;5559 type: "refusal";5560};5561type ResponseOutputText = {5562 text: string;5563 type: "output_text";5564 logprobs?: Array<Logprob>;5565};5566type ResponseReasoningItem = {5567 id: string;5568 summary: Array<ResponseReasoningSummaryItem>;5569 type: "reasoning";5570 content?: Array<ResponseReasoningContentItem>;5571 encrypted_content?: string | null;5572 status?: "in_progress" | "completed" | "incomplete";5573};5574type ResponseReasoningSummaryItem = {5575 text: string;5576 type: "summary_text";5577};5578type ResponseReasoningContentItem = {5579 text: string;5580 type: "reasoning_text";5581};5582type ResponseReasoningTextDeltaEvent = {5583 content_index: number;5584 delta: string;5585 item_id: string;5586 output_index: number;5587 sequence_number: number;5588 type: "response.reasoning_text.delta";5589};5590type ResponseReasoningTextDoneEvent = {5591 content_index: number;5592 item_id: string;5593 output_index: number;5594 sequence_number: number;5595 text: string;5596 type: "response.reasoning_text.done";5597};5598type ResponseRefusalDeltaEvent = {5599 content_index: number;5600 delta: string;5601 item_id: string;5602 output_index: number;5603 sequence_number: number;5604 type: "response.refusal.delta";5605};5606type ResponseRefusalDoneEvent = {5607 content_index: number;5608 item_id: string;5609 output_index: number;5610 refusal: string;5611 sequence_number: number;5612 type: "response.refusal.done";5613};5614type ResponseStatus = "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete";5615type ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent;5616type ResponseCompletedEvent = {5617 response: Response;5618 sequence_number: number;5619 type: "response.completed";5620};5621type ResponseTextConfig = {5622 format?: ResponseFormatTextConfig;5623 verbosity?: "low" | "medium" | "high" | null;5624};5625type ResponseTextDeltaEvent = {5626 content_index: number;5627 delta: string;5628 item_id: string;5629 logprobs: Array<Logprob>;5630 output_index: number;5631 sequence_number: number;5632 type: "response.output_text.delta";5633};5634type ResponseTextDoneEvent = {5635 content_index: number;5636 item_id: string;5637 logprobs: Array<Logprob>;5638 output_index: number;5639 sequence_number: number;5640 text: string;5641 type: "response.output_text.done";5642};5643type Logprob = {5644 token: string;5645 logprob: number;5646 top_logprobs?: Array<TopLogprob>;5647};5648type TopLogprob = {5649 token?: string;5650 logprob?: number;5651};5652type ResponseUsage = {5653 input_tokens: number;5654 output_tokens: number;5655 total_tokens: number;5656};5657type Tool = ResponsesFunctionTool;5658type ToolChoiceFunction = {5659 name: string;5660 type: "function";5661};5662type ToolChoiceOptions = "none";5663type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;5664type StreamOptions = {5665 include_obfuscation?: boolean;5666};5667/** Marks keys from T that aren't in U as optional never */5668type Without<T, U> = {5669 [P in Exclude<keyof T, keyof U>]?: never;5670};5671/** Either T or U, but not both (mutually exclusive) */5672type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);5673type Ai_Cf_Baai_Bge_Base_En_V1_5_Input = {5674 text: string | string[];5675 /**5676 * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.5677 */5678 pooling?: "mean" | "cls";5679} | {5680 /**5681 * Batch of the embeddings requests to run using async-queue5682 */5683 requests: {5684 text: string | string[];5685 /**5686 * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.5687 */5688 pooling?: "mean" | "cls";5689 }[];5690};5691type Ai_Cf_Baai_Bge_Base_En_V1_5_Output = {5692 shape?: number[];5693 /**5694 * Embeddings of the requested text values5695 */5696 data?: number[][];5697 /**5698 * The pooling method used in the embedding process.5699 */5700 pooling?: "mean" | "cls";5701} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse;5702interface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {5703 /**5704 * The async request id that can be used to obtain the results.5705 */5706 request_id?: string;5707}5708declare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 {5709 inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input;5710 postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output;5711}5712type Ai_Cf_Openai_Whisper_Input = string | {5713 /**5714 * An array of integers that represent the audio data constrained to 8-bit unsigned integer values5715 */5716 audio: number[];5717};5718interface Ai_Cf_Openai_Whisper_Output {5719 /**5720 * The transcription5721 */5722 text: string;5723 word_count?: number;5724 words?: {5725 word?: string;5726 /**5727 * The second this word begins in the recording5728 */5729 start?: number;5730 /**5731 * The ending second when the word completes5732 */5733 end?: number;5734 }[];5735 vtt?: string;5736}5737declare abstract class Base_Ai_Cf_Openai_Whisper {5738 inputs: Ai_Cf_Openai_Whisper_Input;5739 postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;5740}5741type Ai_Cf_Meta_M2M100_1_2B_Input = {5742 /**5743 * The text to be translated5744 */5745 text: string;5746 /**5747 * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified5748 */5749 source_lang?: string;5750 /**5751 * The language code to translate the text into (e.g., 'es' for Spanish)5752 */5753 target_lang: string;5754} | {5755 /**5756 * Batch of the embeddings requests to run using async-queue5757 */5758 requests: {5759 /**5760 * The text to be translated5761 */5762 text: string;5763 /**5764 * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified5765 */5766 source_lang?: string;5767 /**5768 * The language code to translate the text into (e.g., 'es' for Spanish)5769 */5770 target_lang: string;5771 }[];5772};5773type Ai_Cf_Meta_M2M100_1_2B_Output = {5774 /**5775 * The translated text in the target language5776 */5777 translated_text?: string;5778} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse;5779interface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {5780 /**5781 * The async request id that can be used to obtain the results.5782 */5783 request_id?: string;5784}5785declare abstract class Base_Ai_Cf_Meta_M2M100_1_2B {5786 inputs: Ai_Cf_Meta_M2M100_1_2B_Input;5787 postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output;5788}5789type Ai_Cf_Baai_Bge_Small_En_V1_5_Input = {5790 text: string | string[];5791 /**5792 * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.5793 */5794 pooling?: "mean" | "cls";5795} | {5796 /**5797 * Batch of the embeddings requests to run using async-queue5798 */5799 requests: {5800 text: string | string[];5801 /**5802 * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.5803 */5804 pooling?: "mean" | "cls";5805 }[];5806};5807type Ai_Cf_Baai_Bge_Small_En_V1_5_Output = {5808 shape?: number[];5809 /**5810 * Embeddings of the requested text values5811 */5812 data?: number[][];5813 /**5814 * The pooling method used in the embedding process.5815 */5816 pooling?: "mean" | "cls";5817} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse;5818interface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {5819 /**5820 * The async request id that can be used to obtain the results.5821 */5822 request_id?: string;5823}5824declare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 {5825 inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input;5826 postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output;5827}5828type Ai_Cf_Baai_Bge_Large_En_V1_5_Input = {5829 text: string | string[];5830 /**5831 * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.5832 */5833 pooling?: "mean" | "cls";5834} | {5835 /**5836 * Batch of the embeddings requests to run using async-queue5837 */5838 requests: {5839 text: string | string[];5840 /**5841 * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.5842 */5843 pooling?: "mean" | "cls";5844 }[];5845};5846type Ai_Cf_Baai_Bge_Large_En_V1_5_Output = {5847 shape?: number[];5848 /**5849 * Embeddings of the requested text values5850 */5851 data?: number[][];5852 /**5853 * The pooling method used in the embedding process.5854 */5855 pooling?: "mean" | "cls";5856} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse;5857interface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {5858 /**5859 * The async request id that can be used to obtain the results.5860 */5861 request_id?: string;5862}5863declare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 {5864 inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input;5865 postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output;5866}5867type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | {5868 /**5869 * The input text prompt for the model to generate a response.5870 */5871 prompt?: string;5872 /**5873 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.5874 */5875 raw?: boolean;5876 /**5877 * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.5878 */5879 top_p?: number;5880 /**5881 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.5882 */5883 top_k?: number;5884 /**5885 * Random seed for reproducibility of the generation.5886 */5887 seed?: number;5888 /**5889 * Penalty for repeated tokens; higher values discourage repetition.5890 */5891 repetition_penalty?: number;5892 /**5893 * Decreases the likelihood of the model repeating the same lines verbatim.5894 */5895 frequency_penalty?: number;5896 /**5897 * Increases the likelihood of the model introducing new topics.5898 */5899 presence_penalty?: number;5900 image: number[] | (string & NonNullable<unknown>);5901 /**5902 * The maximum number of tokens to generate in the response.5903 */5904 max_tokens?: number;5905};5906interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {5907 description?: string;5908}5909declare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M {5910 inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input;5911 postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output;5912}5913type Ai_Cf_Openai_Whisper_Tiny_En_Input = string | {5914 /**5915 * An array of integers that represent the audio data constrained to 8-bit unsigned integer values5916 */5917 audio: number[];5918};5919interface Ai_Cf_Openai_Whisper_Tiny_En_Output {5920 /**5921 * The transcription5922 */5923 text: string;5924 word_count?: number;5925 words?: {5926 word?: string;5927 /**5928 * The second this word begins in the recording5929 */5930 start?: number;5931 /**5932 * The ending second when the word completes5933 */5934 end?: number;5935 }[];5936 vtt?: string;5937}5938declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {5939 inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;5940 postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;5941}5942interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {5943 audio: string | {5944 body?: object;5945 contentType?: string;5946 };5947 /**5948 * Supported tasks are 'translate' or 'transcribe'.5949 */5950 task?: string;5951 /**5952 * The language of the audio being transcribed or translated.5953 */5954 language?: string;5955 /**5956 * Preprocess the audio with a voice activity detection model.5957 */5958 vad_filter?: boolean;5959 /**5960 * A text prompt to help provide context to the model on the contents of the audio.5961 */5962 initial_prompt?: string;5963 /**5964 * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.5965 */5966 prefix?: string;5967 /**5968 * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.5969 */5970 beam_size?: number;5971 /**5972 * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.5973 */5974 condition_on_previous_text?: boolean;5975 /**5976 * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.5977 */5978 no_speech_threshold?: number;5979 /**5980 * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.5981 */5982 compression_ratio_threshold?: number;5983 /**5984 * Threshold for filtering out segments with low average log probability, indicating low confidence.5985 */5986 log_prob_threshold?: number;5987 /**5988 * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.5989 */5990 hallucination_silence_threshold?: number;5991}5992interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {5993 transcription_info?: {5994 /**5995 * The language of the audio being transcribed or translated.5996 */5997 language?: string;5998 /**5999 * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.6000 */6001 language_probability?: number;6002 /**6003 * The total duration of the original audio file, in seconds.6004 */6005 duration?: number;6006 /**6007 * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.6008 */6009 duration_after_vad?: number;6010 };6011 /**6012 * The complete transcription of the audio.6013 */6014 text: string;6015 /**6016 * The total number of words in the transcription.6017 */6018 word_count?: number;6019 segments?: {6020 /**6021 * The starting time of the segment within the audio, in seconds.6022 */6023 start?: number;6024 /**6025 * The ending time of the segment within the audio, in seconds.6026 */6027 end?: number;6028 /**6029 * The transcription of the segment.6030 */6031 text?: string;6032 /**6033 * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.6034 */6035 temperature?: number;6036 /**6037 * The average log probability of the predictions for the words in this segment, indicating overall confidence.6038 */6039 avg_logprob?: number;6040 /**6041 * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.6042 */6043 compression_ratio?: number;6044 /**6045 * The probability that the segment contains no speech, represented as a decimal between 0 and 1.6046 */6047 no_speech_prob?: number;6048 words?: {6049 /**6050 * The individual word transcribed from the audio.6051 */6052 word?: string;6053 /**6054 * The starting time of the word within the audio, in seconds.6055 */6056 start?: number;6057 /**6058 * The ending time of the word within the audio, in seconds.6059 */6060 end?: number;6061 }[];6062 }[];6063 /**6064 * The transcription in WebVTT format, which includes timing and text information for use in subtitles.6065 */6066 vtt?: string;6067}6068declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {6069 inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;6070 postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;6071}6072type Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | {6073 /**6074 * Batch of the embeddings requests to run using async-queue6075 */6076 requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[];6077};6078interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {6079 /**6080 * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts6081 */6082 query?: string;6083 /**6084 * List of provided contexts. Note that the index in this array is important, as the response will refer to it.6085 */6086 contexts: {6087 /**6088 * One of the provided context content6089 */6090 text?: string;6091 }[];6092 /**6093 * When provided with too long context should the model error out or truncate the context to fit?6094 */6095 truncate_inputs?: boolean;6096}6097interface Ai_Cf_Baai_Bge_M3_Input_Embedding {6098 text: string | string[];6099 /**6100 * When provided with too long context should the model error out or truncate the context to fit?6101 */6102 truncate_inputs?: boolean;6103}6104interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {6105 /**6106 * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts6107 */6108 query?: string;6109 /**6110 * List of provided contexts. Note that the index in this array is important, as the response will refer to it.6111 */6112 contexts: {6113 /**6114 * One of the provided context content6115 */6116 text?: string;6117 }[];6118 /**6119 * When provided with too long context should the model error out or truncate the context to fit?6120 */6121 truncate_inputs?: boolean;6122}6123interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {6124 text: string | string[];6125 /**6126 * When provided with too long context should the model error out or truncate the context to fit?6127 */6128 truncate_inputs?: boolean;6129}6130type Ai_Cf_Baai_Bge_M3_Output = Ai_Cf_Baai_Bge_M3_Output_Query | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts | Ai_Cf_Baai_Bge_M3_Output_Embedding | Ai_Cf_Baai_Bge_M3_AsyncResponse;6131interface Ai_Cf_Baai_Bge_M3_Output_Query {6132 response?: {6133 /**6134 * Index of the context in the request6135 */6136 id?: number;6137 /**6138 * Score of the context under the index.6139 */6140 score?: number;6141 }[];6142}6143interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {6144 response?: number[][];6145 shape?: number[];6146 /**6147 * The pooling method used in the embedding process.6148 */6149 pooling?: "mean" | "cls";6150}6151interface Ai_Cf_Baai_Bge_M3_Output_Embedding {6152 shape?: number[];6153 /**6154 * Embeddings of the requested text values6155 */6156 data?: number[][];6157 /**6158 * The pooling method used in the embedding process.6159 */6160 pooling?: "mean" | "cls";6161}6162interface Ai_Cf_Baai_Bge_M3_AsyncResponse {6163 /**6164 * The async request id that can be used to obtain the results.6165 */6166 request_id?: string;6167}6168declare abstract class Base_Ai_Cf_Baai_Bge_M3 {6169 inputs: Ai_Cf_Baai_Bge_M3_Input;6170 postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;6171}6172interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {6173 /**6174 * A text description of the image you want to generate.6175 */6176 prompt: string;6177 /**6178 * The number of diffusion steps; higher values can improve quality but take longer.6179 */6180 steps?: number;6181}6182interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {6183 /**6184 * The generated image in Base64 format.6185 */6186 image?: string;6187}6188declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {6189 inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;6190 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;6191}6192type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt | Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages;6193interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {6194 /**6195 * The input text prompt for the model to generate a response.6196 */6197 prompt: string;6198 image?: number[] | (string & NonNullable<unknown>);6199 /**6200 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.6201 */6202 raw?: boolean;6203 /**6204 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6205 */6206 stream?: boolean;6207 /**6208 * The maximum number of tokens to generate in the response.6209 */6210 max_tokens?: number;6211 /**6212 * Controls the randomness of the output; higher values produce more random results.6213 */6214 temperature?: number;6215 /**6216 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.6217 */6218 top_p?: number;6219 /**6220 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.6221 */6222 top_k?: number;6223 /**6224 * Random seed for reproducibility of the generation.6225 */6226 seed?: number;6227 /**6228 * Penalty for repeated tokens; higher values discourage repetition.6229 */6230 repetition_penalty?: number;6231 /**6232 * Decreases the likelihood of the model repeating the same lines verbatim.6233 */6234 frequency_penalty?: number;6235 /**6236 * Increases the likelihood of the model introducing new topics.6237 */6238 presence_penalty?: number;6239 /**6240 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.6241 */6242 lora?: string;6243}6244interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {6245 /**6246 * An array of message objects representing the conversation history.6247 */6248 messages: {6249 /**6250 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').6251 */6252 role?: string;6253 /**6254 * The tool call id. If you don't know what to put here you can fall back to 0000000016255 */6256 tool_call_id?: string;6257 content?: string | {6258 /**6259 * Type of the content provided6260 */6261 type?: string;6262 text?: string;6263 image_url?: {6264 /**6265 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted6266 */6267 url?: string;6268 };6269 }[] | {6270 /**6271 * Type of the content provided6272 */6273 type?: string;6274 text?: string;6275 image_url?: {6276 /**6277 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted6278 */6279 url?: string;6280 };6281 };6282 }[];6283 image?: number[] | (string & NonNullable<unknown>);6284 functions?: {6285 name: string;6286 code: string;6287 }[];6288 /**6289 * A list of tools available for the assistant to use.6290 */6291 tools?: ({6292 /**6293 * The name of the tool. More descriptive the better.6294 */6295 name: string;6296 /**6297 * A brief description of what the tool does.6298 */6299 description: string;6300 /**6301 * Schema defining the parameters accepted by the tool.6302 */6303 parameters: {6304 /**6305 * The type of the parameters object (usually 'object').6306 */6307 type: string;6308 /**6309 * List of required parameter names.6310 */6311 required?: string[];6312 /**6313 * Definitions of each parameter.6314 */6315 properties: {6316 [k: string]: {6317 /**6318 * The data type of the parameter.6319 */6320 type: string;6321 /**6322 * A description of the expected parameter.6323 */6324 description: string;6325 };6326 };6327 };6328 } | {6329 /**6330 * Specifies the type of tool (e.g., 'function').6331 */6332 type: string;6333 /**6334 * Details of the function tool.6335 */6336 function: {6337 /**6338 * The name of the function.6339 */6340 name: string;6341 /**6342 * A brief description of what the function does.6343 */6344 description: string;6345 /**6346 * Schema defining the parameters accepted by the function.6347 */6348 parameters: {6349 /**6350 * The type of the parameters object (usually 'object').6351 */6352 type: string;6353 /**6354 * List of required parameter names.6355 */6356 required?: string[];6357 /**6358 * Definitions of each parameter.6359 */6360 properties: {6361 [k: string]: {6362 /**6363 * The data type of the parameter.6364 */6365 type: string;6366 /**6367 * A description of the expected parameter.6368 */6369 description: string;6370 };6371 };6372 };6373 };6374 })[];6375 /**6376 * If true, the response will be streamed back incrementally.6377 */6378 stream?: boolean;6379 /**6380 * The maximum number of tokens to generate in the response.6381 */6382 max_tokens?: number;6383 /**6384 * Controls the randomness of the output; higher values produce more random results.6385 */6386 temperature?: number;6387 /**6388 * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.6389 */6390 top_p?: number;6391 /**6392 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.6393 */6394 top_k?: number;6395 /**6396 * Random seed for reproducibility of the generation.6397 */6398 seed?: number;6399 /**6400 * Penalty for repeated tokens; higher values discourage repetition.6401 */6402 repetition_penalty?: number;6403 /**6404 * Decreases the likelihood of the model repeating the same lines verbatim.6405 */6406 frequency_penalty?: number;6407 /**6408 * Increases the likelihood of the model introducing new topics.6409 */6410 presence_penalty?: number;6411}6412type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {6413 /**6414 * The generated text response from the model6415 */6416 response?: string;6417 /**6418 * An array of tool calls requests made during the response generation6419 */6420 tool_calls?: {6421 /**6422 * The arguments passed to be passed to the tool call request6423 */6424 arguments?: object;6425 /**6426 * The name of the tool to be called6427 */6428 name?: string;6429 }[];6430};6431declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {6432 inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;6433 postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;6434}6435type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch;6436interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {6437 /**6438 * The input text prompt for the model to generate a response.6439 */6440 prompt: string;6441 /**6442 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.6443 */6444 lora?: string;6445 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode;6446 /**6447 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.6448 */6449 raw?: boolean;6450 /**6451 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6452 */6453 stream?: boolean;6454 /**6455 * The maximum number of tokens to generate in the response.6456 */6457 max_tokens?: number;6458 /**6459 * Controls the randomness of the output; higher values produce more random results.6460 */6461 temperature?: number;6462 /**6463 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.6464 */6465 top_p?: number;6466 /**6467 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.6468 */6469 top_k?: number;6470 /**6471 * Random seed for reproducibility of the generation.6472 */6473 seed?: number;6474 /**6475 * Penalty for repeated tokens; higher values discourage repetition.6476 */6477 repetition_penalty?: number;6478 /**6479 * Decreases the likelihood of the model repeating the same lines verbatim.6480 */6481 frequency_penalty?: number;6482 /**6483 * Increases the likelihood of the model introducing new topics.6484 */6485 presence_penalty?: number;6486}6487interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {6488 type?: "json_object" | "json_schema";6489 json_schema?: unknown;6490}6491interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {6492 /**6493 * An array of message objects representing the conversation history.6494 */6495 messages: {6496 /**6497 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').6498 */6499 role: string;6500 content: string | {6501 /**6502 * Type of the content (text)6503 */6504 type?: string;6505 /**6506 * Text content6507 */6508 text?: string;6509 }[];6510 }[];6511 functions?: {6512 name: string;6513 code: string;6514 }[];6515 /**6516 * A list of tools available for the assistant to use.6517 */6518 tools?: ({6519 /**6520 * The name of the tool. More descriptive the better.6521 */6522 name: string;6523 /**6524 * A brief description of what the tool does.6525 */6526 description: string;6527 /**6528 * Schema defining the parameters accepted by the tool.6529 */6530 parameters: {6531 /**6532 * The type of the parameters object (usually 'object').6533 */6534 type: string;6535 /**6536 * List of required parameter names.6537 */6538 required?: string[];6539 /**6540 * Definitions of each parameter.6541 */6542 properties: {6543 [k: string]: {6544 /**6545 * The data type of the parameter.6546 */6547 type: string;6548 /**6549 * A description of the expected parameter.6550 */6551 description: string;6552 };6553 };6554 };6555 } | {6556 /**6557 * Specifies the type of tool (e.g., 'function').6558 */6559 type: string;6560 /**6561 * Details of the function tool.6562 */6563 function: {6564 /**6565 * The name of the function.6566 */6567 name: string;6568 /**6569 * A brief description of what the function does.6570 */6571 description: string;6572 /**6573 * Schema defining the parameters accepted by the function.6574 */6575 parameters: {6576 /**6577 * The type of the parameters object (usually 'object').6578 */6579 type: string;6580 /**6581 * List of required parameter names.6582 */6583 required?: string[];6584 /**6585 * Definitions of each parameter.6586 */6587 properties: {6588 [k: string]: {6589 /**6590 * The data type of the parameter.6591 */6592 type: string;6593 /**6594 * A description of the expected parameter.6595 */6596 description: string;6597 };6598 };6599 };6600 };6601 })[];6602 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1;6603 /**6604 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.6605 */6606 raw?: boolean;6607 /**6608 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6609 */6610 stream?: boolean;6611 /**6612 * The maximum number of tokens to generate in the response.6613 */6614 max_tokens?: number;6615 /**6616 * Controls the randomness of the output; higher values produce more random results.6617 */6618 temperature?: number;6619 /**6620 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.6621 */6622 top_p?: number;6623 /**6624 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.6625 */6626 top_k?: number;6627 /**6628 * Random seed for reproducibility of the generation.6629 */6630 seed?: number;6631 /**6632 * Penalty for repeated tokens; higher values discourage repetition.6633 */6634 repetition_penalty?: number;6635 /**6636 * Decreases the likelihood of the model repeating the same lines verbatim.6637 */6638 frequency_penalty?: number;6639 /**6640 * Increases the likelihood of the model introducing new topics.6641 */6642 presence_penalty?: number;6643}6644interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {6645 type?: "json_object" | "json_schema";6646 json_schema?: unknown;6647}6648interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {6649 requests?: {6650 /**6651 * User-supplied reference. This field will be present in the response as well it can be used to reference the request and response. It's NOT validated to be unique.6652 */6653 external_reference?: string;6654 /**6655 * Prompt for the text generation model6656 */6657 prompt?: string;6658 /**6659 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6660 */6661 stream?: boolean;6662 /**6663 * The maximum number of tokens to generate in the response.6664 */6665 max_tokens?: number;6666 /**6667 * Controls the randomness of the output; higher values produce more random results.6668 */6669 temperature?: number;6670 /**6671 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.6672 */6673 top_p?: number;6674 /**6675 * Random seed for reproducibility of the generation.6676 */6677 seed?: number;6678 /**6679 * Penalty for repeated tokens; higher values discourage repetition.6680 */6681 repetition_penalty?: number;6682 /**6683 * Decreases the likelihood of the model repeating the same lines verbatim.6684 */6685 frequency_penalty?: number;6686 /**6687 * Increases the likelihood of the model introducing new topics.6688 */6689 presence_penalty?: number;6690 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2;6691 }[];6692}6693interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {6694 type?: "json_object" | "json_schema";6695 json_schema?: unknown;6696}6697type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = {6698 /**6699 * The generated text response from the model6700 */6701 response: string;6702 /**6703 * Usage statistics for the inference request6704 */6705 usage?: {6706 /**6707 * Total number of tokens in input6708 */6709 prompt_tokens?: number;6710 /**6711 * Total number of tokens in output6712 */6713 completion_tokens?: number;6714 /**6715 * Total number of input and output tokens6716 */6717 total_tokens?: number;6718 };6719 /**6720 * An array of tool calls requests made during the response generation6721 */6722 tool_calls?: {6723 /**6724 * The arguments passed to be passed to the tool call request6725 */6726 arguments?: object;6727 /**6728 * The name of the tool to be called6729 */6730 name?: string;6731 }[];6732} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse;6733interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {6734 /**6735 * The async request id that can be used to obtain the results.6736 */6737 request_id?: string;6738}6739declare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {6740 inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;6741 postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output;6742}6743interface Ai_Cf_Meta_Llama_Guard_3_8B_Input {6744 /**6745 * An array of message objects representing the conversation history.6746 */6747 messages: {6748 /**6749 * The role of the message sender must alternate between 'user' and 'assistant'.6750 */6751 role: "user" | "assistant";6752 /**6753 * The content of the message as a string.6754 */6755 content: string;6756 }[];6757 /**6758 * The maximum number of tokens to generate in the response.6759 */6760 max_tokens?: number;6761 /**6762 * Controls the randomness of the output; higher values produce more random results.6763 */6764 temperature?: number;6765 /**6766 * Dictate the output format of the generated response.6767 */6768 response_format?: {6769 /**6770 * Set to json_object to process and output generated text as JSON.6771 */6772 type?: string;6773 };6774}6775interface Ai_Cf_Meta_Llama_Guard_3_8B_Output {6776 response?: string | {6777 /**6778 * Whether the conversation is safe or not.6779 */6780 safe?: boolean;6781 /**6782 * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe.6783 */6784 categories?: string[];6785 };6786 /**6787 * Usage statistics for the inference request6788 */6789 usage?: {6790 /**6791 * Total number of tokens in input6792 */6793 prompt_tokens?: number;6794 /**6795 * Total number of tokens in output6796 */6797 completion_tokens?: number;6798 /**6799 * Total number of input and output tokens6800 */6801 total_tokens?: number;6802 };6803}6804declare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B {6805 inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input;6806 postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output;6807}6808interface Ai_Cf_Baai_Bge_Reranker_Base_Input {6809 /**6810 * A query you wish to perform against the provided contexts.6811 */6812 /**6813 * Number of returned results starting with the best score.6814 */6815 top_k?: number;6816 /**6817 * List of provided contexts. Note that the index in this array is important, as the response will refer to it.6818 */6819 contexts: {6820 /**6821 * One of the provided context content6822 */6823 text?: string;6824 }[];6825}6826interface Ai_Cf_Baai_Bge_Reranker_Base_Output {6827 response?: {6828 /**6829 * Index of the context in the request6830 */6831 id?: number;6832 /**6833 * Score of the context under the index.6834 */6835 score?: number;6836 }[];6837}6838declare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base {6839 inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input;6840 postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output;6841}6842type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt | Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages;6843interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {6844 /**6845 * The input text prompt for the model to generate a response.6846 */6847 prompt: string;6848 /**6849 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.6850 */6851 lora?: string;6852 response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode;6853 /**6854 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.6855 */6856 raw?: boolean;6857 /**6858 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6859 */6860 stream?: boolean;6861 /**6862 * The maximum number of tokens to generate in the response.6863 */6864 max_tokens?: number;6865 /**6866 * Controls the randomness of the output; higher values produce more random results.6867 */6868 temperature?: number;6869 /**6870 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.6871 */6872 top_p?: number;6873 /**6874 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.6875 */6876 top_k?: number;6877 /**6878 * Random seed for reproducibility of the generation.6879 */6880 seed?: number;6881 /**6882 * Penalty for repeated tokens; higher values discourage repetition.6883 */6884 repetition_penalty?: number;6885 /**6886 * Decreases the likelihood of the model repeating the same lines verbatim.6887 */6888 frequency_penalty?: number;6889 /**6890 * Increases the likelihood of the model introducing new topics.6891 */6892 presence_penalty?: number;6893}6894interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {6895 type?: "json_object" | "json_schema";6896 json_schema?: unknown;6897}6898interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {6899 /**6900 * An array of message objects representing the conversation history.6901 */6902 messages: {6903 /**6904 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').6905 */6906 role: string;6907 /**6908 * The content of the message as a string.6909 */6910 content: string;6911 }[];6912 functions?: {6913 name: string;6914 code: string;6915 }[];6916 /**6917 * A list of tools available for the assistant to use.6918 */6919 tools?: ({6920 /**6921 * The name of the tool. More descriptive the better.6922 */6923 name: string;6924 /**6925 * A brief description of what the tool does.6926 */6927 description: string;6928 /**6929 * Schema defining the parameters accepted by the tool.6930 */6931 parameters: {6932 /**6933 * The type of the parameters object (usually 'object').6934 */6935 type: string;6936 /**6937 * List of required parameter names.6938 */6939 required?: string[];6940 /**6941 * Definitions of each parameter.6942 */6943 properties: {6944 [k: string]: {6945 /**6946 * The data type of the parameter.6947 */6948 type: string;6949 /**6950 * A description of the expected parameter.6951 */6952 description: string;6953 };6954 };6955 };6956 } | {6957 /**6958 * Specifies the type of tool (e.g., 'function').6959 */6960 type: string;6961 /**6962 * Details of the function tool.6963 */6964 function: {6965 /**6966 * The name of the function.6967 */6968 name: string;6969 /**6970 * A brief description of what the function does.6971 */6972 description: string;6973 /**6974 * Schema defining the parameters accepted by the function.6975 */6976 parameters: {6977 /**6978 * The type of the parameters object (usually 'object').6979 */6980 type: string;6981 /**6982 * List of required parameter names.6983 */6984 required?: string[];6985 /**6986 * Definitions of each parameter.6987 */6988 properties: {6989 [k: string]: {6990 /**6991 * The data type of the parameter.6992 */6993 type: string;6994 /**6995 * A description of the expected parameter.6996 */6997 description: string;6998 };6999 };7000 };7001 };7002 })[];7003 response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1;7004 /**7005 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7006 */7007 raw?: boolean;7008 /**7009 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7010 */7011 stream?: boolean;7012 /**7013 * The maximum number of tokens to generate in the response.7014 */7015 max_tokens?: number;7016 /**7017 * Controls the randomness of the output; higher values produce more random results.7018 */7019 temperature?: number;7020 /**7021 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.7022 */7023 top_p?: number;7024 /**7025 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.7026 */7027 top_k?: number;7028 /**7029 * Random seed for reproducibility of the generation.7030 */7031 seed?: number;7032 /**7033 * Penalty for repeated tokens; higher values discourage repetition.7034 */7035 repetition_penalty?: number;7036 /**7037 * Decreases the likelihood of the model repeating the same lines verbatim.7038 */7039 frequency_penalty?: number;7040 /**7041 * Increases the likelihood of the model introducing new topics.7042 */7043 presence_penalty?: number;7044}7045interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {7046 type?: "json_object" | "json_schema";7047 json_schema?: unknown;7048}7049type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {7050 /**7051 * The generated text response from the model7052 */7053 response: string;7054 /**7055 * Usage statistics for the inference request7056 */7057 usage?: {7058 /**7059 * Total number of tokens in input7060 */7061 prompt_tokens?: number;7062 /**7063 * Total number of tokens in output7064 */7065 completion_tokens?: number;7066 /**7067 * Total number of input and output tokens7068 */7069 total_tokens?: number;7070 };7071 /**7072 * An array of tool calls requests made during the response generation7073 */7074 tool_calls?: {7075 /**7076 * The arguments passed to be passed to the tool call request7077 */7078 arguments?: object;7079 /**7080 * The name of the tool to be called7081 */7082 name?: string;7083 }[];7084};7085declare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct {7086 inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input;7087 postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output;7088}7089type Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages;7090interface Ai_Cf_Qwen_Qwq_32B_Prompt {7091 /**7092 * The input text prompt for the model to generate a response.7093 */7094 prompt: string;7095 /**7096 * JSON schema that should be fulfilled for the response.7097 */7098 guided_json?: object;7099 /**7100 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7101 */7102 raw?: boolean;7103 /**7104 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7105 */7106 stream?: boolean;7107 /**7108 * The maximum number of tokens to generate in the response.7109 */7110 max_tokens?: number;7111 /**7112 * Controls the randomness of the output; higher values produce more random results.7113 */7114 temperature?: number;7115 /**7116 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.7117 */7118 top_p?: number;7119 /**7120 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.7121 */7122 top_k?: number;7123 /**7124 * Random seed for reproducibility of the generation.7125 */7126 seed?: number;7127 /**7128 * Penalty for repeated tokens; higher values discourage repetition.7129 */7130 repetition_penalty?: number;7131 /**7132 * Decreases the likelihood of the model repeating the same lines verbatim.7133 */7134 frequency_penalty?: number;7135 /**7136 * Increases the likelihood of the model introducing new topics.7137 */7138 presence_penalty?: number;7139}7140interface Ai_Cf_Qwen_Qwq_32B_Messages {7141 /**7142 * An array of message objects representing the conversation history.7143 */7144 messages: {7145 /**7146 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').7147 */7148 role?: string;7149 /**7150 * The tool call id. If you don't know what to put here you can fall back to 0000000017151 */7152 tool_call_id?: string;7153 content?: string | {7154 /**7155 * Type of the content provided7156 */7157 type?: string;7158 text?: string;7159 image_url?: {7160 /**7161 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7162 */7163 url?: string;7164 };7165 }[] | {7166 /**7167 * Type of the content provided7168 */7169 type?: string;7170 text?: string;7171 image_url?: {7172 /**7173 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7174 */7175 url?: string;7176 };7177 };7178 }[];7179 functions?: {7180 name: string;7181 code: string;7182 }[];7183 /**7184 * A list of tools available for the assistant to use.7185 */7186 tools?: ({7187 /**7188 * The name of the tool. More descriptive the better.7189 */7190 name: string;7191 /**7192 * A brief description of what the tool does.7193 */7194 description: string;7195 /**7196 * Schema defining the parameters accepted by the tool.7197 */7198 parameters: {7199 /**7200 * The type of the parameters object (usually 'object').7201 */7202 type: string;7203 /**7204 * List of required parameter names.7205 */7206 required?: string[];7207 /**7208 * Definitions of each parameter.7209 */7210 properties: {7211 [k: string]: {7212 /**7213 * The data type of the parameter.7214 */7215 type: string;7216 /**7217 * A description of the expected parameter.7218 */7219 description: string;7220 };7221 };7222 };7223 } | {7224 /**7225 * Specifies the type of tool (e.g., 'function').7226 */7227 type: string;7228 /**7229 * Details of the function tool.7230 */7231 function: {7232 /**7233 * The name of the function.7234 */7235 name: string;7236 /**7237 * A brief description of what the function does.7238 */7239 description: string;7240 /**7241 * Schema defining the parameters accepted by the function.7242 */7243 parameters: {7244 /**7245 * The type of the parameters object (usually 'object').7246 */7247 type: string;7248 /**7249 * List of required parameter names.7250 */7251 required?: string[];7252 /**7253 * Definitions of each parameter.7254 */7255 properties: {7256 [k: string]: {7257 /**7258 * The data type of the parameter.7259 */7260 type: string;7261 /**7262 * A description of the expected parameter.7263 */7264 description: string;7265 };7266 };7267 };7268 };7269 })[];7270 /**7271 * JSON schema that should be fufilled for the response.7272 */7273 guided_json?: object;7274 /**7275 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7276 */7277 raw?: boolean;7278 /**7279 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7280 */7281 stream?: boolean;7282 /**7283 * The maximum number of tokens to generate in the response.7284 */7285 max_tokens?: number;7286 /**7287 * Controls the randomness of the output; higher values produce more random results.7288 */7289 temperature?: number;7290 /**7291 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.7292 */7293 top_p?: number;7294 /**7295 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.7296 */7297 top_k?: number;7298 /**7299 * Random seed for reproducibility of the generation.7300 */7301 seed?: number;7302 /**7303 * Penalty for repeated tokens; higher values discourage repetition.7304 */7305 repetition_penalty?: number;7306 /**7307 * Decreases the likelihood of the model repeating the same lines verbatim.7308 */7309 frequency_penalty?: number;7310 /**7311 * Increases the likelihood of the model introducing new topics.7312 */7313 presence_penalty?: number;7314}7315type Ai_Cf_Qwen_Qwq_32B_Output = {7316 /**7317 * The generated text response from the model7318 */7319 response: string;7320 /**7321 * Usage statistics for the inference request7322 */7323 usage?: {7324 /**7325 * Total number of tokens in input7326 */7327 prompt_tokens?: number;7328 /**7329 * Total number of tokens in output7330 */7331 completion_tokens?: number;7332 /**7333 * Total number of input and output tokens7334 */7335 total_tokens?: number;7336 };7337 /**7338 * An array of tool calls requests made during the response generation7339 */7340 tool_calls?: {7341 /**7342 * The arguments passed to be passed to the tool call request7343 */7344 arguments?: object;7345 /**7346 * The name of the tool to be called7347 */7348 name?: string;7349 }[];7350};7351declare abstract class Base_Ai_Cf_Qwen_Qwq_32B {7352 inputs: Ai_Cf_Qwen_Qwq_32B_Input;7353 postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output;7354}7355type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt | Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages;7356interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {7357 /**7358 * The input text prompt for the model to generate a response.7359 */7360 prompt: string;7361 /**7362 * JSON schema that should be fulfilled for the response.7363 */7364 guided_json?: object;7365 /**7366 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7367 */7368 raw?: boolean;7369 /**7370 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7371 */7372 stream?: boolean;7373 /**7374 * The maximum number of tokens to generate in the response.7375 */7376 max_tokens?: number;7377 /**7378 * Controls the randomness of the output; higher values produce more random results.7379 */7380 temperature?: number;7381 /**7382 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.7383 */7384 top_p?: number;7385 /**7386 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.7387 */7388 top_k?: number;7389 /**7390 * Random seed for reproducibility of the generation.7391 */7392 seed?: number;7393 /**7394 * Penalty for repeated tokens; higher values discourage repetition.7395 */7396 repetition_penalty?: number;7397 /**7398 * Decreases the likelihood of the model repeating the same lines verbatim.7399 */7400 frequency_penalty?: number;7401 /**7402 * Increases the likelihood of the model introducing new topics.7403 */7404 presence_penalty?: number;7405}7406interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {7407 /**7408 * An array of message objects representing the conversation history.7409 */7410 messages: {7411 /**7412 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').7413 */7414 role?: string;7415 /**7416 * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 0000000017417 */7418 tool_call_id?: string;7419 content?: string | {7420 /**7421 * Type of the content provided7422 */7423 type?: string;7424 text?: string;7425 image_url?: {7426 /**7427 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7428 */7429 url?: string;7430 };7431 }[] | {7432 /**7433 * Type of the content provided7434 */7435 type?: string;7436 text?: string;7437 image_url?: {7438 /**7439 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7440 */7441 url?: string;7442 };7443 };7444 }[];7445 functions?: {7446 name: string;7447 code: string;7448 }[];7449 /**7450 * A list of tools available for the assistant to use.7451 */7452 tools?: ({7453 /**7454 * The name of the tool. More descriptive the better.7455 */7456 name: string;7457 /**7458 * A brief description of what the tool does.7459 */7460 description: string;7461 /**7462 * Schema defining the parameters accepted by the tool.7463 */7464 parameters: {7465 /**7466 * The type of the parameters object (usually 'object').7467 */7468 type: string;7469 /**7470 * List of required parameter names.7471 */7472 required?: string[];7473 /**7474 * Definitions of each parameter.7475 */7476 properties: {7477 [k: string]: {7478 /**7479 * The data type of the parameter.7480 */7481 type: string;7482 /**7483 * A description of the expected parameter.7484 */7485 description: string;7486 };7487 };7488 };7489 } | {7490 /**7491 * Specifies the type of tool (e.g., 'function').7492 */7493 type: string;7494 /**7495 * Details of the function tool.7496 */7497 function: {7498 /**7499 * The name of the function.7500 */7501 name: string;7502 /**7503 * A brief description of what the function does.7504 */7505 description: string;7506 /**7507 * Schema defining the parameters accepted by the function.7508 */7509 parameters: {7510 /**7511 * The type of the parameters object (usually 'object').7512 */7513 type: string;7514 /**7515 * List of required parameter names.7516 */7517 required?: string[];7518 /**7519 * Definitions of each parameter.7520 */7521 properties: {7522 [k: string]: {7523 /**7524 * The data type of the parameter.7525 */7526 type: string;7527 /**7528 * A description of the expected parameter.7529 */7530 description: string;7531 };7532 };7533 };7534 };7535 })[];7536 /**7537 * JSON schema that should be fufilled for the response.7538 */7539 guided_json?: object;7540 /**7541 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7542 */7543 raw?: boolean;7544 /**7545 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7546 */7547 stream?: boolean;7548 /**7549 * The maximum number of tokens to generate in the response.7550 */7551 max_tokens?: number;7552 /**7553 * Controls the randomness of the output; higher values produce more random results.7554 */7555 temperature?: number;7556 /**7557 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.7558 */7559 top_p?: number;7560 /**7561 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.7562 */7563 top_k?: number;7564 /**7565 * Random seed for reproducibility of the generation.7566 */7567 seed?: number;7568 /**7569 * Penalty for repeated tokens; higher values discourage repetition.7570 */7571 repetition_penalty?: number;7572 /**7573 * Decreases the likelihood of the model repeating the same lines verbatim.7574 */7575 frequency_penalty?: number;7576 /**7577 * Increases the likelihood of the model introducing new topics.7578 */7579 presence_penalty?: number;7580}7581type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {7582 /**7583 * The generated text response from the model7584 */7585 response: string;7586 /**7587 * Usage statistics for the inference request7588 */7589 usage?: {7590 /**7591 * Total number of tokens in input7592 */7593 prompt_tokens?: number;7594 /**7595 * Total number of tokens in output7596 */7597 completion_tokens?: number;7598 /**7599 * Total number of input and output tokens7600 */7601 total_tokens?: number;7602 };7603 /**7604 * An array of tool calls requests made during the response generation7605 */7606 tool_calls?: {7607 /**7608 * The arguments passed to be passed to the tool call request7609 */7610 arguments?: object;7611 /**7612 * The name of the tool to be called7613 */7614 name?: string;7615 }[];7616};7617declare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct {7618 inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input;7619 postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output;7620}7621type Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages;7622interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {7623 /**7624 * The input text prompt for the model to generate a response.7625 */7626 prompt: string;7627 /**7628 * JSON schema that should be fufilled for the response.7629 */7630 guided_json?: object;7631 /**7632 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7633 */7634 raw?: boolean;7635 /**7636 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7637 */7638 stream?: boolean;7639 /**7640 * The maximum number of tokens to generate in the response.7641 */7642 max_tokens?: number;7643 /**7644 * Controls the randomness of the output; higher values produce more random results.7645 */7646 temperature?: number;7647 /**7648 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.7649 */7650 top_p?: number;7651 /**7652 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.7653 */7654 top_k?: number;7655 /**7656 * Random seed for reproducibility of the generation.7657 */7658 seed?: number;7659 /**7660 * Penalty for repeated tokens; higher values discourage repetition.7661 */7662 repetition_penalty?: number;7663 /**7664 * Decreases the likelihood of the model repeating the same lines verbatim.7665 */7666 frequency_penalty?: number;7667 /**7668 * Increases the likelihood of the model introducing new topics.7669 */7670 presence_penalty?: number;7671}7672interface Ai_Cf_Google_Gemma_3_12B_It_Messages {7673 /**7674 * An array of message objects representing the conversation history.7675 */7676 messages: {7677 /**7678 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').7679 */7680 role?: string;7681 content?: string | {7682 /**7683 * Type of the content provided7684 */7685 type?: string;7686 text?: string;7687 image_url?: {7688 /**7689 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7690 */7691 url?: string;7692 };7693 }[];7694 }[];7695 functions?: {7696 name: string;7697 code: string;7698 }[];7699 /**7700 * A list of tools available for the assistant to use.7701 */7702 tools?: ({7703 /**7704 * The name of the tool. More descriptive the better.7705 */7706 name: string;7707 /**7708 * A brief description of what the tool does.7709 */7710 description: string;7711 /**7712 * Schema defining the parameters accepted by the tool.7713 */7714 parameters: {7715 /**7716 * The type of the parameters object (usually 'object').7717 */7718 type: string;7719 /**7720 * List of required parameter names.7721 */7722 required?: string[];7723 /**7724 * Definitions of each parameter.7725 */7726 properties: {7727 [k: string]: {7728 /**7729 * The data type of the parameter.7730 */7731 type: string;7732 /**7733 * A description of the expected parameter.7734 */7735 description: string;7736 };7737 };7738 };7739 } | {7740 /**7741 * Specifies the type of tool (e.g., 'function').7742 */7743 type: string;7744 /**7745 * Details of the function tool.7746 */7747 function: {7748 /**7749 * The name of the function.7750 */7751 name: string;7752 /**7753 * A brief description of what the function does.7754 */7755 description: string;7756 /**7757 * Schema defining the parameters accepted by the function.7758 */7759 parameters: {7760 /**7761 * The type of the parameters object (usually 'object').7762 */7763 type: string;7764 /**7765 * List of required parameter names.7766 */7767 required?: string[];7768 /**7769 * Definitions of each parameter.7770 */7771 properties: {7772 [k: string]: {7773 /**7774 * The data type of the parameter.7775 */7776 type: string;7777 /**7778 * A description of the expected parameter.7779 */7780 description: string;7781 };7782 };7783 };7784 };7785 })[];7786 /**7787 * JSON schema that should be fufilled for the response.7788 */7789 guided_json?: object;7790 /**7791 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7792 */7793 raw?: boolean;7794 /**7795 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7796 */7797 stream?: boolean;7798 /**7799 * The maximum number of tokens to generate in the response.7800 */7801 max_tokens?: number;7802 /**7803 * Controls the randomness of the output; higher values produce more random results.7804 */7805 temperature?: number;7806 /**7807 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.7808 */7809 top_p?: number;7810 /**7811 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.7812 */7813 top_k?: number;7814 /**7815 * Random seed for reproducibility of the generation.7816 */7817 seed?: number;7818 /**7819 * Penalty for repeated tokens; higher values discourage repetition.7820 */7821 repetition_penalty?: number;7822 /**7823 * Decreases the likelihood of the model repeating the same lines verbatim.7824 */7825 frequency_penalty?: number;7826 /**7827 * Increases the likelihood of the model introducing new topics.7828 */7829 presence_penalty?: number;7830}7831type Ai_Cf_Google_Gemma_3_12B_It_Output = {7832 /**7833 * The generated text response from the model7834 */7835 response: string;7836 /**7837 * Usage statistics for the inference request7838 */7839 usage?: {7840 /**7841 * Total number of tokens in input7842 */7843 prompt_tokens?: number;7844 /**7845 * Total number of tokens in output7846 */7847 completion_tokens?: number;7848 /**7849 * Total number of input and output tokens7850 */7851 total_tokens?: number;7852 };7853 /**7854 * An array of tool calls requests made during the response generation7855 */7856 tool_calls?: {7857 /**7858 * The arguments passed to be passed to the tool call request7859 */7860 arguments?: object;7861 /**7862 * The name of the tool to be called7863 */7864 name?: string;7865 }[];7866};7867declare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {7868 inputs: Ai_Cf_Google_Gemma_3_12B_It_Input;7869 postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output;7870}7871type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch;7872interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {7873 /**7874 * The input text prompt for the model to generate a response.7875 */7876 prompt: string;7877 /**7878 * JSON schema that should be fulfilled for the response.7879 */7880 guided_json?: object;7881 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;7882 /**7883 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7884 */7885 raw?: boolean;7886 /**7887 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7888 */7889 stream?: boolean;7890 /**7891 * The maximum number of tokens to generate in the response.7892 */7893 max_tokens?: number;7894 /**7895 * Controls the randomness of the output; higher values produce more random results.7896 */7897 temperature?: number;7898 /**7899 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.7900 */7901 top_p?: number;7902 /**7903 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.7904 */7905 top_k?: number;7906 /**7907 * Random seed for reproducibility of the generation.7908 */7909 seed?: number;7910 /**7911 * Penalty for repeated tokens; higher values discourage repetition.7912 */7913 repetition_penalty?: number;7914 /**7915 * Decreases the likelihood of the model repeating the same lines verbatim.7916 */7917 frequency_penalty?: number;7918 /**7919 * Increases the likelihood of the model introducing new topics.7920 */7921 presence_penalty?: number;7922}7923interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {7924 type?: "json_object" | "json_schema";7925 json_schema?: unknown;7926}7927interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {7928 /**7929 * An array of message objects representing the conversation history.7930 */7931 messages: {7932 /**7933 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').7934 */7935 role?: string;7936 /**7937 * The tool call id. If you don't know what to put here you can fall back to 0000000017938 */7939 tool_call_id?: string;7940 content?: string | {7941 /**7942 * Type of the content provided7943 */7944 type?: string;7945 text?: string;7946 image_url?: {7947 /**7948 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7949 */7950 url?: string;7951 };7952 }[] | {7953 /**7954 * Type of the content provided7955 */7956 type?: string;7957 text?: string;7958 image_url?: {7959 /**7960 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7961 */7962 url?: string;7963 };7964 };7965 }[];7966 functions?: {7967 name: string;7968 code: string;7969 }[];7970 /**7971 * A list of tools available for the assistant to use.7972 */7973 tools?: ({7974 /**7975 * The name of the tool. More descriptive the better.7976 */7977 name: string;7978 /**7979 * A brief description of what the tool does.7980 */7981 description: string;7982 /**7983 * Schema defining the parameters accepted by the tool.7984 */7985 parameters: {7986 /**7987 * The type of the parameters object (usually 'object').7988 */7989 type: string;7990 /**7991 * List of required parameter names.7992 */7993 required?: string[];7994 /**7995 * Definitions of each parameter.7996 */7997 properties: {7998 [k: string]: {7999 /**8000 * The data type of the parameter.8001 */8002 type: string;8003 /**8004 * A description of the expected parameter.8005 */8006 description: string;8007 };8008 };8009 };8010 } | {8011 /**8012 * Specifies the type of tool (e.g., 'function').8013 */8014 type: string;8015 /**8016 * Details of the function tool.8017 */8018 function: {8019 /**8020 * The name of the function.8021 */8022 name: string;8023 /**8024 * A brief description of what the function does.8025 */8026 description: string;8027 /**8028 * Schema defining the parameters accepted by the function.8029 */8030 parameters: {8031 /**8032 * The type of the parameters object (usually 'object').8033 */8034 type: string;8035 /**8036 * List of required parameter names.8037 */8038 required?: string[];8039 /**8040 * Definitions of each parameter.8041 */8042 properties: {8043 [k: string]: {8044 /**8045 * The data type of the parameter.8046 */8047 type: string;8048 /**8049 * A description of the expected parameter.8050 */8051 description: string;8052 };8053 };8054 };8055 };8056 })[];8057 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;8058 /**8059 * JSON schema that should be fufilled for the response.8060 */8061 guided_json?: object;8062 /**8063 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8064 */8065 raw?: boolean;8066 /**8067 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8068 */8069 stream?: boolean;8070 /**8071 * The maximum number of tokens to generate in the response.8072 */8073 max_tokens?: number;8074 /**8075 * Controls the randomness of the output; higher values produce more random results.8076 */8077 temperature?: number;8078 /**8079 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.8080 */8081 top_p?: number;8082 /**8083 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.8084 */8085 top_k?: number;8086 /**8087 * Random seed for reproducibility of the generation.8088 */8089 seed?: number;8090 /**8091 * Penalty for repeated tokens; higher values discourage repetition.8092 */8093 repetition_penalty?: number;8094 /**8095 * Decreases the likelihood of the model repeating the same lines verbatim.8096 */8097 frequency_penalty?: number;8098 /**8099 * Increases the likelihood of the model introducing new topics.8100 */8101 presence_penalty?: number;8102}8103interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {8104 requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[];8105}8106interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {8107 /**8108 * The input text prompt for the model to generate a response.8109 */8110 prompt: string;8111 /**8112 * JSON schema that should be fulfilled for the response.8113 */8114 guided_json?: object;8115 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;8116 /**8117 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8118 */8119 raw?: boolean;8120 /**8121 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8122 */8123 stream?: boolean;8124 /**8125 * The maximum number of tokens to generate in the response.8126 */8127 max_tokens?: number;8128 /**8129 * Controls the randomness of the output; higher values produce more random results.8130 */8131 temperature?: number;8132 /**8133 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.8134 */8135 top_p?: number;8136 /**8137 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.8138 */8139 top_k?: number;8140 /**8141 * Random seed for reproducibility of the generation.8142 */8143 seed?: number;8144 /**8145 * Penalty for repeated tokens; higher values discourage repetition.8146 */8147 repetition_penalty?: number;8148 /**8149 * Decreases the likelihood of the model repeating the same lines verbatim.8150 */8151 frequency_penalty?: number;8152 /**8153 * Increases the likelihood of the model introducing new topics.8154 */8155 presence_penalty?: number;8156}8157interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {8158 /**8159 * An array of message objects representing the conversation history.8160 */8161 messages: {8162 /**8163 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').8164 */8165 role?: string;8166 /**8167 * The tool call id. If you don't know what to put here you can fall back to 0000000018168 */8169 tool_call_id?: string;8170 content?: string | {8171 /**8172 * Type of the content provided8173 */8174 type?: string;8175 text?: string;8176 image_url?: {8177 /**8178 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted8179 */8180 url?: string;8181 };8182 }[] | {8183 /**8184 * Type of the content provided8185 */8186 type?: string;8187 text?: string;8188 image_url?: {8189 /**8190 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted8191 */8192 url?: string;8193 };8194 };8195 }[];8196 functions?: {8197 name: string;8198 code: string;8199 }[];8200 /**8201 * A list of tools available for the assistant to use.8202 */8203 tools?: ({8204 /**8205 * The name of the tool. More descriptive the better.8206 */8207 name: string;8208 /**8209 * A brief description of what the tool does.8210 */8211 description: string;8212 /**8213 * Schema defining the parameters accepted by the tool.8214 */8215 parameters: {8216 /**8217 * The type of the parameters object (usually 'object').8218 */8219 type: string;8220 /**8221 * List of required parameter names.8222 */8223 required?: string[];8224 /**8225 * Definitions of each parameter.8226 */8227 properties: {8228 [k: string]: {8229 /**8230 * The data type of the parameter.8231 */8232 type: string;8233 /**8234 * A description of the expected parameter.8235 */8236 description: string;8237 };8238 };8239 };8240 } | {8241 /**8242 * Specifies the type of tool (e.g., 'function').8243 */8244 type: string;8245 /**8246 * Details of the function tool.8247 */8248 function: {8249 /**8250 * The name of the function.8251 */8252 name: string;8253 /**8254 * A brief description of what the function does.8255 */8256 description: string;8257 /**8258 * Schema defining the parameters accepted by the function.8259 */8260 parameters: {8261 /**8262 * The type of the parameters object (usually 'object').8263 */8264 type: string;8265 /**8266 * List of required parameter names.8267 */8268 required?: string[];8269 /**8270 * Definitions of each parameter.8271 */8272 properties: {8273 [k: string]: {8274 /**8275 * The data type of the parameter.8276 */8277 type: string;8278 /**8279 * A description of the expected parameter.8280 */8281 description: string;8282 };8283 };8284 };8285 };8286 })[];8287 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;8288 /**8289 * JSON schema that should be fufilled for the response.8290 */8291 guided_json?: object;8292 /**8293 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8294 */8295 raw?: boolean;8296 /**8297 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8298 */8299 stream?: boolean;8300 /**8301 * The maximum number of tokens to generate in the response.8302 */8303 max_tokens?: number;8304 /**8305 * Controls the randomness of the output; higher values produce more random results.8306 */8307 temperature?: number;8308 /**8309 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.8310 */8311 top_p?: number;8312 /**8313 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.8314 */8315 top_k?: number;8316 /**8317 * Random seed for reproducibility of the generation.8318 */8319 seed?: number;8320 /**8321 * Penalty for repeated tokens; higher values discourage repetition.8322 */8323 repetition_penalty?: number;8324 /**8325 * Decreases the likelihood of the model repeating the same lines verbatim.8326 */8327 frequency_penalty?: number;8328 /**8329 * Increases the likelihood of the model introducing new topics.8330 */8331 presence_penalty?: number;8332}8333type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {8334 /**8335 * The generated text response from the model8336 */8337 response: string;8338 /**8339 * Usage statistics for the inference request8340 */8341 usage?: {8342 /**8343 * Total number of tokens in input8344 */8345 prompt_tokens?: number;8346 /**8347 * Total number of tokens in output8348 */8349 completion_tokens?: number;8350 /**8351 * Total number of input and output tokens8352 */8353 total_tokens?: number;8354 };8355 /**8356 * An array of tool calls requests made during the response generation8357 */8358 tool_calls?: {8359 /**8360 * The tool call id.8361 */8362 id?: string;8363 /**8364 * Specifies the type of tool (e.g., 'function').8365 */8366 type?: string;8367 /**8368 * Details of the function tool.8369 */8370 function?: {8371 /**8372 * The name of the tool to be called8373 */8374 name?: string;8375 /**8376 * The arguments passed to be passed to the tool call request8377 */8378 arguments?: object;8379 };8380 }[];8381};8382declare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {8383 inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;8384 postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;8385}8386type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch;8387interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {8388 /**8389 * The input text prompt for the model to generate a response.8390 */8391 prompt: string;8392 /**8393 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.8394 */8395 lora?: string;8396 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode;8397 /**8398 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8399 */8400 raw?: boolean;8401 /**8402 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8403 */8404 stream?: boolean;8405 /**8406 * The maximum number of tokens to generate in the response.8407 */8408 max_tokens?: number;8409 /**8410 * Controls the randomness of the output; higher values produce more random results.8411 */8412 temperature?: number;8413 /**8414 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.8415 */8416 top_p?: number;8417 /**8418 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.8419 */8420 top_k?: number;8421 /**8422 * Random seed for reproducibility of the generation.8423 */8424 seed?: number;8425 /**8426 * Penalty for repeated tokens; higher values discourage repetition.8427 */8428 repetition_penalty?: number;8429 /**8430 * Decreases the likelihood of the model repeating the same lines verbatim.8431 */8432 frequency_penalty?: number;8433 /**8434 * Increases the likelihood of the model introducing new topics.8435 */8436 presence_penalty?: number;8437}8438interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {8439 type?: "json_object" | "json_schema";8440 json_schema?: unknown;8441}8442interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {8443 /**8444 * An array of message objects representing the conversation history.8445 */8446 messages: {8447 /**8448 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').8449 */8450 role: string;8451 content: string | {8452 /**8453 * Type of the content (text)8454 */8455 type?: string;8456 /**8457 * Text content8458 */8459 text?: string;8460 }[];8461 }[];8462 functions?: {8463 name: string;8464 code: string;8465 }[];8466 /**8467 * A list of tools available for the assistant to use.8468 */8469 tools?: ({8470 /**8471 * The name of the tool. More descriptive the better.8472 */8473 name: string;8474 /**8475 * A brief description of what the tool does.8476 */8477 description: string;8478 /**8479 * Schema defining the parameters accepted by the tool.8480 */8481 parameters: {8482 /**8483 * The type of the parameters object (usually 'object').8484 */8485 type: string;8486 /**8487 * List of required parameter names.8488 */8489 required?: string[];8490 /**8491 * Definitions of each parameter.8492 */8493 properties: {8494 [k: string]: {8495 /**8496 * The data type of the parameter.8497 */8498 type: string;8499 /**8500 * A description of the expected parameter.8501 */8502 description: string;8503 };8504 };8505 };8506 } | {8507 /**8508 * Specifies the type of tool (e.g., 'function').8509 */8510 type: string;8511 /**8512 * Details of the function tool.8513 */8514 function: {8515 /**8516 * The name of the function.8517 */8518 name: string;8519 /**8520 * A brief description of what the function does.8521 */8522 description: string;8523 /**8524 * Schema defining the parameters accepted by the function.8525 */8526 parameters: {8527 /**8528 * The type of the parameters object (usually 'object').8529 */8530 type: string;8531 /**8532 * List of required parameter names.8533 */8534 required?: string[];8535 /**8536 * Definitions of each parameter.8537 */8538 properties: {8539 [k: string]: {8540 /**8541 * The data type of the parameter.8542 */8543 type: string;8544 /**8545 * A description of the expected parameter.8546 */8547 description: string;8548 };8549 };8550 };8551 };8552 })[];8553 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1;8554 /**8555 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8556 */8557 raw?: boolean;8558 /**8559 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8560 */8561 stream?: boolean;8562 /**8563 * The maximum number of tokens to generate in the response.8564 */8565 max_tokens?: number;8566 /**8567 * Controls the randomness of the output; higher values produce more random results.8568 */8569 temperature?: number;8570 /**8571 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.8572 */8573 top_p?: number;8574 /**8575 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.8576 */8577 top_k?: number;8578 /**8579 * Random seed for reproducibility of the generation.8580 */8581 seed?: number;8582 /**8583 * Penalty for repeated tokens; higher values discourage repetition.8584 */8585 repetition_penalty?: number;8586 /**8587 * Decreases the likelihood of the model repeating the same lines verbatim.8588 */8589 frequency_penalty?: number;8590 /**8591 * Increases the likelihood of the model introducing new topics.8592 */8593 presence_penalty?: number;8594}8595interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {8596 type?: "json_object" | "json_schema";8597 json_schema?: unknown;8598}8599interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {8600 requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[];8601}8602interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {8603 /**8604 * The input text prompt for the model to generate a response.8605 */8606 prompt: string;8607 /**8608 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.8609 */8610 lora?: string;8611 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2;8612 /**8613 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8614 */8615 raw?: boolean;8616 /**8617 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8618 */8619 stream?: boolean;8620 /**8621 * The maximum number of tokens to generate in the response.8622 */8623 max_tokens?: number;8624 /**8625 * Controls the randomness of the output; higher values produce more random results.8626 */8627 temperature?: number;8628 /**8629 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.8630 */8631 top_p?: number;8632 /**8633 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.8634 */8635 top_k?: number;8636 /**8637 * Random seed for reproducibility of the generation.8638 */8639 seed?: number;8640 /**8641 * Penalty for repeated tokens; higher values discourage repetition.8642 */8643 repetition_penalty?: number;8644 /**8645 * Decreases the likelihood of the model repeating the same lines verbatim.8646 */8647 frequency_penalty?: number;8648 /**8649 * Increases the likelihood of the model introducing new topics.8650 */8651 presence_penalty?: number;8652}8653interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {8654 type?: "json_object" | "json_schema";8655 json_schema?: unknown;8656}8657interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {8658 /**8659 * An array of message objects representing the conversation history.8660 */8661 messages: {8662 /**8663 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').8664 */8665 role: string;8666 content: string | {8667 /**8668 * Type of the content (text)8669 */8670 type?: string;8671 /**8672 * Text content8673 */8674 text?: string;8675 }[];8676 }[];8677 functions?: {8678 name: string;8679 code: string;8680 }[];8681 /**8682 * A list of tools available for the assistant to use.8683 */8684 tools?: ({8685 /**8686 * The name of the tool. More descriptive the better.8687 */8688 name: string;8689 /**8690 * A brief description of what the tool does.8691 */8692 description: string;8693 /**8694 * Schema defining the parameters accepted by the tool.8695 */8696 parameters: {8697 /**8698 * The type of the parameters object (usually 'object').8699 */8700 type: string;8701 /**8702 * List of required parameter names.8703 */8704 required?: string[];8705 /**8706 * Definitions of each parameter.8707 */8708 properties: {8709 [k: string]: {8710 /**8711 * The data type of the parameter.8712 */8713 type: string;8714 /**8715 * A description of the expected parameter.8716 */8717 description: string;8718 };8719 };8720 };8721 } | {8722 /**8723 * Specifies the type of tool (e.g., 'function').8724 */8725 type: string;8726 /**8727 * Details of the function tool.8728 */8729 function: {8730 /**8731 * The name of the function.8732 */8733 name: string;8734 /**8735 * A brief description of what the function does.8736 */8737 description: string;8738 /**8739 * Schema defining the parameters accepted by the function.8740 */8741 parameters: {8742 /**8743 * The type of the parameters object (usually 'object').8744 */8745 type: string;8746 /**8747 * List of required parameter names.8748 */8749 required?: string[];8750 /**8751 * Definitions of each parameter.8752 */8753 properties: {8754 [k: string]: {8755 /**8756 * The data type of the parameter.8757 */8758 type: string;8759 /**8760 * A description of the expected parameter.8761 */8762 description: string;8763 };8764 };8765 };8766 };8767 })[];8768 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3;8769 /**8770 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8771 */8772 raw?: boolean;8773 /**8774 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8775 */8776 stream?: boolean;8777 /**8778 * The maximum number of tokens to generate in the response.8779 */8780 max_tokens?: number;8781 /**8782 * Controls the randomness of the output; higher values produce more random results.8783 */8784 temperature?: number;8785 /**8786 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.8787 */8788 top_p?: number;8789 /**8790 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.8791 */8792 top_k?: number;8793 /**8794 * Random seed for reproducibility of the generation.8795 */8796 seed?: number;8797 /**8798 * Penalty for repeated tokens; higher values discourage repetition.8799 */8800 repetition_penalty?: number;8801 /**8802 * Decreases the likelihood of the model repeating the same lines verbatim.8803 */8804 frequency_penalty?: number;8805 /**8806 * Increases the likelihood of the model introducing new topics.8807 */8808 presence_penalty?: number;8809}8810interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {8811 type?: "json_object" | "json_schema";8812 json_schema?: unknown;8813}8814type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response | string | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse;8815interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {8816 /**8817 * Unique identifier for the completion8818 */8819 id?: string;8820 /**8821 * Object type identifier8822 */8823 object?: "chat.completion";8824 /**8825 * Unix timestamp of when the completion was created8826 */8827 created?: number;8828 /**8829 * Model used for the completion8830 */8831 model?: string;8832 /**8833 * List of completion choices8834 */8835 choices?: {8836 /**8837 * Index of the choice in the list8838 */8839 index?: number;8840 /**8841 * The message generated by the model8842 */8843 message?: {8844 /**8845 * Role of the message author8846 */8847 role: string;8848 /**8849 * The content of the message8850 */8851 content: string;8852 /**8853 * Internal reasoning content (if available)8854 */8855 reasoning_content?: string;8856 /**8857 * Tool calls made by the assistant8858 */8859 tool_calls?: {8860 /**8861 * Unique identifier for the tool call8862 */8863 id: string;8864 /**8865 * Type of tool call8866 */8867 type: "function";8868 function: {8869 /**8870 * Name of the function to call8871 */8872 name: string;8873 /**8874 * JSON string of arguments for the function8875 */8876 arguments: string;8877 };8878 }[];8879 };8880 /**8881 * Reason why the model stopped generating8882 */8883 finish_reason?: string;8884 /**8885 * Stop reason (may be null)8886 */8887 stop_reason?: string | null;8888 /**8889 * Log probabilities (if requested)8890 */8891 logprobs?: {} | null;8892 }[];8893 /**8894 * Usage statistics for the inference request8895 */8896 usage?: {8897 /**8898 * Total number of tokens in input8899 */8900 prompt_tokens?: number;8901 /**8902 * Total number of tokens in output8903 */8904 completion_tokens?: number;8905 /**8906 * Total number of input and output tokens8907 */8908 total_tokens?: number;8909 };8910 /**8911 * Log probabilities for the prompt (if requested)8912 */8913 prompt_logprobs?: {} | null;8914}8915interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {8916 /**8917 * Unique identifier for the completion8918 */8919 id?: string;8920 /**8921 * Object type identifier8922 */8923 object?: "text_completion";8924 /**8925 * Unix timestamp of when the completion was created8926 */8927 created?: number;8928 /**8929 * Model used for the completion8930 */8931 model?: string;8932 /**8933 * List of completion choices8934 */8935 choices?: {8936 /**8937 * Index of the choice in the list8938 */8939 index: number;8940 /**8941 * The generated text completion8942 */8943 text: string;8944 /**8945 * Reason why the model stopped generating8946 */8947 finish_reason: string;8948 /**8949 * Stop reason (may be null)8950 */8951 stop_reason?: string | null;8952 /**8953 * Log probabilities (if requested)8954 */8955 logprobs?: {} | null;8956 /**8957 * Log probabilities for the prompt (if requested)8958 */8959 prompt_logprobs?: {} | null;8960 }[];8961 /**8962 * Usage statistics for the inference request8963 */8964 usage?: {8965 /**8966 * Total number of tokens in input8967 */8968 prompt_tokens?: number;8969 /**8970 * Total number of tokens in output8971 */8972 completion_tokens?: number;8973 /**8974 * Total number of input and output tokens8975 */8976 total_tokens?: number;8977 };8978}8979interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {8980 /**8981 * The async request id that can be used to obtain the results.8982 */8983 request_id?: string;8984}8985declare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 {8986 inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input;8987 postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output;8988}8989interface Ai_Cf_Deepgram_Nova_3_Input {8990 audio: {8991 body: object;8992 contentType: string;8993 };8994 /**8995 * Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param.8996 */8997 custom_topic_mode?: "extended" | "strict";8998 /**8999 * Custom topics you want the model to detect within your input audio or text if present Submit up to 1009000 */9001 custom_topic?: string;9002 /**9003 * Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in addition those submitted using the custom_intents param9004 */9005 custom_intent_mode?: "extended" | "strict";9006 /**9007 * Custom intents you want the model to detect within your input audio if present9008 */9009 custom_intent?: string;9010 /**9011 * Identifies and extracts key entities from content in submitted audio9012 */9013 detect_entities?: boolean;9014 /**9015 * Identifies the dominant language spoken in submitted audio9016 */9017 detect_language?: boolean;9018 /**9019 * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 09020 */9021 diarize?: boolean;9022 /**9023 * Identify and extract key entities from content in submitted audio9024 */9025 dictation?: boolean;9026 /**9027 * Specify the expected encoding of your submitted audio9028 */9029 encoding?: "linear16" | "flac" | "mulaw" | "amr-nb" | "amr-wb" | "opus" | "speex" | "g729";9030 /**9031 * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing9032 */9033 extra?: string;9034 /**9035 * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'9036 */9037 filler_words?: boolean;9038 /**9039 * Key term prompting can boost or suppress specialized terminology and brands.9040 */9041 keyterm?: string;9042 /**9043 * Keywords can boost or suppress specialized terminology and brands.9044 */9045 keywords?: string;9046 /**9047 * The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available.9048 */9049 language?: string;9050 /**9051 * Spoken measurements will be converted to their corresponding abbreviations.9052 */9053 measurements?: boolean;9054 /**9055 * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip.9056 */9057 mip_opt_out?: boolean;9058 /**9059 * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio9060 */9061 mode?: "general" | "medical" | "finance";9062 /**9063 * Transcribe each audio channel independently.9064 */9065 multichannel?: boolean;9066 /**9067 * Numerals converts numbers from written format to numerical format.9068 */9069 numerals?: boolean;9070 /**9071 * Splits audio into paragraphs to improve transcript readability.9072 */9073 paragraphs?: boolean;9074 /**9075 * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.9076 */9077 profanity_filter?: boolean;9078 /**9079 * Add punctuation and capitalization to the transcript.9080 */9081 punctuate?: boolean;9082 /**9083 * Redaction removes sensitive information from your transcripts.9084 */9085 redact?: string;9086 /**9087 * Search for terms or phrases in submitted audio and replaces them.9088 */9089 replace?: string;9090 /**9091 * Search for terms or phrases in submitted audio.9092 */9093 search?: string;9094 /**9095 * Recognizes the sentiment throughout a transcript or text.9096 */9097 sentiment?: boolean;9098 /**9099 * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.9100 */9101 smart_format?: boolean;9102 /**9103 * Detect topics throughout a transcript or text.9104 */9105 topics?: boolean;9106 /**9107 * Segments speech into meaningful semantic units.9108 */9109 utterances?: boolean;9110 /**9111 * Seconds to wait before detecting a pause between words in submitted audio.9112 */9113 utt_split?: number;9114 /**9115 * The number of channels in the submitted audio9116 */9117 channels?: number;9118 /**9119 * Specifies whether the streaming endpoint should provide ongoing transcription updates as more audio is received. When set to true, the endpoint sends continuous updates, meaning transcription results may evolve over time. Note: Supported only for webosockets.9120 */9121 interim_results?: boolean;9122 /**9123 * Indicates how long model will wait to detect whether a speaker has finished speaking or pauses for a significant period of time. When set to a value, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final parameter set to true. Can also be set to false to disable endpointing9124 */9125 endpointing?: string;9126 /**9127 * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.9128 */9129 vad_events?: boolean;9130 /**9131 * Indicates how long model will wait to send an UtteranceEnd message after a word has been transcribed. Use with interim_results. Note: Supported only for webosockets.9132 */9133 utterance_end_ms?: boolean;9134}9135interface Ai_Cf_Deepgram_Nova_3_Output {9136 results?: {9137 channels?: {9138 alternatives?: {9139 confidence?: number;9140 transcript?: string;9141 words?: {9142 confidence?: number;9143 end?: number;9144 start?: number;9145 word?: string;9146 }[];9147 }[];9148 }[];9149 summary?: {9150 result?: string;9151 short?: string;9152 };9153 sentiments?: {9154 segments?: {9155 text?: string;9156 start_word?: number;9157 end_word?: number;9158 sentiment?: string;9159 sentiment_score?: number;9160 }[];9161 average?: {9162 sentiment?: string;9163 sentiment_score?: number;9164 };9165 };9166 };9167}9168declare abstract class Base_Ai_Cf_Deepgram_Nova_3 {9169 inputs: Ai_Cf_Deepgram_Nova_3_Input;9170 postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;9171}9172interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {9173 queries?: string | string[];9174 /**9175 * Optional instruction for the task9176 */9177 instruction?: string;9178 documents?: string | string[];9179 text?: string | string[];9180}9181interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {9182 data?: number[][];9183 shape?: number[];9184}9185declare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B {9186 inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input;9187 postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output;9188}9189type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {9190 /**9191 * readable stream with audio data and content-type specified for that data9192 */9193 audio: {9194 body: object;9195 contentType: string;9196 };9197 /**9198 * type of data PCM data that's sent to the inference server as raw array9199 */9200 dtype?: "uint8" | "float32" | "float64";9201} | {9202 /**9203 * base64 encoded audio data9204 */9205 audio: string;9206 /**9207 * type of data PCM data that's sent to the inference server as raw array9208 */9209 dtype?: "uint8" | "float32" | "float64";9210};9211interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {9212 /**9213 * if true, end-of-turn was detected9214 */9215 is_complete?: boolean;9216 /**9217 * probability of the end-of-turn detection9218 */9219 probability?: number;9220}9221declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {9222 inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;9223 postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;9224}9225declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {9226 inputs: XOR<ResponsesInput, ChatCompletionsMessagesInput>;9227 postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;9228}9229declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {9230 inputs: XOR<ResponsesInput, ChatCompletionsMessagesInput>;9231 postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;9232}9233interface Ai_Cf_Leonardo_Phoenix_1_0_Input {9234 /**9235 * A text description of the image you want to generate.9236 */9237 prompt: string;9238 /**9239 * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt9240 */9241 guidance?: number;9242 /**9243 * Random seed for reproducibility of the image generation9244 */9245 seed?: number;9246 /**9247 * The height of the generated image in pixels9248 */9249 height?: number;9250 /**9251 * The width of the generated image in pixels9252 */9253 width?: number;9254 /**9255 * The number of diffusion steps; higher values can improve quality but take longer9256 */9257 num_steps?: number;9258 /**9259 * Specify what to exclude from the generated images9260 */9261 negative_prompt?: string;9262}9263/**9264 * The generated image in JPEG format9265 */9266type Ai_Cf_Leonardo_Phoenix_1_0_Output = string;9267declare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {9268 inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;9269 postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;9270}9271interface Ai_Cf_Leonardo_Lucid_Origin_Input {9272 /**9273 * A text description of the image you want to generate.9274 */9275 prompt: string;9276 /**9277 * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt9278 */9279 guidance?: number;9280 /**9281 * Random seed for reproducibility of the image generation9282 */9283 seed?: number;9284 /**9285 * The height of the generated image in pixels9286 */9287 height?: number;9288 /**9289 * The width of the generated image in pixels9290 */9291 width?: number;9292 /**9293 * The number of diffusion steps; higher values can improve quality but take longer9294 */9295 num_steps?: number;9296 /**9297 * The number of diffusion steps; higher values can improve quality but take longer9298 */9299 steps?: number;9300}9301interface Ai_Cf_Leonardo_Lucid_Origin_Output {9302 /**9303 * The generated image in Base64 format.9304 */9305 image?: string;9306}9307declare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {9308 inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;9309 postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;9310}9311interface Ai_Cf_Deepgram_Aura_1_Input {9312 /**9313 * Speaker used to produce the audio.9314 */9315 speaker?: "angus" | "asteria" | "arcas" | "orion" | "orpheus" | "athena" | "luna" | "zeus" | "perseus" | "helios" | "hera" | "stella";9316 /**9317 * Encoding of the output audio.9318 */9319 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";9320 /**9321 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..9322 */9323 container?: "none" | "wav" | "ogg";9324 /**9325 * The text content to be converted to speech9326 */9327 text: string;9328 /**9329 * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable9330 */9331 sample_rate?: number;9332 /**9333 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.9334 */9335 bit_rate?: number;9336}9337/**9338 * The generated audio in MP3 format9339 */9340type Ai_Cf_Deepgram_Aura_1_Output = string;9341declare abstract class Base_Ai_Cf_Deepgram_Aura_1 {9342 inputs: Ai_Cf_Deepgram_Aura_1_Input;9343 postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;9344}9345interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {9346 /**9347 * Input text to translate. Can be a single string or a list of strings.9348 */9349 text: string | string[];9350 /**9351 * Target langauge to translate to9352 */9353 target_language: "asm_Beng" | "awa_Deva" | "ben_Beng" | "bho_Deva" | "brx_Deva" | "doi_Deva" | "eng_Latn" | "gom_Deva" | "gon_Deva" | "guj_Gujr" | "hin_Deva" | "hne_Deva" | "kan_Knda" | "kas_Arab" | "kas_Deva" | "kha_Latn" | "lus_Latn" | "mag_Deva" | "mai_Deva" | "mal_Mlym" | "mar_Deva" | "mni_Beng" | "mni_Mtei" | "npi_Deva" | "ory_Orya" | "pan_Guru" | "san_Deva" | "sat_Olck" | "snd_Arab" | "snd_Deva" | "tam_Taml" | "tel_Telu" | "urd_Arab" | "unr_Deva";9354}9355interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {9356 /**9357 * Translated texts9358 */9359 translations: string[];9360}9361declare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B {9362 inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input;9363 postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output;9364}9365type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch;9366interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {9367 /**9368 * The input text prompt for the model to generate a response.9369 */9370 prompt: string;9371 /**9372 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.9373 */9374 lora?: string;9375 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode;9376 /**9377 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.9378 */9379 raw?: boolean;9380 /**9381 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.9382 */9383 stream?: boolean;9384 /**9385 * The maximum number of tokens to generate in the response.9386 */9387 max_tokens?: number;9388 /**9389 * Controls the randomness of the output; higher values produce more random results.9390 */9391 temperature?: number;9392 /**9393 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.9394 */9395 top_p?: number;9396 /**9397 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.9398 */9399 top_k?: number;9400 /**9401 * Random seed for reproducibility of the generation.9402 */9403 seed?: number;9404 /**9405 * Penalty for repeated tokens; higher values discourage repetition.9406 */9407 repetition_penalty?: number;9408 /**9409 * Decreases the likelihood of the model repeating the same lines verbatim.9410 */9411 frequency_penalty?: number;9412 /**9413 * Increases the likelihood of the model introducing new topics.9414 */9415 presence_penalty?: number;9416}9417interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {9418 type?: "json_object" | "json_schema";9419 json_schema?: unknown;9420}9421interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {9422 /**9423 * An array of message objects representing the conversation history.9424 */9425 messages: {9426 /**9427 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').9428 */9429 role: string;9430 content: string | {9431 /**9432 * Type of the content (text)9433 */9434 type?: string;9435 /**9436 * Text content9437 */9438 text?: string;9439 }[];9440 }[];9441 functions?: {9442 name: string;9443 code: string;9444 }[];9445 /**9446 * A list of tools available for the assistant to use.9447 */9448 tools?: ({9449 /**9450 * The name of the tool. More descriptive the better.9451 */9452 name: string;9453 /**9454 * A brief description of what the tool does.9455 */9456 description: string;9457 /**9458 * Schema defining the parameters accepted by the tool.9459 */9460 parameters: {9461 /**9462 * The type of the parameters object (usually 'object').9463 */9464 type: string;9465 /**9466 * List of required parameter names.9467 */9468 required?: string[];9469 /**9470 * Definitions of each parameter.9471 */9472 properties: {9473 [k: string]: {9474 /**9475 * The data type of the parameter.9476 */9477 type: string;9478 /**9479 * A description of the expected parameter.9480 */9481 description: string;9482 };9483 };9484 };9485 } | {9486 /**9487 * Specifies the type of tool (e.g., 'function').9488 */9489 type: string;9490 /**9491 * Details of the function tool.9492 */9493 function: {9494 /**9495 * The name of the function.9496 */9497 name: string;9498 /**9499 * A brief description of what the function does.9500 */9501 description: string;9502 /**9503 * Schema defining the parameters accepted by the function.9504 */9505 parameters: {9506 /**9507 * The type of the parameters object (usually 'object').9508 */9509 type: string;9510 /**9511 * List of required parameter names.9512 */9513 required?: string[];9514 /**9515 * Definitions of each parameter.9516 */9517 properties: {9518 [k: string]: {9519 /**9520 * The data type of the parameter.9521 */9522 type: string;9523 /**9524 * A description of the expected parameter.9525 */9526 description: string;9527 };9528 };9529 };9530 };9531 })[];9532 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1;9533 /**9534 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.9535 */9536 raw?: boolean;9537 /**9538 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.9539 */9540 stream?: boolean;9541 /**9542 * The maximum number of tokens to generate in the response.9543 */9544 max_tokens?: number;9545 /**9546 * Controls the randomness of the output; higher values produce more random results.9547 */9548 temperature?: number;9549 /**9550 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.9551 */9552 top_p?: number;9553 /**9554 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.9555 */9556 top_k?: number;9557 /**9558 * Random seed for reproducibility of the generation.9559 */9560 seed?: number;9561 /**9562 * Penalty for repeated tokens; higher values discourage repetition.9563 */9564 repetition_penalty?: number;9565 /**9566 * Decreases the likelihood of the model repeating the same lines verbatim.9567 */9568 frequency_penalty?: number;9569 /**9570 * Increases the likelihood of the model introducing new topics.9571 */9572 presence_penalty?: number;9573}9574interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {9575 type?: "json_object" | "json_schema";9576 json_schema?: unknown;9577}9578interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {9579 requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[];9580}9581interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {9582 /**9583 * The input text prompt for the model to generate a response.9584 */9585 prompt: string;9586 /**9587 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.9588 */9589 lora?: string;9590 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2;9591 /**9592 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.9593 */9594 raw?: boolean;9595 /**9596 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.9597 */9598 stream?: boolean;9599 /**9600 * The maximum number of tokens to generate in the response.9601 */9602 max_tokens?: number;9603 /**9604 * Controls the randomness of the output; higher values produce more random results.9605 */9606 temperature?: number;9607 /**9608 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.9609 */9610 top_p?: number;9611 /**9612 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.9613 */9614 top_k?: number;9615 /**9616 * Random seed for reproducibility of the generation.9617 */9618 seed?: number;9619 /**9620 * Penalty for repeated tokens; higher values discourage repetition.9621 */9622 repetition_penalty?: number;9623 /**9624 * Decreases the likelihood of the model repeating the same lines verbatim.9625 */9626 frequency_penalty?: number;9627 /**9628 * Increases the likelihood of the model introducing new topics.9629 */9630 presence_penalty?: number;9631}9632interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {9633 type?: "json_object" | "json_schema";9634 json_schema?: unknown;9635}9636interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {9637 /**9638 * An array of message objects representing the conversation history.9639 */9640 messages: {9641 /**9642 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').9643 */9644 role: string;9645 content: string | {9646 /**9647 * Type of the content (text)9648 */9649 type?: string;9650 /**9651 * Text content9652 */9653 text?: string;9654 }[];9655 }[];9656 functions?: {9657 name: string;9658 code: string;9659 }[];9660 /**9661 * A list of tools available for the assistant to use.9662 */9663 tools?: ({9664 /**9665 * The name of the tool. More descriptive the better.9666 */9667 name: string;9668 /**9669 * A brief description of what the tool does.9670 */9671 description: string;9672 /**9673 * Schema defining the parameters accepted by the tool.9674 */9675 parameters: {9676 /**9677 * The type of the parameters object (usually 'object').9678 */9679 type: string;9680 /**9681 * List of required parameter names.9682 */9683 required?: string[];9684 /**9685 * Definitions of each parameter.9686 */9687 properties: {9688 [k: string]: {9689 /**9690 * The data type of the parameter.9691 */9692 type: string;9693 /**9694 * A description of the expected parameter.9695 */9696 description: string;9697 };9698 };9699 };9700 } | {9701 /**9702 * Specifies the type of tool (e.g., 'function').9703 */9704 type: string;9705 /**9706 * Details of the function tool.9707 */9708 function: {9709 /**9710 * The name of the function.9711 */9712 name: string;9713 /**9714 * A brief description of what the function does.9715 */9716 description: string;9717 /**9718 * Schema defining the parameters accepted by the function.9719 */9720 parameters: {9721 /**9722 * The type of the parameters object (usually 'object').9723 */9724 type: string;9725 /**9726 * List of required parameter names.9727 */9728 required?: string[];9729 /**9730 * Definitions of each parameter.9731 */9732 properties: {9733 [k: string]: {9734 /**9735 * The data type of the parameter.9736 */9737 type: string;9738 /**9739 * A description of the expected parameter.9740 */9741 description: string;9742 };9743 };9744 };9745 };9746 })[];9747 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3;9748 /**9749 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.9750 */9751 raw?: boolean;9752 /**9753 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.9754 */9755 stream?: boolean;9756 /**9757 * The maximum number of tokens to generate in the response.9758 */9759 max_tokens?: number;9760 /**9761 * Controls the randomness of the output; higher values produce more random results.9762 */9763 temperature?: number;9764 /**9765 * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.9766 */9767 top_p?: number;9768 /**9769 * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.9770 */9771 top_k?: number;9772 /**9773 * Random seed for reproducibility of the generation.9774 */9775 seed?: number;9776 /**9777 * Penalty for repeated tokens; higher values discourage repetition.9778 */9779 repetition_penalty?: number;9780 /**9781 * Decreases the likelihood of the model repeating the same lines verbatim.9782 */9783 frequency_penalty?: number;9784 /**9785 * Increases the likelihood of the model introducing new topics.9786 */9787 presence_penalty?: number;9788}9789interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {9790 type?: "json_object" | "json_schema";9791 json_schema?: unknown;9792}9793type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response | string | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse;9794interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response {9795 /**9796 * Unique identifier for the completion9797 */9798 id?: string;9799 /**9800 * Object type identifier9801 */9802 object?: "chat.completion";9803 /**9804 * Unix timestamp of when the completion was created9805 */9806 created?: number;9807 /**9808 * Model used for the completion9809 */9810 model?: string;9811 /**9812 * List of completion choices9813 */9814 choices?: {9815 /**9816 * Index of the choice in the list9817 */9818 index?: number;9819 /**9820 * The message generated by the model9821 */9822 message?: {9823 /**9824 * Role of the message author9825 */9826 role: string;9827 /**9828 * The content of the message9829 */9830 content: string;9831 /**9832 * Internal reasoning content (if available)9833 */9834 reasoning_content?: string;9835 /**9836 * Tool calls made by the assistant9837 */9838 tool_calls?: {9839 /**9840 * Unique identifier for the tool call9841 */9842 id: string;9843 /**9844 * Type of tool call9845 */9846 type: "function";9847 function: {9848 /**9849 * Name of the function to call9850 */9851 name: string;9852 /**9853 * JSON string of arguments for the function9854 */9855 arguments: string;9856 };9857 }[];9858 };9859 /**9860 * Reason why the model stopped generating9861 */9862 finish_reason?: string;9863 /**9864 * Stop reason (may be null)9865 */9866 stop_reason?: string | null;9867 /**9868 * Log probabilities (if requested)9869 */9870 logprobs?: {} | null;9871 }[];9872 /**9873 * Usage statistics for the inference request9874 */9875 usage?: {9876 /**9877 * Total number of tokens in input9878 */9879 prompt_tokens?: number;9880 /**9881 * Total number of tokens in output9882 */9883 completion_tokens?: number;9884 /**9885 * Total number of input and output tokens9886 */9887 total_tokens?: number;9888 };9889 /**9890 * Log probabilities for the prompt (if requested)9891 */9892 prompt_logprobs?: {} | null;9893}9894interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response {9895 /**9896 * Unique identifier for the completion9897 */9898 id?: string;9899 /**9900 * Object type identifier9901 */9902 object?: "text_completion";9903 /**9904 * Unix timestamp of when the completion was created9905 */9906 created?: number;9907 /**9908 * Model used for the completion9909 */9910 model?: string;9911 /**9912 * List of completion choices9913 */9914 choices?: {9915 /**9916 * Index of the choice in the list9917 */9918 index: number;9919 /**9920 * The generated text completion9921 */9922 text: string;9923 /**9924 * Reason why the model stopped generating9925 */9926 finish_reason: string;9927 /**9928 * Stop reason (may be null)9929 */9930 stop_reason?: string | null;9931 /**9932 * Log probabilities (if requested)9933 */9934 logprobs?: {} | null;9935 /**9936 * Log probabilities for the prompt (if requested)9937 */9938 prompt_logprobs?: {} | null;9939 }[];9940 /**9941 * Usage statistics for the inference request9942 */9943 usage?: {9944 /**9945 * Total number of tokens in input9946 */9947 prompt_tokens?: number;9948 /**9949 * Total number of tokens in output9950 */9951 completion_tokens?: number;9952 /**9953 * Total number of input and output tokens9954 */9955 total_tokens?: number;9956 };9957}9958interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {9959 /**9960 * The async request id that can be used to obtain the results.9961 */9962 request_id?: string;9963}9964declare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It {9965 inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input;9966 postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output;9967}9968interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {9969 /**9970 * Input text to embed. Can be a single string or a list of strings.9971 */9972 text: string | string[];9973}9974interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {9975 /**9976 * Embedding vectors, where each vector is a list of floats.9977 */9978 data: number[][];9979 /**9980 * Shape of the embedding data as [number_of_embeddings, embedding_dimension].9981 *9982 * @minItems 29983 * @maxItems 29984 */9985 shape: [9986 number,9987 number9988 ];9989}9990declare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B {9991 inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input;9992 postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output;9993}9994interface Ai_Cf_Deepgram_Flux_Input {9995 /**9996 * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM.9997 */9998 encoding: "linear16";9999 /**10000 * Sample rate of the audio stream in Hz.10001 */10002 sample_rate: string;10003 /**10004 * End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid Values 0.3 - 0.9.10005 */10006 eager_eot_threshold?: string;10007 /**10008 * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.10009 */10010 eot_threshold?: string;10011 /**10012 * A turn will be finished when this much time has passed after speech, regardless of EOT confidence.10013 */10014 eot_timeout_ms?: string;10015 /**10016 * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.10017 */10018 keyterm?: string;10019 /**10020 * Opts out requests from the Deepgram Model Improvement Program. Refer to Deepgram Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip10021 */10022 mip_opt_out?: "true" | "false";10023 /**10024 * Label your requests for the purpose of identification during usage reporting10025 */10026 tag?: string;10027}10028/**10029 * Output will be returned as websocket messages.10030 */10031interface Ai_Cf_Deepgram_Flux_Output {10032 /**10033 * The unique identifier of the request (uuid)10034 */10035 request_id?: string;10036 /**10037 * Starts at 0 and increments for each message the server sends to the client.10038 */10039 sequence_id?: number;10040 /**10041 * The type of event being reported.10042 */10043 event?: "Update" | "StartOfTurn" | "EagerEndOfTurn" | "TurnResumed" | "EndOfTurn";10044 /**10045 * The index of the current turn10046 */10047 turn_index?: number;10048 /**10049 * Start time in seconds of the audio range that was transcribed10050 */10051 audio_window_start?: number;10052 /**10053 * End time in seconds of the audio range that was transcribed10054 */10055 audio_window_end?: number;10056 /**10057 * Text that was said over the course of the current turn10058 */10059 transcript?: string;10060 /**10061 * The words in the transcript10062 */10063 words?: {10064 /**10065 * The individual punctuated, properly-cased word from the transcript10066 */10067 word: string;10068 /**10069 * Confidence that this word was transcribed correctly10070 */10071 confidence: number;10072 }[];10073 /**10074 * Confidence that no more speech is coming in this turn10075 */10076 end_of_turn_confidence?: number;10077}10078declare abstract class Base_Ai_Cf_Deepgram_Flux {10079 inputs: Ai_Cf_Deepgram_Flux_Input;10080 postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output;10081}10082interface Ai_Cf_Deepgram_Aura_2_En_Input {10083 /**10084 * Speaker used to produce the audio.10085 */10086 speaker?: "amalthea" | "andromeda" | "apollo" | "arcas" | "aries" | "asteria" | "athena" | "atlas" | "aurora" | "callista" | "cora" | "cordelia" | "delia" | "draco" | "electra" | "harmonia" | "helena" | "hera" | "hermes" | "hyperion" | "iris" | "janus" | "juno" | "jupiter" | "luna" | "mars" | "minerva" | "neptune" | "odysseus" | "ophelia" | "orion" | "orpheus" | "pandora" | "phoebe" | "pluto" | "saturn" | "thalia" | "theia" | "vesta" | "zeus";10087 /**10088 * Encoding of the output audio.10089 */10090 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";10091 /**10092 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..10093 */10094 container?: "none" | "wav" | "ogg";10095 /**10096 * The text content to be converted to speech10097 */10098 text: string;10099 /**10100 * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable10101 */10102 sample_rate?: number;10103 /**10104 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.10105 */10106 bit_rate?: number;10107}10108/**10109 * The generated audio in MP3 format10110 */10111type Ai_Cf_Deepgram_Aura_2_En_Output = string;10112declare abstract class Base_Ai_Cf_Deepgram_Aura_2_En {10113 inputs: Ai_Cf_Deepgram_Aura_2_En_Input;10114 postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output;10115}10116interface Ai_Cf_Deepgram_Aura_2_Es_Input {10117 /**10118 * Speaker used to produce the audio.10119 */10120 speaker?: "sirio" | "nestor" | "carina" | "celeste" | "alvaro" | "diana" | "aquila" | "selena" | "estrella" | "javier";10121 /**10122 * Encoding of the output audio.10123 */10124 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";10125 /**10126 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..10127 */10128 container?: "none" | "wav" | "ogg";10129 /**10130 * The text content to be converted to speech10131 */10132 text: string;10133 /**10134 * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable10135 */10136 sample_rate?: number;10137 /**10138 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.10139 */10140 bit_rate?: number;10141}10142/**10143 * The generated audio in MP3 format10144 */10145type Ai_Cf_Deepgram_Aura_2_Es_Output = string;10146declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {10147 inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;10148 postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;10149}10150interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {10151 multipart: {10152 body?: object;10153 contentType?: string;10154 };10155}10156interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {10157 /**10158 * Generated image as Base64 string.10159 */10160 image?: string;10161}10162declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {10163 inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;10164 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;10165}10166interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {10167 multipart: {10168 body?: object;10169 contentType?: string;10170 };10171}10172interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {10173 /**10174 * Generated image as Base64 string.10175 */10176 image?: string;10177}10178declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {10179 inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;10180 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;10181}10182interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {10183 multipart: {10184 body?: object;10185 contentType?: string;10186 };10187}10188interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {10189 /**10190 * Generated image as Base64 string.10191 */10192 image?: string;10193}10194declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {10195 inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;10196 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;10197}10198declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {10199 inputs: ChatCompletionsInput;10200 postProcessedOutputs: ChatCompletionsOutput;10201}10202declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {10203 inputs: ChatCompletionsInput;10204 postProcessedOutputs: ChatCompletionsOutput;10205}10206declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {10207 inputs: ChatCompletionsInput;10208 postProcessedOutputs: ChatCompletionsOutput;10209}10210declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {10211 inputs: ChatCompletionsInput;10212 postProcessedOutputs: ChatCompletionsOutput;10213}10214declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {10215 inputs: ChatCompletionsInput;10216 postProcessedOutputs: ChatCompletionsOutput;10217}10218declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code {10219 inputs: ChatCompletionsInput;10220 postProcessedOutputs: ChatCompletionsOutput;10221}10222declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 {10223 inputs: ChatCompletionsInput;10224 postProcessedOutputs: ChatCompletionsOutput;10225}10226interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input {10227 /**10228 * Which Moondream skill to run.10229 */10230 task?: "query" | "caption" | "point" | "detect";10231 /**10232 * Input image as a public HTTPS URL or base64 data URI. Optional for `query`; required for `caption`, `point`, and `detect`.10233 */10234 image?: string;10235 /**10236 * Question for the `query` task.10237 */10238 question?: string;10239 /**10240 * Caption length for the `caption` task.10241 */10242 caption_length?: "short" | "normal" | "long";10243 /**10244 * Object phrase to locate for `point` and `detect` tasks (e.g. 'person wearing a red shirt').10245 */10246 target?: string;10247 /**10248 * Enable reasoning trace for the `query` task.10249 */10250 reasoning?: boolean;10251 /**10252 * Sampling temperature.10253 */10254 temperature?: number;10255 /**10256 * Top-p (nucleus) sampling.10257 */10258 top_p?: number;10259 /**10260 * Max tokens to generate for `query` and `caption`.10261 */10262 max_tokens?: number;10263 /**10264 * Max objects to return for `point` and `detect`.10265 */10266 max_objects?: number;10267 /**10268 * Return incremental tokens for `query` and `caption`. `point` and `detect` do not support streaming.10269 */10270 stream?: boolean;10271}10272interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output {10273 /**10274 * Reason the generation finished.10275 */10276 finish_reason: string;10277 metrics: {10278 /**10279 * Number of input tokens consumed.10280 */10281 input_tokens: number;10282 /**10283 * Number of output tokens generated.10284 */10285 output_tokens: number;10286 /**10287 * Prefill time in milliseconds.10288 */10289 prefill_time_ms: number;10290 /**10291 * Decode time in milliseconds.10292 */10293 decode_time_ms: number;10294 /**10295 * Time to first token in milliseconds.10296 */10297 ttft_ms: number;10298 };10299 /**10300 * Answer text for the `query` task. Null for other tasks.10301 */10302 answer?: string;10303 /**10304 * Caption text for the `caption` task. Null for other tasks.10305 */10306 caption?: string;10307 /**10308 * Located points for the `point` task. Null for other tasks.10309 */10310 points?: {10311 /**10312 * X coordinate.10313 */10314 x: number;10315 /**10316 * Y coordinate.10317 */10318 y: number;10319 }[];10320 /**10321 * Detected bounding boxes for the `detect` task. Null for other tasks.10322 */10323 objects?: {10324 /**10325 * Minimum X coordinate.10326 */10327 x_min: number;10328 /**10329 * Minimum Y coordinate.10330 */10331 y_min: number;10332 /**10333 * Maximum X coordinate.10334 */10335 x_max: number;10336 /**10337 * Maximum Y coordinate.10338 */10339 y_max: number;10340 }[];10341 /**10342 * Reasoning trace for the `query` task when reasoning=true. Null otherwise.10343 */10344 reasoning?: {10345 /**10346 * Reasoning text.10347 */10348 text: string;10349 /**10350 * Grounding information.10351 */10352 grounding?: {}[];10353 };10354}10355declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B {10356 inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input;10357 postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output;10358}10359declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 {10360 inputs: ChatCompletionsInput;10361 postProcessedOutputs: ChatCompletionsOutput;10362}10363declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 {10364 inputs: ChatCompletionsInput;10365 postProcessedOutputs: ChatCompletionsOutput;10366}10367declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B {10368 inputs: ChatCompletionsInput;10369 postProcessedOutputs: ChatCompletionsOutput;10370}10371declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash {10372 inputs: ChatCompletionsInput;10373 postProcessedOutputs: ChatCompletionsOutput;10374}10375interface AiModels {10376 "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;10377 "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;10378 "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;10379 "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage;10380 "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;10381 "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;10382 "@cf/myshell-ai/melotts": BaseAiTextToSpeech;10383 "@cf/google/embeddinggemma-300m": BaseAiTextEmbeddings;10384 "@cf/microsoft/resnet-50": BaseAiImageClassification;10385 "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;10386 "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;10387 "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;10388 "@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;10389 "@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;10390 "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;10391 "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;10392 "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;10393 "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;10394 "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;10395 "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;10396 "@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;10397 "@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;10398 "@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;10399 "@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;10400 "@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;10401 "@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;10402 "@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;10403 "@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;10404 "@cf/microsoft/phi-2": BaseAiTextGeneration;10405 "@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;10406 "@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;10407 "@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;10408 "@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;10409 "@hf/google/gemma-7b-it": BaseAiTextGeneration;10410 "@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;10411 "@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;10412 "@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;10413 "@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;10414 "@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;10415 "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;10416 "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;10417 "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;10418 "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;10419 "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;10420 "@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;10421 "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b": BaseAiTextGeneration;10422 "@cf/ibm-granite/granite-4.0-h-micro": BaseAiTextGeneration;10423 "@cf/facebook/bart-large-cnn": BaseAiSummarization;10424 "@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;10425 "@cf/baai/bge-base-en-v1.5": Base_Ai_Cf_Baai_Bge_Base_En_V1_5;10426 "@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;10427 "@cf/meta/m2m100-1.2b": Base_Ai_Cf_Meta_M2M100_1_2B;10428 "@cf/baai/bge-small-en-v1.5": Base_Ai_Cf_Baai_Bge_Small_En_V1_5;10429 "@cf/baai/bge-large-en-v1.5": Base_Ai_Cf_Baai_Bge_Large_En_V1_5;10430 "@cf/unum/uform-gen2-qwen-500m": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M;10431 "@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;10432 "@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;10433 "@cf/baai/bge-m3": Base_Ai_Cf_Baai_Bge_M3;10434 "@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;10435 "@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;10436 "@cf/meta/llama-3.3-70b-instruct-fp8-fast": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast;10437 "@cf/meta/llama-guard-3-8b": Base_Ai_Cf_Meta_Llama_Guard_3_8B;10438 "@cf/baai/bge-reranker-base": Base_Ai_Cf_Baai_Bge_Reranker_Base;10439 "@cf/qwen/qwen2.5-coder-32b-instruct": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct;10440 "@cf/qwen/qwq-32b": Base_Ai_Cf_Qwen_Qwq_32B;10441 "@cf/mistralai/mistral-small-3.1-24b-instruct": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;10442 "@cf/google/gemma-3-12b-it": Base_Ai_Cf_Google_Gemma_3_12B_It;10443 "@cf/meta/llama-4-scout-17b-16e-instruct": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;10444 "@cf/qwen/qwen3-30b-a3b-fp8": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8;10445 "@cf/deepgram/nova-3": Base_Ai_Cf_Deepgram_Nova_3;10446 "@cf/qwen/qwen3-embedding-0.6b": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B;10447 "@cf/pipecat-ai/smart-turn-v2": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;10448 "@cf/openai/gpt-oss-120b": Base_Ai_Cf_Openai_Gpt_Oss_120B;10449 "@cf/openai/gpt-oss-20b": Base_Ai_Cf_Openai_Gpt_Oss_20B;10450 "@cf/leonardo/phoenix-1.0": Base_Ai_Cf_Leonardo_Phoenix_1_0;10451 "@cf/leonardo/lucid-origin": Base_Ai_Cf_Leonardo_Lucid_Origin;10452 "@cf/deepgram/aura-1": Base_Ai_Cf_Deepgram_Aura_1;10453 "@cf/ai4bharat/indictrans2-en-indic-1B": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B;10454 "@cf/aisingapore/gemma-sea-lion-v4-27b-it": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It;10455 "@cf/pfnet/plamo-embedding-1b": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B;10456 "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;10457 "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;10458 "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;10459 "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;10460 "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;10461 "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;10462 "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;10463 "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;10464 "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;10465 "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;10466 "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;10467 "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code;10468 "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2;10469 "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B;10470 "@cf/deepseek-ai/deepseek-v4-flash-0731": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731;10471 "@cf/deepseek-ai/deepseek-v4-pro-0813": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813;10472 "@cf/qwen/qwen3.8-27b": Base_Ai_Cf_Qwen_Qwen3_8_27B;10473 "@cf/zai-org/glm-5.3-flash": Base_Ai_Cf_Zai_Org_Glm_5_3_Flash;10474}10475type AiOptions = {10476 /**10477 * Send requests as an asynchronous batch job, only works for supported models10478 * https://developers.cloudflare.com/workers-ai/features/batch-api10479 */10480 queueRequest?: boolean;10481 /**10482 * Establish websocket connections, only works for supported models10483 */10484 websocket?: boolean;10485 /**10486 * Tag your requests to group and view them in Cloudflare dashboard.10487 *10488 * Rules:10489 * Tags must only contain letters, numbers, and the symbols: : - . / @10490 * Each tag can have maximum 50 characters.10491 * Maximum 5 tags are allowed each request.10492 * Duplicate tags will removed.10493 */10494 tags?: string[];10495 gateway?: GatewayOptions;10496 returnRawResponse?: boolean;10497 prefix?: string;10498 extraHeaders?: object;10499 signal?: AbortSignal;10500};10501type AiModelsSearchParams = {10502 author?: string;10503 hide_experimental?: boolean;10504 page?: number;10505 per_page?: number;10506 search?: string;10507 source?: number;10508 task?: string;10509};10510type AiModelsSearchObject = {10511 id: string;10512 source: number;10513 name: string;10514 description: string;10515 task: {10516 id: string;10517 name: string;10518 description: string;10519 };10520 tags: string[];10521 properties: {10522 property_id: string;10523 value: string;10524 }[];10525};10526type ChatCompletionsBase = ChatCompletionsMessagesInput;10527type ChatCompletionsInput = ChatCompletionsMessagesInput;10528interface InferenceUpstreamError extends Error {10529}10530interface AiInternalError extends Error {10531}10532type AiModelListType = Record<string, any>;10533type AiAsyncBatchResponse = {10534 request_id: string;10535};10536declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {10537 aiGatewayLogId: string | null;10538 gateway(gatewayId: string): AiGateway;10539 /**10540 * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.10541 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10542 */10543 aiSearch(): AiSearchNamespace;10544 /**10545 * @deprecated AutoRAG has been replaced by AI Search.10546 * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.10547 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10548 *10549 * @param autoragId Instance ID10550 */10551 autorag(autoragId: string): AutoRAG;10552 // Batch request10553 run<Name extends keyof AiModelList>(model: Name, inputs: {10554 requests: AiModelList[Name]['inputs'][];10555 }, options: AiOptions & {10556 queueRequest: true;10557 }): Promise<AiAsyncBatchResponse>;10558 // Raw response10559 run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options: AiOptions & {10560 returnRawResponse: true;10561 }): Promise<Response>;10562 // WebSocket10563 run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options: AiOptions & {10564 websocket: true;10565 }): Promise<Response>;10566 // Streaming10567 run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'] & {10568 stream: true;10569 }, options?: AiOptions): Promise<ReadableStream>;10570 // Normal (default) - known model10571 run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options?: AiOptions): Promise<AiModelList[Name]['postProcessedOutputs']>;10572 // Unknown model (fallback).10573 //10574 // The `Exclude<..., keyof AiModelList>` constraint forces TypeScript to10575 // route any model name that is a literal key of `AiModelList` to one of10576 // the known-model overloads above (so input/output mismatches surface as10577 // type errors rather than silently falling back to `Record<string, unknown>`).10578 // Names that aren't in `AiModelList` — e.g. third-party gateway models10579 // like `"google/nano-banana"` — still hit this overload.10580 run<Model extends string>(model: Model extends keyof AiModelList ? never : Model, inputs: Record<string, unknown>, options?: AiOptions): Promise<Record<string, unknown>>;10581 models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;10582 toMarkdown(): ToMarkdownService;10583 toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;10584 toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;10585}10586type GatewayRetries = {10587 maxAttempts?: 1 | 2 | 3 | 4 | 5;10588 retryDelayMs?: number;10589 backoff?: 'constant' | 'linear' | 'exponential';10590};10591type GatewayOptions = {10592 id: string;10593 cacheKey?: string;10594 cacheTtl?: number;10595 skipCache?: boolean;10596 metadata?: Record<string, number | string | boolean | null | bigint>;10597 collectLog?: boolean;10598 eventId?: string;10599 requestTimeoutMs?: number;10600 retries?: GatewayRetries;10601};10602type UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {10603 /**10604 ** @deprecated10605 */10606 id?: string;10607};10608type AiGatewayPatchLog = {10609 score?: number | null;10610 feedback?: -1 | 1 | null;10611 metadata?: Record<string, number | string | boolean | null | bigint> | null;10612};10613type AiGatewayLog = {10614 id: string;10615 provider: string;10616 model: string;10617 model_type?: string;10618 path: string;10619 duration: number;10620 request_type?: string;10621 request_content_type?: string;10622 status_code: number;10623 response_content_type?: string;10624 success: boolean;10625 cached: boolean;10626 tokens_in?: number;10627 tokens_out?: number;10628 metadata?: Record<string, number | string | boolean | null | bigint>;10629 step?: number;10630 cost?: number;10631 custom_cost?: boolean;10632 request_size: number;10633 request_head?: string;10634 request_head_complete: boolean;10635 response_size: number;10636 response_head?: string;10637 response_head_complete: boolean;10638 created_at: Date;10639};10640type AIGatewayProviders = 'workers-ai' | 'anthropic' | 'aws-bedrock' | 'azure-openai' | 'google-vertex-ai' | 'huggingface' | 'openai' | 'perplexity-ai' | 'replicate' | 'groq' | 'cohere' | 'google-ai-studio' | 'mistral' | 'grok' | 'openrouter' | 'deepseek' | 'cerebras' | 'cartesia' | 'elevenlabs' | 'adobe-firefly';10641type AIGatewayHeaders = {10642 'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string;10643 'cf-aig-custom-cost': {10644 per_token_in?: number;10645 per_token_out?: number;10646 } | {10647 total_cost?: number;10648 } | string;10649 'cf-aig-cache-ttl': number | string;10650 'cf-aig-skip-cache': boolean | string;10651 'cf-aig-cache-key': string;10652 'cf-aig-event-id': string;10653 'cf-aig-request-timeout': number | string;10654 'cf-aig-max-attempts': number | string;10655 'cf-aig-retry-delay': number | string;10656 'cf-aig-backoff': string;10657 'cf-aig-collect-log': boolean | string;10658 Authorization: string;10659 'Content-Type': string;10660 [key: string]: string | number | boolean | object;10661};10662type AIGatewayUniversalRequest = {10663 provider: AIGatewayProviders | string; // eslint-disable-line10664 endpoint: string;10665 headers: Partial<AIGatewayHeaders>;10666 query: unknown;10667};10668interface AiGatewayInternalError extends Error {10669}10670interface AiGatewayLogNotFound extends Error {10671}10672declare abstract class AiGateway {10673 patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;10674 getLog(logId: string): Promise<AiGatewayLog>;10675 run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: {10676 gateway?: UniversalGatewayOptions;10677 extraHeaders?: object;10678 signal?: AbortSignal;10679 }): Promise<Response>;10680 getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line10681}10682// Copyright (c) 2022-2025 Cloudflare, Inc.10683// Licensed under the Apache 2.0 license found in the LICENSE file or at:10684// https://opensource.org/licenses/Apache-2.010685/**10686 * Artifacts — Git-compatible file storage on Cloudflare Workers.10687 *10688 * Provides programmatic access to create, manage, and fork repositories,10689 * and to issue and revoke scoped access tokens.10690 */10691/** Information about a repository. */10692interface ArtifactsRepoInfo {10693 /** Unique repository ID. */10694 id: string;10695 /** Repository name. */10696 name: string;10697 /** Repository description, or null if not set. */10698 description: string | null;10699 /** Default branch name (e.g. "main"). */10700 defaultBranch: string;10701 /** ISO 8601 creation timestamp. */10702 createdAt: string;10703 /** ISO 8601 last-updated timestamp. */10704 updatedAt: string;10705 /** ISO 8601 timestamp of the last push, or null if never pushed. */10706 lastPushAt: string | null;10707 /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */10708 source: string | null;10709 /** Whether the repository is read-only. */10710 readOnly: boolean;10711 /** HTTPS git remote URL. */10712 remote: string;10713}10714/** Result of creating a repository — includes the initial access token. */10715interface ArtifactsCreateRepoResult {10716 /** Unique repository ID. */10717 id: string;10718 /** Repository name. */10719 name: string;10720 /** Repository description, or null if not set. */10721 description: string | null;10722 /** Default branch name. */10723 defaultBranch: string;10724 /** HTTPS git remote URL. */10725 remote: string;10726 /** Plaintext access token (only returned at creation time). */10727 token: string;10728 /** ISO 8601 token expiry timestamp. */10729 tokenExpiresAt: string;10730}10731/** Paginated list of repositories. */10732interface ArtifactsRepoListResult {10733 /** Repositories in this page (without the `remote` field). */10734 repos: Omit<ArtifactsRepoInfo, 'remote'>[];10735 /** Total number of repositories in the namespace. */10736 total: number;10737 /** Cursor for the next page, if there are more results. */10738 cursor?: string;10739}10740/** Result of creating an access token. */10741interface ArtifactsCreateTokenResult {10742 /** Unique token ID. */10743 id: string;10744 /** Plaintext token (only returned at creation time). */10745 plaintext: string;10746 /** Token scope: "read" or "write". */10747 scope: 'read' | 'write';10748 /** ISO 8601 token expiry timestamp. */10749 expiresAt: string;10750}10751/** Token metadata (no plaintext). */10752interface ArtifactsTokenInfo {10753 /** Unique token ID. */10754 id: string;10755 /** Token scope: "read" or "write". */10756 scope: 'read' | 'write';10757 /** Token state: "active", "expired", or "revoked". */10758 state: 'active' | 'expired' | 'revoked';10759 /** ISO 8601 creation timestamp. */10760 createdAt: string;10761 /** ISO 8601 expiry timestamp. */10762 expiresAt: string;10763}10764/** Paginated list of tokens for a repository. */10765interface ArtifactsTokenListResult {10766 /** Tokens in this page. */10767 tokens: ArtifactsTokenInfo[];10768 /** Total number of tokens for the repository. */10769 total: number;10770}10771/**10772 * Handle for a single repository. Returned by Artifacts.get().10773 *10774 * Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs.10775 */10776interface ArtifactsRepo extends ArtifactsRepoInfo {10777 /**10778 * Create an access token for this repo.10779 * @param scope Token scope: "write" (default) or "read".10780 * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000).10781 * @throws {ArtifactsError} with code `INVALID_TTL` if ttl is out of range.10782 */10783 createToken(scope?: 'write' | 'read', ttl?: number): Promise<ArtifactsCreateTokenResult>;10784 /** List tokens for this repo (metadata only, no plaintext). */10785 listTokens(): Promise<ArtifactsTokenListResult>;10786 /**10787 * Revoke a token by plaintext or ID.10788 * @param tokenOrId Plaintext token or token ID.10789 * @returns true if revoked, false if not found.10790 * @throws {ArtifactsError} with code `INVALID_INPUT` if tokenOrId is empty.10791 */10792 revokeToken(tokenOrId: string): Promise<boolean>;10793 // ── Fork ──10794 /**10795 * Fork this repo to a new repo.10796 * @param name Target repository name.10797 * @param opts Optional: description, readOnly flag, defaultBranchOnly (default true).10798 * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.10799 * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists.10800 * @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if a fork is already running.10801 */10802 fork(name: string, opts?: {10803 description?: string;10804 readOnly?: boolean;10805 defaultBranchOnly?: boolean;10806 }): Promise<ArtifactsCreateRepoResult>;10807}10808// ── Error types ──────────────────────────────────────────────────────────────10809/**10810 * Error codes returned by Artifacts binding operations.10811 *10812 * Each code maps to a numeric code available on `ArtifactsError.numericCode`.10813 */10814type ArtifactsErrorCode = 'ALREADY_EXISTS' | 'NOT_FOUND' | 'IMPORT_IN_PROGRESS' | 'FORK_IN_PROGRESS' | 'INVALID_INPUT' | 'INVALID_REPO_NAME' | 'INVALID_TTL' | 'INVALID_URL' | 'REMOTE_AUTH_REQUIRED' | 'UPSTREAM_UNAVAILABLE' | 'MEMORY_LIMIT' | 'INTERNAL_ERROR';10815/**10816 * Error thrown by Artifacts binding operations.10817 *10818 * Uses a string `.code` discriminator following the Cloudflare platform10819 * convention (StreamError, ImagesError, etc.). The `.numericCode` matches10820 * the REST API `errors[].code` values.10821 */10822interface ArtifactsError extends Error {10823 readonly name: 'ArtifactsError';10824 /** String error code for programmatic matching. */10825 readonly code: ArtifactsErrorCode;10826 /** Numeric error code matching the REST API. */10827 readonly numericCode: number;10828}10829// ── Binding ──────────────────────────────────────────────────────────────────10830/**10831 * Artifacts binding — namespace-level operations.10832 *10833 * Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs.10834 */10835interface Artifacts {10836 /**10837 * Create a new repository with an initial access token.10838 * @param name Repository name (alphanumeric, dots, hyphens, underscores).10839 * @param opts Optional: readOnly flag, description, default branch name.10840 * @returns Repo metadata with initial token.10841 * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.10842 * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the repo already exists.10843 */10844 create(name: string, opts?: {10845 readOnly?: boolean;10846 description?: string;10847 setDefaultBranch?: string;10848 }): Promise<ArtifactsCreateRepoResult>;10849 /**10850 * Get a handle to an existing repository.10851 * @param name Repository name.10852 * @returns Repo handle.10853 * @throws {ArtifactsError} with code `NOT_FOUND` if the repo does not exist.10854 * @throws {ArtifactsError} with code `IMPORT_IN_PROGRESS` if the repo is still importing.10855 * @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if the repo is still forking.10856 */10857 get(name: string): Promise<ArtifactsRepo>;10858 /**10859 * Import a repository from an external git remote.10860 * @param params Source URL and optional branch/depth, plus target name and options.10861 * @returns Repo metadata with initial token.10862 * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if the target name is invalid.10863 * @throws {ArtifactsError} with code `INVALID_INPUT` if the source URL is not valid HTTPS.10864 * @throws {ArtifactsError} with code `INVALID_URL` if the source URL does not point to a git repository.10865 * @throws {ArtifactsError} with code `REMOTE_AUTH_REQUIRED` if the remote requires authentication.10866 * @throws {ArtifactsError} with code `NOT_FOUND` if the remote repository does not exist.10867 * @throws {ArtifactsError} with code `UPSTREAM_UNAVAILABLE` if the remote cannot be reached.10868 * @throws {ArtifactsError} with code `MEMORY_LIMIT` if the import exceeds service memory limits.10869 * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists.10870 */10871 import(params: {10872 source: {10873 url: string;10874 branch?: string;10875 depth?: number;10876 };10877 target: {10878 name: string;10879 opts?: {10880 description?: string;10881 readOnly?: boolean;10882 };10883 };10884 }): Promise<ArtifactsCreateRepoResult>;10885 /**10886 * List repositories with cursor-based pagination.10887 * @param opts Optional: limit (1–200, default 50), cursor for next page.10888 */10889 list(opts?: {10890 limit?: number;10891 cursor?: string;10892 }): Promise<ArtifactsRepoListResult>;10893 /**10894 * Delete a repository and all associated tokens.10895 * @param name Repository name.10896 * @returns true if deleted, false if not found.10897 * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.10898 */10899 delete(name: string): Promise<boolean>;10900}10901/**10902 * @deprecated Use the standalone AI Search Workers binding instead.10903 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10904 */10905interface AutoRAGInternalError extends Error {10906}10907/**10908 * @deprecated Use the standalone AI Search Workers binding instead.10909 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10910 */10911interface AutoRAGNotFoundError extends Error {10912}10913/**10914 * @deprecated Use the standalone AI Search Workers binding instead.10915 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10916 */10917interface AutoRAGUnauthorizedError extends Error {10918}10919/**10920 * @deprecated Use the standalone AI Search Workers binding instead.10921 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10922 */10923interface AutoRAGNameNotSetError extends Error {10924}10925type ComparisonFilter = {10926 key: string;10927 type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';10928 value: string | number | boolean;10929};10930type CompoundFilter = {10931 type: 'and' | 'or';10932 filters: ComparisonFilter[];10933};10934/**10935 * @deprecated Use the standalone AI Search Workers binding instead.10936 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10937 */10938type AutoRagSearchRequest = {10939 query: string;10940 filters?: CompoundFilter | ComparisonFilter;10941 max_num_results?: number;10942 ranking_options?: {10943 ranker?: string;10944 score_threshold?: number;10945 };10946 reranking?: {10947 enabled?: boolean;10948 model?: string;10949 };10950 rewrite_query?: boolean;10951};10952/**10953 * @deprecated Use the standalone AI Search Workers binding instead.10954 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10955 */10956type AutoRagAiSearchRequest = AutoRagSearchRequest & {10957 stream?: boolean;10958 system_prompt?: string;10959};10960/**10961 * @deprecated Use the standalone AI Search Workers binding instead.10962 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10963 */10964type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {10965 stream: true;10966};10967/**10968 * @deprecated Use the standalone AI Search Workers binding instead.10969 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10970 */10971type AutoRagSearchResponse = {10972 object: 'vector_store.search_results.page';10973 search_query: string;10974 data: {10975 file_id: string;10976 filename: string;10977 score: number;10978 attributes: Record<string, string | number | boolean | null>;10979 content: {10980 type: 'text';10981 text: string;10982 }[];10983 }[];10984 has_more: boolean;10985 next_page: string | null;10986};10987/**10988 * @deprecated Use the standalone AI Search Workers binding instead.10989 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10990 */10991type AutoRagListResponse = {10992 id: string;10993 enable: boolean;10994 type: string;10995 source: string;10996 vectorize_name: string;10997 paused: boolean;10998 status: string;10999}[];11000/**11001 * @deprecated Use the standalone AI Search Workers binding instead.11002 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/11003 */11004type AutoRagAiSearchResponse = AutoRagSearchResponse & {11005 response: string;11006};11007/**11008 * @deprecated Use the standalone AI Search Workers binding instead.11009 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/11010 */11011declare abstract class AutoRAG {11012 /**11013 * @deprecated Use the standalone AI Search Workers binding instead.11014 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/11015 */11016 list(): Promise<AutoRagListResponse>;11017 /**11018 * @deprecated Use the standalone AI Search Workers binding instead.11019 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/11020 */11021 search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;11022 /**11023 * @deprecated Use the standalone AI Search Workers binding instead.11024 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/11025 */11026 aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;11027 /**11028 * @deprecated Use the standalone AI Search Workers binding instead.11029 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/11030 */11031 aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;11032 /**11033 * @deprecated Use the standalone AI Search Workers binding instead.11034 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/11035 */11036 aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;11037}11038type BrowserRunLifecycleEvent = 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';11039type BrowserRunResourceType = 'document' | 'stylesheet' | 'image' | 'media' | 'font' | 'script' | 'texttrack' | 'xhr' | 'fetch' | 'prefetch' | 'eventsource' | 'websocket' | 'manifest' | 'signedexchange' | 'ping' | 'cspviolationreport' | 'preflight' | 'other';11040/** Options fields shared by all quick actions. */11041interface BrowserRunBaseOptions {11042 /** Adds `<script>` tags into the page with the desired URL or content.11043 * @see https://pptr.dev/api/puppeteer.frameaddscripttagoptions11044 */11045 addScriptTag?: Array<{11046 content?: string;11047 url?: string;11048 type?: string;11049 id?: string;11050 }>;11051 /** Adds `<link rel="stylesheet">` or `<style>` tags into the page.11052 * @see https://pptr.dev/api/puppeteer.frameaddstyletagoptions11053 */11054 addStyleTag?: Array<{11055 content?: string;11056 url?: string;11057 }>;11058 /** Provide credentials for HTTP authentication. @see https://pptr.dev/api/puppeteer.credentials */11059 authenticate?: {11060 username: string;11061 password: string;11062 };11063 /** Set cookies before navigating. @see https://pptr.dev/api/puppeteer.cookieparam */11064 cookies?: Array<{11065 name: string;11066 value: string;11067 url?: string;11068 domain?: string;11069 path?: string;11070 secure?: boolean;11071 httpOnly?: boolean;11072 sameSite?: 'Strict' | 'Lax' | 'None';11073 expires?: number;11074 priority?: 'Low' | 'Medium' | 'High';11075 sameParty?: boolean;11076 sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';11077 sourcePort?: number;11078 partitionKey?: string;11079 }>;11080 /** Emulate a specific CSS media type (e.g. `"screen"`, `"print"`). */11081 emulateMediaType?: string;11082 /** Navigation options. @see https://pptr.dev/api/puppeteer.gotooptions */11083 gotoOptions?: {11084 /** Navigation timeout in milliseconds (max 60 000). @default 30000 */11085 timeout?: number;11086 /** When to consider navigation complete. @default "domcontentloaded" */11087 waitUntil?: BrowserRunLifecycleEvent | BrowserRunLifecycleEvent[];11088 referer?: string;11089 referrerPolicy?: string;11090 };11091 /** Block requests matching these regex patterns. Mutually exclusive with `allowRequestPattern`. */11092 rejectRequestPattern?: string[];11093 /** Only allow requests matching these regex patterns. Mutually exclusive with `rejectRequestPattern`. */11094 allowRequestPattern?: string[];11095 /** Block requests of these resource types. Mutually exclusive with `allowResourceTypes`. */11096 rejectResourceTypes?: BrowserRunResourceType[];11097 /** Only allow requests of these resource types. Mutually exclusive with `rejectResourceTypes`. */11098 allowResourceTypes?: BrowserRunResourceType[];11099 /** Additional HTTP headers sent with every request. */11100 setExtraHTTPHeaders?: Record<string, string>;11101 /** Whether JavaScript is enabled on the page. */11102 setJavaScriptEnabled?: boolean;11103 /** Override the default user agent string.11104 * @default "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"11105 * */11106 userAgent?: string;11107 /** Set the browser viewport size.11108 * @see https://pptr.dev/api/puppeteer.viewport11109 * @default {width:1920,height:1080}11110 * */11111 viewport?: {11112 width: number;11113 height: number;11114 deviceScaleFactor?: number;11115 isMobile?: boolean;11116 isLandscape?: boolean;11117 hasTouch?: boolean;11118 };11119 /** Wait for a CSS selector to appear in the page before proceeding.11120 * @see https://pptr.dev/api/puppeteer.waitforselectoroptions11121 */11122 waitForSelector?: {11123 selector: string;11124 hidden?: true;11125 visible?: true;11126 /** Timeout in milliseconds. Max 120000 */11127 timeout?: number;11128 };11129 /** Wait for a fixed delay in milliseconds before proceeding. Max 120000 */11130 waitForTimeout?: number;11131 /** When true, continue on best-effort when awaited events fail or timeout. */11132 bestAttempt?: boolean;11133 /** Maximum duration in milliseconds for the browser action after page load. Max 120000 */11134 actionTimeout?: number;11135 /** Cache time to live in seconds (0-86400). Set to 0 to disable.11136 * @default 511137 */11138 cacheTTL?: number;11139}11140/**11141 * Backend selection, mixed into the options of the quick actions that support it.11142 * Deliberately not part of `BrowserRunBaseOptions`: `scrape`, `links` and `snapshot`11143 * reject an alternate backend, so they must not accept the field.11144 */11145interface BrowserRunAlternateBackendOptions {11146 /** Render with an alternate browser backend instead of the default one. */11147 browser?: 'kitesurf';11148}11149/** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/11150type BrowserRunCommonOptions = (BrowserRunBaseOptions & {11151 /** URL to navigate to, e.g. `"https://example.com"`. */11152 url: string;11153}) | (BrowserRunBaseOptions & {11154 /** Set the HTML content of the page directly. */11155 html: string;11156});11157type BrowserRunPuppeteerScreenshotOptions = {11158 /** @default "png" */11159 type?: 'png' | 'jpeg' | 'webp';11160 /** @default "binary" */11161 encoding?: 'binary' | 'base64';11162 quality?: number;11163 fullPage?: boolean;11164 clip?: {11165 x: number;11166 y: number;11167 width: number;11168 height: number;11169 scale?: number;11170 };11171 omitBackground?: boolean;11172 optimizeForSpeed?: boolean;11173 captureBeyondViewport?: boolean;11174 fromSurface?: boolean;11175};11176type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {11177 /** CSS selector of the element to screenshot. */11178 selector?: string;11179 /** When true, scroll the entire page before taking the screenshot. */11180 scrollPage?: boolean;11181 /** @see https://pptr.dev/api/puppeteer.screenshotoptions */11182 screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;11183} & BrowserRunAlternateBackendOptions;11184type BrowserRunPDFOptions = BrowserRunCommonOptions & {11185 /** @see https://pptr.dev/api/puppeteer.pdfoptions */11186 pdfOptions?: {11187 /** @default 1 */11188 scale?: number;11189 /** @default false */11190 displayHeaderFooter?: boolean;11191 headerTemplate?: string;11192 footerTemplate?: string;11193 /** @default false */11194 printBackground?: boolean;11195 /** @default false */11196 landscape?: boolean;11197 pageRanges?: string;11198 /** @default "letter" */11199 format?: 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6';11200 width?: string | number;11201 height?: string | number;11202 /** @default false */11203 preferCSSPageSize?: boolean;11204 margin?: {11205 top?: string | number;11206 right?: string | number;11207 bottom?: string | number;11208 left?: string | number;11209 };11210 /** @default false */11211 omitBackground?: boolean;11212 /** @default true */11213 tagged?: boolean;11214 /** @default false */11215 outline?: boolean;11216 /** @default 30000 */11217 timeout?: number;11218 };11219} & BrowserRunAlternateBackendOptions;11220type BrowserRunScrapeOptions = BrowserRunCommonOptions & {11221 /** CSS selectors to scrape. At least one element is required. */11222 elements: Array<{11223 selector: string;11224 }>;11225};11226type BrowserRunLinksOptions = BrowserRunCommonOptions & {11227 /** When true, only return links that are visible on the page. @default false */11228 visibleLinksOnly?: boolean;11229 /** When true, exclude links pointing to external domains. @default false */11230 excludeExternalLinks?: boolean;11231};11232type BrowserRunSnapshotFormat = 'content' | 'screenshot' | 'markdown' | 'accessibilityTree';11233type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {11234 /** Which representations of the page to return. At least two distinct formats11235 * are required; request a single format from its dedicated action instead.11236 * @default ["content","screenshot"]11237 */11238 formats?: BrowserRunSnapshotFormat[];11239 /** @see https://pptr.dev/api/puppeteer.screenshotoptions */11240 screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;11241};11242/** Options for the `accessibilityTree` quick action. */11243type BrowserRunAccessibilityTreeOptions = BrowserRunCommonOptions & {11244 /** When true, prune nodes that carry no semantic meaning, such as generic11245 * containers. Defaults to true, or to false when `root` is set so that the11246 * requested subtree is returned as-is.11247 */11248 interestingOnly?: boolean;11249 /** CSS selector limiting the tree to the matching element's subtree.11250 * A selector that matches nothing yields `accessibilityTree: null` with11251 * HTTP 200; a malformed selector is an error.11252 */11253 root?: string;11254} & BrowserRunAlternateBackendOptions;11255interface BrowserRunJsonBaseOptions {11256 /** Custom AI models to try in order. Max 3. Falls back to next on error. */11257 custom_ai?: Array<{11258 /** Model ID in `<provider>/<model_name>` format, e.g. `"workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast"`. */11259 model: string;11260 /** Bearer token. Not needed for workers-ai models. */11261 authorization?: string;11262 }>;11263}11264/**11265 * Options for the `json` quick action.11266 * At least one of `prompt` or `response_format` must be provided.11267 */11268type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({11269 /** Natural-language prompt describing what data to extract. */11270 prompt: string;11271 /** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */11272 response_format?: AiTextGenerationResponseFormat;11273} | {11274 /** Natural-language prompt describing what data to extract. */11275 prompt?: string;11276 /** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */11277 response_format: AiTextGenerationResponseFormat;11278});11279type BrowserRunContentOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;11280type BrowserRunMarkdownOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;11281type BrowserRunRedirectHop = {11282 /** URL that returned the redirect. */11283 url: string;11284 /** HTTP status of the redirect. */11285 status: number;11286 /** Redirect response headers, including `location`. */11287 headers: Record<string, string>;11288};11289type BrowserRunResponseMeta = {11290 /** HTTP status code of the rendered page */11291 status: number;11292 /** Page title */11293 title: string;11294 /** Origin response headers, lowercased. Repeated headers are joined with a newline. Credential and transport-only headers that do not survive rendering are omitted. */11295 headers?: Record<string, string>;11296 /** URL that served the response, after any redirects the browser followed. */11297 finalUrl?: string;11298 /** HTTP redirects followed to reach `finalUrl`, oldest first. Omitted for direct navigation and for client-side redirects such as meta refresh. An empty array means redirects occurred but their intermediate responses could not be read. */11299 redirectChain?: BrowserRunRedirectHop[];11300};11301/**11302 * A node in the page's accessibility tree, as exposed to assistive technology.11303 * `role` is the only field always present; the rest are populated when the11304 * underlying element defines them.11305 * @see https://pptr.dev/api/puppeteer.serializedaxnode11306 */11307interface BrowserRunSerializedAXNode {11308 /** The ARIA role, e.g. `"button"`, `"heading"`, `"RootWebArea"`. */11309 role: string;11310 /** The `aria-autocomplete` value. */11311 autocomplete?: string;11312 /** Checked state of a checkbox, radio, or menu item. */11313 checked?: boolean | 'mixed';11314 /** Accessible description, typically from `aria-describedby` or `title`. */11315 description?: string;11316 disabled?: boolean;11317 expanded?: boolean;11318 /** Whether the element currently holds keyboard focus. */11319 focused?: boolean;11320 /** The kind of popup the element triggers, e.g. `"menu"`, `"dialog"`. */11321 haspopup?: string;11322 /** The `aria-invalid` value. */11323 invalid?: string;11324 /** Keyboard shortcuts bound to the element, from `aria-keyshortcuts`. */11325 keyshortcuts?: string;11326 /** Hierarchical level, e.g. the heading level of an `<h2>`. */11327 level?: number;11328 /** Whether the element is a modal dialog. */11329 modal?: boolean;11330 /** Whether a text input accepts multiple lines. */11331 multiline?: boolean;11332 /** Whether more than one option can be selected. */11333 multiselectable?: boolean;11334 /** Accessible name, e.g. a button's label or an image's alt text. */11335 name?: string;11336 orientation?: string;11337 /** Pressed state of a toggle button. */11338 pressed?: boolean | 'mixed';11339 readonly?: boolean;11340 required?: boolean;11341 /** Author-supplied role description, from `aria-roledescription`. */11342 roledescription?: string;11343 selected?: boolean;11344 /** Current value of an input or range element. */11345 value?: string | number;11346 valuemax?: number;11347 valuemin?: number;11348 /** Human-readable form of `value`, from `aria-valuetext`. */11349 valuetext?: string;11350 /** Child nodes. Absent for leaf nodes. */11351 children?: BrowserRunSerializedAXNode[];11352}11353/** Success response for `content` action. */11354type BrowserRunContentSuccessResponse = {11355 success: true;11356 /** Extracted HTML content */11357 result: string;11358 meta: BrowserRunResponseMeta;11359};11360/** Success response for `links` action. */11361type BrowserRunLinksSuccessResponse = {11362 success: true;11363 /** Extracted links */11364 result: string[];11365 meta: BrowserRunResponseMeta;11366};11367/** Success response for `scrape` action. */11368type BrowserRunScrapeSuccessResponse = {11369 success: true;11370 result: Array<{11371 /** The CSS selector used to find elements. */11372 selector: string;11373 /** Array of elements matching the selector. */11374 results: Array<{11375 /** Outer HTML of the element. */11376 html: string;11377 /** Text content of the element. */11378 text: string;11379 /** Width of the element in pixels. */11380 width: number;11381 /** Height of the element in pixels. */11382 height: number;11383 /** Top position of the element relative to the viewport in pixels. */11384 top: number;11385 /** Left position of the element relative to the viewport in pixels. */11386 left: number;11387 /** Array of HTML attributes on the element. */11388 attributes: Array<{11389 /** Attribute name. */11390 name: string;11391 /** Attribute value. */11392 value: string;11393 }>;11394 }>;11395 }>;11396 meta: BrowserRunResponseMeta;11397};11398/** Success response for `snapshot` action. Each field is present only when the11399 * corresponding entry was requested in `formats`.11400 */11401type BrowserRunSnapshotSuccessResponse = {11402 success: true;11403 result: {11404 /** HTML content of the page. */11405 content?: string;11406 /** Base64-encoded screenshot image. */11407 screenshot?: string;11408 /** Markdown content. Prefixed with YAML frontmatter (e.g. `title`) when the11409 * page provides that metadata.11410 */11411 markdown?: string;11412 /** Root of the page's accessibility tree. */11413 accessibilityTree?: BrowserRunSerializedAXNode;11414 };11415 meta: BrowserRunResponseMeta;11416};11417/** Success response for `accessibilityTree` action. */11418type BrowserRunAccessibilityTreeSuccessResponse = {11419 success: true;11420 result: {11421 /** Root of the accessibility tree, or `null` when `root` matched no element. */11422 accessibilityTree: BrowserRunSerializedAXNode | null;11423 };11424 meta: BrowserRunResponseMeta;11425};11426/** Success response for `json` action. */11427type BrowserRunJsonSuccessResponse = {11428 success: true;11429 /** JSON data extracted from the page using an AI model */11430 result: Record<string, unknown>;11431 meta: BrowserRunResponseMeta;11432};11433/** Success response for `markdown` action. */11434type BrowserRunMarkdownSuccessResponse = {11435 success: true;11436 /** Extracted markdown content */11437 result: string;11438 meta: BrowserRunResponseMeta;11439};11440/** Error response for BrowserRun actions. */11441type BrowserRunErrorResponse = {11442 success: false;11443 errors: {11444 message: string;11445 code?: number;11446 detail?: string;11447 path?: string;11448 }[];11449};11450/** Error response for BrowserRun `json` action. */11451type BrowserRunJsonErrorResponse = BrowserRunErrorResponse & {11452 /** Raw AI response text for debugging */11453 rawAiResponse?: string;11454};11455/**11456 * Browser Run API binding for automating headless browsers.11457 * @see https://developers.cloudflare.com/browser-run/11458 */11459declare abstract class BrowserRun {11460 /**11461 * Send a raw HTTP request to the Browser Run API.11462 * Used by libraries like `@cloudflare/puppeteer` to acquire and connect to a browser instance.11463 * @see https://developers.cloudflare.com/browser-run/11464 */11465 fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;11466 /**11467 * Take a screenshot of a web page.11468 * @param action - Must be `'screenshot'`.11469 * @param options - Screenshot options including viewport, selectors, and image format.11470 * @returns A `Response` containing one of:11471 *11472 * **Success (HTTP 200):**11473 * - Binary image data with `Content-Type: image/png`, `image/jpeg`, or `image/webp` (when `encoding: 'binary'`, the default)11474 * - Data URI string with `Content-Type: text/plain` (when `encoding: 'base64'`)11475 *11476 * **Error:**11477 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11478 *11479 * **Headers:**11480 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11481 */11482 quickAction(action: 'screenshot', options: BrowserRunScreenshotOptions): Promise<Response>;11483 /**11484 * Generate a PDF of a web page.11485 * @param action - Must be `'pdf'`.11486 * @param options - PDF generation options including page size, margins, and headers/footers.11487 * @returns A `Response` containing one of:11488 *11489 * **Success (HTTP 200):**11490 * - Binary PDF data with `Content-Type: application/pdf`11491 *11492 * **Error:**11493 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11494 *11495 * **Headers:**11496 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11497 */11498 quickAction(action: 'pdf', options: BrowserRunPDFOptions): Promise<Response>;11499 /**11500 * Get the HTML content of a web page.11501 * @param action - Must be `'content'`.11502 * @param options - Navigation and page interaction options.11503 * @returns A `Response` containing one of:11504 *11505 * **Success (HTTP 200):**11506 * - `BrowserRunContentSuccessResponse` JSON with `Content-Type: application/json`11507 *11508 * **Error:**11509 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11510 *11511 * **Headers:**11512 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11513 */11514 quickAction(action: 'content', options: BrowserRunContentOptions): Promise<Response>;11515 /**11516 * Scrape elements from a web page by CSS selector.11517 * @param action - Must be `'scrape'`.11518 * @param options - Scrape options with CSS selectors for elements to extract.11519 * @returns A `Response` containing one of:11520 *11521 * **Success (HTTP 200):**11522 * - `BrowserRunScrapeSuccessResponse` JSON with `Content-Type: application/json`11523 *11524 * **Error:**11525 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11526 *11527 * **Headers:**11528 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11529 */11530 quickAction(action: 'scrape', options: BrowserRunScrapeOptions): Promise<Response>;11531 /**11532 * Extract all links from a web page.11533 * @param action - Must be `'links'`.11534 * @param options - Options to filter visible or internal links only.11535 * @returns A `Response` containing one of:11536 *11537 * **Success (HTTP 200):**11538 * - `BrowserRunLinksSuccessResponse` JSON with `Content-Type: application/json`11539 *11540 * **Error:**11541 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11542 *11543 * **Headers:**11544 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11545 */11546 quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;11547 /**11548 * Get several representations of a web page in one request.11549 * @param action - Must be `'snapshot'`.11550 * @param options - Snapshot options including the `formats` to return and11551 * screenshot settings (encoding is always base64).11552 * @returns A `Response` containing one of:11553 *11554 * **Success (HTTP 200):**11555 * - `BrowserRunSnapshotSuccessResponse` JSON with `Content-Type: application/json`11556 *11557 * **Error:**11558 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11559 *11560 * **Headers:**11561 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11562 */11563 quickAction(action: 'snapshot', options: BrowserRunSnapshotOptions): Promise<Response>;11564 /**11565 * Extract structured JSON data from a web page using AI.11566 * @param action - Must be `'json'`.11567 * @param options - JSON extraction options with prompt or response_format schema.11568 * @returns A `Response` containing one of:11569 *11570 * **Success (HTTP 200):**11571 * - `BrowserRunJsonSuccessResponse` JSON with `Content-Type: application/json`11572 *11573 * **Error:**11574 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11575 * - HTTP 422 with code `2012` for HTML-to-markdown conversion failures11576 * - HTTP 422/500 for AI extraction failures (may include `rawAiResponse` field)11577 *11578 * **Headers:**11579 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11580 */11581 quickAction(action: 'json', options: BrowserRunJsonOptions): Promise<Response>;11582 /**11583 * Convert a web page to Markdown.11584 * @param action - Must be `'markdown'`.11585 * @param options - Navigation and page interaction options.11586 * @returns A `Response` containing one of:11587 *11588 * **Success (HTTP 200):**11589 * - `BrowserRunMarkdownSuccessResponse` JSON with `Content-Type: application/json`11590 *11591 * **Error:**11592 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11593 * - HTTP 422 with code `2012` for HTML-to-markdown conversion failures11594 *11595 * **Headers:**11596 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11597 */11598 quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;11599 /**11600 * Get the accessibility tree of a web page.11601 * @param action - Must be `'accessibilityTree'`.11602 * @param options - Options to scope the tree to a subtree and to control11603 * whether semantically uninteresting nodes are pruned.11604 * @returns A `Response` containing one of:11605 *11606 * **Success (HTTP 200):**11607 * - `BrowserRunAccessibilityTreeSuccessResponse` JSON with `Content-Type: application/json`11608 * - `result.accessibilityTree` is `null` when `root` matched no element11609 *11610 * **Error:**11611 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11612 * - HTTP 422 for a malformed `root` selector11613 * - HTTP 500 with code `2017` or `2018` when the tree could not be built11614 *11615 * **Headers:**11616 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11617 */11618 quickAction(action: 'accessibilityTree', options: BrowserRunAccessibilityTreeOptions): Promise<Response>;11619}11620/**11621 * In addition to the properties you can set in the RequestInit dict11622 * that you pass as an argument to the Request constructor, you can11623 * set certain properties of a `cf` object to control how Cloudflare11624 * features are applied to that new Request.11625 *11626 * Note: Currently, these properties cannot be tested in the11627 * playground.11628 */11629interface RequestInitCfProperties extends Record<string, unknown> {11630 cacheEverything?: boolean;11631 /**11632 * A request's cache key is what determines if two requests are11633 * "the same" for caching purposes. If a request has the same cache key11634 * as some previous request, then we can serve the same cached response for11635 * both. (e.g. 'some-key')11636 *11637 * Only available for Enterprise customers.11638 */11639 cacheKey?: string;11640 /**11641 * This allows you to append additional Cache-Tag response headers11642 * to the origin response without modifications to the origin server.11643 * This will allow for greater control over the Purge by Cache Tag feature11644 * utilizing changes only in the Workers process.11645 *11646 * Only available for Enterprise customers.11647 */11648 cacheTags?: string[];11649 /**11650 * Force response to be cached for a given number of seconds. (e.g. 300)11651 */11652 cacheTtl?: number;11653 /**11654 * Force response to be cached for a given number of seconds based on the Origin status code.11655 * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })11656 */11657 cacheTtlByStatus?: Record<string, number>;11658 /** Controls how responses with a `Vary` header are cached for this request. */11659 vary?: RequestInitCfPropertiesVary;11660 /**11661 * Explicit Cache-Control header value to set on the response stored in cache.11662 * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').11663 *11664 * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),11665 * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.11666 *11667 * Can be used together with `cacheTtlByStatus`.11668 */11669 cacheControl?: string;11670 /**11671 * Whether the response should be eligible for Cache Reserve storage.11672 */11673 cacheReserveEligible?: boolean;11674 /**11675 * Whether to respect strong ETags (as opposed to weak ETags) from the origin.11676 */11677 respectStrongEtag?: boolean;11678 /**11679 * Whether to strip ETag headers from the origin response before caching.11680 */11681 stripEtags?: boolean;11682 /**11683 * Whether to strip Last-Modified headers from the origin response before caching.11684 */11685 stripLastModified?: boolean;11686 /**11687 * Whether to enable Cache Deception Armor, which protects against web cache11688 * deception attacks by verifying the Content-Type matches the URL extension.11689 */11690 cacheDeceptionArmor?: boolean;11691 /**11692 * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.11693 */11694 cacheReserveMinimumFileSize?: number;11695 scrapeShield?: boolean;11696 apps?: boolean;11697 /**11698 * Controls whether an outbound gRPC-web subrequest from this Worker is11699 * converted to gRPC at the Cloudflare edge.11700 *11701 * - `"passthrough"`: forward the subrequest unchanged as gRPC-web (default).11702 * - `"convert"`: convert the gRPC-web subrequest to gRPC at the edge.11703 *11704 * Provides per-request control over the same edge conversion behavior11705 * gated by the `auto_grpc_convert` compatibility flag.11706 */11707 grpcWeb?: "passthrough" | "convert";11708 image?: RequestInitCfPropertiesImage;11709 minify?: RequestInitCfPropertiesImageMinify;11710 mirage?: boolean;11711 polish?: "lossy" | "lossless" | "off";11712 r2?: RequestInitCfPropertiesR2;11713 /**11714 * Redirects the request to an alternate origin server. You can use this,11715 * for example, to implement load balancing across several origins.11716 * (e.g.us-east.example.com)11717 *11718 * Note - For security reasons, the hostname set in resolveOverride must11719 * be proxied on the same Cloudflare zone of the incoming request.11720 * Otherwise, the setting is ignored. CNAME hosts are allowed, so to11721 * resolve to a host under a different domain or a DNS only domain first11722 * declare a CNAME record within your own zone’s DNS mapping to the11723 * external hostname, set proxy on Cloudflare, then set resolveOverride11724 * to point to that CNAME record.11725 */11726 resolveOverride?: string;11727}11728/**11729 * Controls how Workers Standard Vary handles a request header listed by an11730 * origin `Vary` response header:11731 *11732 * - `"normalize"`: normalize the request header value before it is used in the11733 * cache variance key.11734 * - `"passthrough"`: use the raw request header value in the cache variance11735 * key.11736 * - `"bypass"`: bypass cache when the header appears in the origin `Vary`11737 * response header.11738 */11739type RequestInitCfPropertiesVaryAction = "normalize" | "passthrough" | "bypass";11740/** Configuration for Workers Standard Vary support. */11741interface RequestInitCfPropertiesVary {11742 /** The fallback action for varied request headers not listed in `headers`. */11743 default: RequestInitCfPropertiesVaryHeader;11744 /**11745 * Lowercase request header names and their Vary configuration.11746 *11747 * The `accept` header can include `media_types`, the `accept-language`11748 * header can include `languages`, and other headers support only `action`.11749 */11750 headers?: RequestInitCfPropertiesVaryHeaders;11751}11752/** Common Vary behavior for a single request header. */11753interface RequestInitCfPropertiesVaryHeader {11754 /** How this request header contributes to cache variance. */11755 action: RequestInitCfPropertiesVaryAction;11756}11757/** Vary behavior for the `accept` request header. */11758interface RequestInitCfPropertiesVaryAcceptHeader extends RequestInitCfPropertiesVaryHeader {11759 /**11760 * Media types to keep when normalizing the `Accept` request header.11761 *11762 * Named `media_types` to match the serialized `cf.vary` configuration.11763 */11764 media_types?: string[];11765}11766/** Vary behavior for the `accept-language` request header. */11767interface RequestInitCfPropertiesVaryAcceptLanguageHeader extends RequestInitCfPropertiesVaryHeader {11768 /**11769 * Language tags to keep when normalizing the `Accept-Language` request11770 * header.11771 */11772 languages?: string[];11773}11774/**11775 * Lowercase request header names and their Vary behavior.11776 *11777 * The index signature allows arbitrary custom request headers beyond the11778 * well-known `accept` and `accept-language` specializations.11779 */11780interface RequestInitCfPropertiesVaryHeaders {11781 accept?: RequestInitCfPropertiesVaryAcceptHeader;11782 "accept-language"?: RequestInitCfPropertiesVaryAcceptLanguageHeader;11783 [header: string]: RequestInitCfPropertiesVaryHeader | RequestInitCfPropertiesVaryAcceptHeader | RequestInitCfPropertiesVaryAcceptLanguageHeader | undefined;11784}11785interface BasicImageTransformations {11786 /**11787 * Maximum width in image pixels. The value must be an integer.11788 */11789 width?: number;11790 /**11791 * Maximum height in image pixels. The value must be an integer.11792 */11793 height?: number;11794 /**11795 * When cropping with fit: "cover", this defines the side or point that should11796 * be left uncropped. The value is either a string11797 * "left", "right", "top", "bottom", "auto", or "center" (the default),11798 * or an object {x, y} containing focal point coordinates in the original11799 * image expressed as fractions ranging from 0.0 (top or left) to 1.011800 * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will11801 * crop bottom or left and right sides as necessary, but won’t crop anything11802 * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to11803 * preserve as much as possible around a point at 20% of the height of the11804 * source image.11805 */11806 gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates;11807 /**11808 * Specifies how closely the image is cropped toward detected faces when combined11809 * with the gravity=face option. Accepts a valid range between 0.0 (includes as much11810 * of the background as possible) and 1.0 (crops the image as closely to the face as11811 * possible). The default is 0.11812 */11813 zoom?: number;11814 /**11815 * Resizing mode as a string. It affects interpretation of width and height11816 * options:11817 * - scale-down: Similar to contain, but the image is never enlarged. If11818 * the image is larger than given width or height, it will be resized.11819 * Otherwise its original size will be kept.11820 * - scale-up: Similar to contain, but the image is never shrunk. If the11821 * image is smaller than the given width or height, it will be resized.11822 * Otherwise its original size will be kept.11823 * - contain: Resizes to maximum size that fits within the given width and11824 * height. If only a single dimension is given (e.g. only width), the11825 * image will be shrunk or enlarged to exactly match that dimension.11826 * Aspect ratio is always preserved.11827 * - cover: Resizes (shrinks or enlarges) to fill the entire area of width11828 * and height. If the image has an aspect ratio different from the ratio11829 * of width and height, it will be cropped to fit.11830 * - crop: The image will be shrunk and cropped to fit within the area11831 * specified by width and height. The image will not be enlarged. For images11832 * smaller than the given dimensions it's the same as scale-down. For11833 * images larger than the given dimensions, it's the same as cover.11834 * See also trim.11835 * - pad: Resizes to the maximum size that fits within the given width and11836 * height, and then fills the remaining area with a background color11837 * (white by default). Use of this mode is not recommended, as the same11838 * effect can be more efficiently achieved with the contain mode and the11839 * CSS object-fit: contain property.11840 * - squeeze: Stretches and deforms to the width and height given, even if it11841 * breaks aspect ratio11842 */11843 fit?: "scale-down" | "scale-up" | "contain" | "cover" | "crop" | "pad" | "squeeze";11844 /**11845 * Allows you to trim your image. Takes dpr into account and is performed before11846 * resizing or rotation.11847 *11848 * It can be used as:11849 * - left, top, right, bottom - it will specify the number of pixels to cut11850 * off each side11851 * - width, height - the width/height you'd like to end up with - can be used11852 * in combination with the properties above11853 * - border - this will automatically trim the surroundings of an image based on11854 * it's color. It consists of three properties:11855 * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)11856 * - tolerance: difference from color to treat as color11857 * - keep: the number of pixels of border to keep11858 */11859 trim?: "border" | {11860 top?: number;11861 bottom?: number;11862 left?: number;11863 right?: number;11864 width?: number;11865 height?: number;11866 border?: boolean | {11867 color?: string;11868 tolerance?: number;11869 keep?: number;11870 };11871 };11872 /**11873 * Background color to add underneath the image. Applies only to images with11874 * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),11875 * hsl(…), etc.)11876 */11877 background?: string;11878 /**11879 * Flips the images horizontally, vertically, or both. Flipping is applied before11880 * rotation, so if you apply flip=h,rotate=90 then the image will be flipped11881 * horizontally, then rotated by 90 degrees.11882 */11883 flip?: 'h' | 'v' | 'hv';11884 /**11885 * Number of degrees (90, 180, 270) to rotate the image by. width and height11886 * options refer to axes after rotation.11887 */11888 rotate?: 0 | 90 | 180 | 270 | 360;11889 /**11890 * Strength of sharpening filter to apply to the image. Floating-point11891 * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a11892 * recommended value for downscaled images.11893 */11894 sharpen?: number;11895 /**11896 * Radius of a blur filter (approximate gaussian). Maximum supported radius11897 * is 250.11898 */11899 blur?: number;11900 /**11901 * Increase contrast by a factor. A value of 1.0 equals no change, a value of11902 * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is11903 * ignored.11904 */11905 contrast?: number;11906 /**11907 * Increase brightness by a factor. A value of 1.0 equals no change, a value11908 * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.11909 * 0 is ignored.11910 */11911 brightness?: number;11912 /**11913 * Increase exposure by a factor. A value of 1.0 equals no change, a value of11914 * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.11915 */11916 gamma?: number;11917 /**11918 * Increase contrast by a factor. A value of 1.0 equals no change, a value of11919 * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is11920 * ignored.11921 */11922 saturation?: number;11923 /**11924 * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it11925 * easier to specify higher-DPI sizes in <img srcset>.11926 */11927 dpr?: number;11928 /**11929 * Adds a border around the image. The border is added after resizing. Border11930 * width takes dpr into account, and can be specified either using a single11931 * width property, or individually for each side.11932 */11933 border?: {11934 color: string;11935 width: number;11936 } | {11937 color: string;11938 top: number;11939 right: number;11940 bottom: number;11941 left: number;11942 };11943 /**11944 * Image segmentation using artificial intelligence models. Sets pixels not11945 * within selected segment area to transparent e.g "foreground" sets every11946 * background pixel as transparent.11947 */11948 segment?: "foreground";11949 /**11950 * Controls the algorithm used when an image needs to be enlarged. This11951 * parameter works with any fit mode that upscales, such as `contain`,11952 * `cover`, and `scale-up`. It has no effect when `fit=scale-down` or when11953 * the target dimensions are smaller than the source.11954 * - interpolate: Uses bicubic interpolation, which may reduce image quality.11955 * This is the default behavior when `upscale` is not specified.11956 * - generate: Uses AI upscaling to produce sharper, more detailed results11957 * when enlarging images.11958 */11959 upscale?: "interpolate" | "generate";11960}11961interface BasicImageTransformationsGravityCoordinates {11962 x?: number;11963 y?: number;11964 mode?: 'remainder' | 'box-center';11965}11966interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {11967 /**11968 * Absolute URL of the image file to use for the drawing. It can be any of11969 * the supported file formats. For drawing of watermarks or non-rectangular11970 * overlays we recommend using PNG or WebP images.11971 */11972 url: string;11973 /**11974 * Floating-point number between 0 (transparent) and 1 (opaque).11975 * For example, opacity: 0.5 makes overlay semitransparent.11976 */11977 opacity?: number;11978 /**11979 * - If set to true, the overlay image will be tiled to cover the entire11980 * area. This is useful for stock-photo-like watermarks.11981 * - If set to "x", the overlay image will be tiled horizontally only11982 * (form a line).11983 * - If set to "y", the overlay image will be tiled vertically only11984 * (form a line).11985 */11986 repeat?: true | "x" | "y";11987 /**11988 * How to combine the foreground and backdrop pixels to create the result11989 */11990 composite?: 11991 /** Foreground drawn on top of backdrop (default) */11992 'over'11993 /** Foreground shown only where backdrop is opaque */11994 | 'in'11995 /** Foreground drawn on top, but clipped to the backdrop's shape */11996 | 'atop'11997 /** Foreground shown only where backdrop is transparent */11998 | 'out'11999 /** Foreground and backdrop visible only where the other is not */12000 | 'xor'12001 /** Foreground and backdrop channels added (brightening) */12002 | 'lighter';12003 /**12004 * Position of the overlay image relative to a given edge. Each property is12005 * an offset in pixels. 0 aligns exactly to the edge. For example, left: 1012006 * positions left side of the overlay 10 pixels from the left edge of the12007 * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom12008 * of the background image.12009 *12010 * Setting both left & right, or both top & bottom is an error.12011 *12012 * If no position is specified, the image will be centered.12013 */12014 top?: number;12015 left?: number;12016 bottom?: number;12017 right?: number;12018}12019interface RequestInitCfPropertiesImage extends BasicImageTransformations {12020 /**12021 * Quality setting from 1-100 (useful values are in 60-90 range). Lower values12022 * make images look worse, but load faster. The default is 85. It applies only12023 * to JPEG and WebP images. It doesn’t have any effect on PNG.12024 */12025 quality?: number | "low" | "medium-low" | "medium-high" | "high";12026 /**12027 * Output format to generate. It can be:12028 * - avif: generate images in AVIF format.12029 * - webp: generate images in Google WebP format. Set quality to 100 to get12030 * the WebP-lossless format.12031 * - json: instead of generating an image, outputs information about the12032 * image, in JSON format. The JSON object will contain image size12033 * (before and after resizing), source image’s MIME type, file size, etc.12034 * - jpeg: generate images in JPEG format.12035 * - png: generate images in PNG format.12036 */12037 format?: "avif" | "webp" | "json" | "jpeg" | "png" | "baseline-jpeg" | "png-force" | "svg";12038 /**12039 * Whether to preserve animation frames from input files. Default is true.12040 * Setting it to false reduces animations to still images. This setting is12041 * recommended when enlarging images or processing arbitrary user content,12042 * because large GIF animations can weigh tens or even hundreds of megabytes.12043 * It is also useful to set anim:false when using format:"json" to get the12044 * response quicker without the number of frames.12045 */12046 anim?: boolean;12047 /**12048 * What EXIF data should be preserved in the output image. Note that EXIF12049 * rotation and embedded color profiles are always applied ("baked in" into12050 * the image), and aren't affected by this option. Note that if the Polish12051 * feature is enabled, all metadata may have been removed already and this12052 * option may have no effect.12053 * - keep: Preserve most of EXIF metadata, including GPS location if there's12054 * any.12055 * - copyright: Only keep the copyright tag, and discard everything else.12056 * This is the default behavior for JPEG files.12057 * - none: Discard all invisible EXIF metadata. Currently WebP and PNG12058 * output formats always discard metadata.12059 */12060 metadata?: "keep" | "copyright" | "none";12061 /**12062 * Overlays are drawn in the order they appear in the array (last array12063 * entry is the topmost layer).12064 */12065 draw?: RequestInitCfPropertiesImageDraw[];12066 /**12067 * Fetching image from authenticated origin. Setting this property will12068 * pass authentication headers (Authorization, Cookie, etc.) through to12069 * the origin.12070 */12071 "origin-auth"?: "share-publicly";12072 /**12073 * Slightly reduces latency on a cache miss by selecting a12074 * quickest-to-compress file format, at a cost of increased file size and12075 * lower image quality. It will usually override the format option and choose12076 * JPEG over WebP or AVIF. We do not recommend using this option, except in12077 * unusual circumstances like resizing uncacheable dynamically-generated12078 * images.12079 */12080 compression?: "fast";12081}12082interface RequestInitCfPropertiesImageMinify {12083 javascript?: boolean;12084 css?: boolean;12085 html?: boolean;12086}12087interface RequestInitCfPropertiesR2 {12088 /**12089 * Colo id of bucket that an object is stored in12090 */12091 bucketColoId?: number;12092}12093/**12094 * Request metadata provided by Cloudflare's edge.12095 */12096type IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield;12097interface IncomingRequestCfPropertiesBase extends Record<string, unknown> {12098 /**12099 * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.12100 *12101 * @example 39574712102 */12103 asn?: number;12104 /**12105 * The organization which owns the ASN of the incoming request.12106 *12107 * @example "Google Cloud"12108 */12109 asOrganization?: string;12110 /**12111 * The original value of the `Accept-Encoding` header if Cloudflare modified it.12112 *12113 * @example "gzip, deflate, br"12114 */12115 clientAcceptEncoding?: string;12116 /**12117 * The number of milliseconds it took for the request to reach your worker.12118 *12119 * @example 2212120 */12121 clientTcpRtt?: number;12122 /**12123 * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)12124 * airport code of the data center that the request hit.12125 *12126 * @example "DFW"12127 */12128 colo: string;12129 /**12130 * Represents the upstream's response to a12131 * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)12132 * from cloudflare.12133 *12134 * For workers with no upstream, this will always be `1`.12135 *12136 * @example 312137 */12138 edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;12139 /**12140 * The HTTP Protocol the request used.12141 *12142 * @example "HTTP/2"12143 */12144 httpProtocol: string;12145 /**12146 * The browser-requested prioritization information in the request object.12147 *12148 * If no information was set, defaults to the empty string `""`12149 *12150 * @example "weight=192;exclusive=0;group=3;group-weight=127"12151 * @default ""12152 */12153 requestPriority: string;12154 /**12155 * The TLS version of the connection to Cloudflare.12156 * In requests served over plaintext (without TLS), this property is the empty string `""`.12157 *12158 * @example "TLSv1.3"12159 */12160 tlsVersion: string;12161 /**12162 * The cipher for the connection to Cloudflare.12163 * In requests served over plaintext (without TLS), this property is the empty string `""`.12164 *12165 * @example "AEAD-AES128-GCM-SHA256"12166 */12167 tlsCipher: string;12168 /**12169 * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake.12170 *12171 * If the incoming request was served over plaintext (without TLS) this field is undefined.12172 */12173 tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;12174}12175interface IncomingRequestCfPropertiesBotManagementBase {12176 /**12177 * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,12178 * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).12179 *12180 * @example 5412181 */12182 score: number;12183 /**12184 * A boolean value that is true if the request comes from a good bot, like Google or Bing.12185 * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots).12186 */12187 verifiedBot: boolean;12188 /**12189 * A boolean value that is true if the request originates from a12190 * Cloudflare-verified proxy service.12191 */12192 corporateProxy: boolean;12193 /**12194 * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.12195 */12196 staticResource: boolean;12197 /**12198 * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).12199 */12200 detectionIds: number[];12201}12202interface IncomingRequestCfPropertiesBotManagement {12203 /**12204 * Results of Cloudflare's Bot Management analysis12205 */12206 botManagement: IncomingRequestCfPropertiesBotManagementBase;12207 /**12208 * Duplicate of `botManagement.score`.12209 *12210 * @deprecated12211 */12212 clientTrustScore: number;12213}12214interface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement {12215 /**12216 * Results of Cloudflare's Bot Management analysis12217 */12218 botManagement: IncomingRequestCfPropertiesBotManagementBase & {12219 /**12220 * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients12221 * across different destination IPs, Ports, and X509 certificates.12222 */12223 ja3Hash: string;12224 };12225}12226interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {12227 /**12228 * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).12229 *12230 * This field is only present if you have Cloudflare for SaaS enabled on your account12231 * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).12232 */12233 hostMetadata?: HostMetadata;12234}12235interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {12236 /**12237 * Information about the client certificate presented to Cloudflare.12238 *12239 * This is populated when the incoming request is served over TLS using12240 * either Cloudflare Access or API Shield (mTLS)12241 * and the presented SSL certificate has a valid12242 * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)12243 * (i.e., not `null` or `""`).12244 *12245 * Otherwise, a set of placeholder values are used.12246 *12247 * The property `certPresented` will be set to `"1"` when12248 * the object is populated (i.e. the above conditions were met).12249 */12250 tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;12251}12252/**12253 * Metadata about the request's TLS handshake12254 */12255interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {12256 /**12257 * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal12258 *12259 * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"12260 */12261 clientHandshake: string;12262 /**12263 * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal12264 *12265 * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"12266 */12267 serverHandshake: string;12268 /**12269 * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal12270 *12271 * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"12272 */12273 clientFinished: string;12274 /**12275 * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal12276 *12277 * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"12278 */12279 serverFinished: string;12280}12281/**12282 * Geographic data about the request's origin.12283 */12284interface IncomingRequestCfPropertiesGeographicInformation {12285 /**12286 * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.12287 *12288 * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR.12289 *12290 * If Cloudflare is unable to determine where the request originated this property is omitted.12291 *12292 * The country code `"T1"` is used for requests originating on TOR.12293 *12294 * @example "GB"12295 */12296 country?: Iso3166Alpha2Code | "T1";12297 /**12298 * If present, this property indicates that the request originated in the EU12299 *12300 * @example "1"12301 */12302 isEUCountry?: "1";12303 /**12304 * A two-letter code indicating the continent the request originated from.12305 *12306 * @example "AN"12307 */12308 continent?: ContinentCode;12309 /**12310 * The city the request originated from12311 *12312 * @example "Austin"12313 */12314 city?: string;12315 /**12316 * Postal code of the incoming request12317 *12318 * @example "78701"12319 */12320 postalCode?: string;12321 /**12322 * Latitude of the incoming request12323 *12324 * @example "30.27130"12325 */12326 latitude?: string;12327 /**12328 * Longitude of the incoming request12329 *12330 * @example "-97.74260"12331 */12332 longitude?: string;12333 /**12334 * Timezone of the incoming request12335 *12336 * @example "America/Chicago"12337 */12338 timezone?: string;12339 /**12340 * If known, the ISO 3166-2 name for the first level region associated with12341 * the IP address of the incoming request12342 *12343 * @example "Texas"12344 */12345 region?: string;12346 /**12347 * If known, the ISO 3166-2 code for the first-level region associated with12348 * the IP address of the incoming request12349 *12350 * @example "TX"12351 */12352 regionCode?: string;12353 /**12354 * Metro code (DMA) of the incoming request12355 *12356 * @example "635"12357 */12358 metroCode?: string;12359}12360/** Data about the incoming request's TLS certificate */12361interface IncomingRequestCfPropertiesTLSClientAuth {12362 /** Always `"1"`, indicating that the certificate was presented */12363 certPresented: "1";12364 /**12365 * Result of certificate verification.12366 *12367 * @example "FAILED:self signed certificate"12368 */12369 certVerified: Exclude<CertVerificationStatus, "NONE">;12370 /** The presented certificate's revokation status.12371 *12372 * - A value of `"1"` indicates the certificate has been revoked12373 * - A value of `"0"` indicates the certificate has not been revoked12374 */12375 certRevoked: "1" | "0";12376 /**12377 * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)12378 *12379 * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"12380 */12381 certIssuerDN: string;12382 /**12383 * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)12384 *12385 * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"12386 */12387 certSubjectDN: string;12388 /**12389 * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)12390 *12391 * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"12392 */12393 certIssuerDNRFC2253: string;12394 /**12395 * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)12396 *12397 * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"12398 */12399 certSubjectDNRFC2253: string;12400 /** The certificate issuer's distinguished name (legacy policies) */12401 certIssuerDNLegacy: string;12402 /** The certificate subject's distinguished name (legacy policies) */12403 certSubjectDNLegacy: string;12404 /**12405 * The certificate's serial number12406 *12407 * @example "00936EACBE07F201DF"12408 */12409 certSerial: string;12410 /**12411 * The certificate issuer's serial number12412 *12413 * @example "2489002934BDFEA34"12414 */12415 certIssuerSerial: string;12416 /**12417 * The certificate's Subject Key Identifier12418 *12419 * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"12420 */12421 certSKI: string;12422 /**12423 * The certificate issuer's Subject Key Identifier12424 *12425 * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"12426 */12427 certIssuerSKI: string;12428 /**12429 * The certificate's SHA-1 fingerprint12430 *12431 * @example "6b9109f323999e52259cda7373ff0b4d26bd232e"12432 */12433 certFingerprintSHA1: string;12434 /**12435 * The certificate's SHA-256 fingerprint12436 *12437 * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea"12438 */12439 certFingerprintSHA256: string;12440 /**12441 * The effective starting date of the certificate12442 *12443 * @example "Dec 22 19:39:00 2018 GMT"12444 */12445 certNotBefore: string;12446 /**12447 * The effective expiration date of the certificate12448 *12449 * @example "Dec 22 19:39:00 2018 GMT"12450 */12451 certNotAfter: string;12452 /**12453 * The client leaf certificate in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)12454 * format (`:base64-DER:`). Empty if no client certificate was presented or if12455 * the leaf certificate exceeded 10 KB (see {@link certRFC9440TooLarge}).12456 *12457 * Suitable for forwarding to an origin via the `Client-Cert` HTTP header.12458 */12459 certRFC9440: string;12460 /**12461 * `true` if the leaf certificate exceeded 10 KB and was omitted from12462 * {@link certRFC9440}.12463 */12464 certRFC9440TooLarge: boolean;12465 /**12466 * The intermediate certificate chain in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)12467 * format as a comma-separated list. Empty if no intermediates were sent or12468 * if the chain exceeded 16 KB (see {@link certChainRFC9440TooLarge}).12469 *12470 * Suitable for forwarding to an origin via the `Client-Cert-Chain` HTTP header.12471 */12472 certChainRFC9440: string;12473 /**12474 * `true` if the intermediate chain exceeded 16 KB and was omitted from12475 * {@link certChainRFC9440}.12476 */12477 certChainRFC9440TooLarge: boolean;12478}12479/** Placeholder values for TLS Client Authorization */12480interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {12481 certPresented: "0";12482 certVerified: "NONE";12483 certRevoked: "0";12484 certIssuerDN: "";12485 certSubjectDN: "";12486 certIssuerDNRFC2253: "";12487 certSubjectDNRFC2253: "";12488 certIssuerDNLegacy: "";12489 certSubjectDNLegacy: "";12490 certSerial: "";12491 certIssuerSerial: "";12492 certSKI: "";12493 certIssuerSKI: "";12494 certFingerprintSHA1: "";12495 certFingerprintSHA256: "";12496 certNotBefore: "";12497 certNotAfter: "";12498 certRFC9440: "";12499 certRFC9440TooLarge: false;12500 certChainRFC9440: "";12501 certChainRFC9440TooLarge: false;12502}12503/** Possible outcomes of TLS verification */12504declare type CertVerificationStatus = 12505/** Authentication succeeded */12506"SUCCESS"12507/** No certificate was presented */12508 | "NONE"12509/** Failed because the certificate was self-signed */12510 | "FAILED:self signed certificate"12511/** Failed because the certificate failed a trust chain check */12512 | "FAILED:unable to verify the first certificate"12513/** Failed because the certificate not yet valid */12514 | "FAILED:certificate is not yet valid"12515/** Failed because the certificate is expired */12516 | "FAILED:certificate has expired"12517/** Failed for another unspecified reason */12518 | "FAILED";12519/**12520 * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.12521 */12522declare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = 0 /** Unknown */ | 1 /** no keepalives (not found) */ | 2 /** no connection re-use, opening keepalive connection failed */ | 3 /** no connection re-use, keepalive accepted and saved */ | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ | 5; /** connection re-use, accepted by the origin server */12523/** ISO 3166-1 Alpha-2 codes */12524declare type Iso3166Alpha2Code = "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "YE" | "YT" | "ZA" | "ZM" | "ZW";12525/** The 2-letter continent codes Cloudflare uses */12526declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";12527type CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties;12528interface D1Meta {12529 duration: number;12530 size_after: number;12531 rows_read: number;12532 rows_written: number;12533 last_row_id: number;12534 changed_db: boolean;12535 changes: number;12536 /**12537 * The region of the database instance that executed the query.12538 */12539 served_by_region?: string;12540 /**12541 * The three letters airport code of the colo that executed the query.12542 */12543 served_by_colo?: string;12544 /**12545 * True if-and-only-if the database instance that executed the query was the primary.12546 */12547 served_by_primary?: boolean;12548 timings?: {12549 /**12550 * The duration of the SQL query execution by the database instance. It doesn't include any network time.12551 */12552 sql_duration_ms: number;12553 };12554 /**12555 * Number of total attempts to execute the query, due to automatic retries.12556 * Note: All other fields in the response like `timings` only apply to the last attempt.12557 */12558 total_attempts?: number;12559}12560interface D1Response {12561 success: true;12562 meta: D1Meta & Record<string, unknown>;12563 error?: never;12564}12565type D1Result<T = unknown> = D1Response & {12566 results: T[];12567};12568interface D1ExecResult {12569 count: number;12570 duration: number;12571}12572type D1SessionConstraint = 12573// Indicates that the first query should go to the primary, and the rest queries12574// using the same D1DatabaseSession will go to any replica that is consistent with12575// the bookmark maintained by the session (returned by the first query).12576'first-primary'12577// Indicates that the first query can go anywhere (primary or replica), and the rest queries12578// using the same D1DatabaseSession will go to any replica that is consistent with12579// the bookmark maintained by the session (returned by the first query).12580 | 'first-unconstrained';12581type D1SessionBookmark = string;12582declare abstract class D1Database {12583 prepare(query: string): D1PreparedStatement;12584 batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;12585 exec(query: string): Promise<D1ExecResult>;12586 /**12587 * Creates a new D1 Session anchored at the given constraint or the bookmark.12588 * All queries executed using the created session will have sequential consistency,12589 * meaning that all writes done through the session will be visible in subsequent reads.12590 *12591 * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.12592 */12593 withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession;12594 /**12595 * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.12596 */12597 dump(): Promise<ArrayBuffer>;12598}12599declare abstract class D1DatabaseSession {12600 prepare(query: string): D1PreparedStatement;12601 batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;12602 /**12603 * @returns The latest session bookmark across all executed queries on the session.12604 * If no query has been executed yet, `null` is returned.12605 */12606 getBookmark(): D1SessionBookmark | null;12607}12608declare abstract class D1PreparedStatement {12609 bind(...values: unknown[]): D1PreparedStatement;12610 first<T = unknown>(colName: string): Promise<T | null>;12611 first<T = Record<string, unknown>>(): Promise<T | null>;12612 run<T = Record<string, unknown>>(): Promise<D1Result<T>>;12613 all<T = Record<string, unknown>>(): Promise<D1Result<T>>;12614 raw<T = unknown[]>(options: {12615 columnNames: true;12616 }): Promise<[12617 string[],12618 ...T[]12619 ]>;12620 raw<T = unknown[]>(options?: {12621 columnNames?: false;12622 }): Promise<T[]>;12623}12624// `Disposable` was added to TypeScript's standard lib types in version 5.2.12625// To support older TypeScript versions, define an empty `Disposable` interface.12626// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,12627// but this will ensure type checking on older versions still passes.12628// TypeScript's interface merging will ensure our empty interface is effectively12629// ignored when `Disposable` is included in the standard lib.12630interface Disposable {12631}12632/**12633 * The returned data after sending an email12634 */12635interface EmailSendResult {12636 /**12637 * The Email Message ID12638 */12639 messageId: string;12640}12641/**12642 * An email message that can be sent from a Worker.12643 */12644interface EmailMessage {12645 /**12646 * Envelope From attribute of the email message.12647 */12648 readonly from: string;12649 /**12650 * Envelope To attribute of the email message.12651 */12652 readonly to: string;12653}12654/**12655 * An email message that is sent to a consumer Worker and can be rejected/forwarded.12656 */12657interface ForwardableEmailMessage extends EmailMessage {12658 /**12659 * Stream of the email message content.12660 */12661 readonly raw: ReadableStream<Uint8Array>;12662 /**12663 * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).12664 */12665 readonly headers: Headers;12666 /**12667 * Size of the email message content.12668 */12669 readonly rawSize: number;12670 /**12671 * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.12672 * @param reason The reject reason.12673 * @returns void12674 */12675 setReject(reason: string): void;12676 /**12677 * Forward this email message to a verified destination address of the account.12678 * @param rcptTo Verified destination address.12679 * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).12680 * @returns A promise that resolves when the email message is forwarded.12681 */12682 forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;12683 /**12684 * Reply to the sender of this email message with a new EmailMessage object.12685 * @param message The reply message.12686 * @returns A promise that resolves when the email message is replied.12687 */12688 reply(message: EmailMessage): Promise<EmailSendResult>;12689 /**12690 * Reply to the sender of this email message with a message built from the given12691 * fields. Threading headers (In-Reply-To/References) are set automatically.12692 * @param builder The reply message contents.12693 * @returns A promise that resolves when the email message is replied.12694 */12695 reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;12696}12697/** A file attachment for an email message */12698type EmailAttachment = {12699 disposition: 'inline';12700 contentId: string;12701 filename: string;12702 type: string;12703 content: string | ArrayBuffer | ArrayBufferView;12704} | {12705 disposition: 'attachment';12706 contentId?: undefined;12707 filename: string;12708 type: string;12709 content: string | ArrayBuffer | ArrayBufferView;12710};12711/** An Email Address */12712interface EmailAddress {12713 name: string;12714 email: string;12715}12716/**12717 * Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or12718 * `bcc` must be provided.12719 */12720type EmailDestinations = {12721 to?: string | EmailAddress | (string | EmailAddress)[];12722 cc?: string | EmailAddress | (string | EmailAddress)[];12723 bcc?: string | EmailAddress | (string | EmailAddress)[];12724} & ({12725 to: string | EmailAddress | (string | EmailAddress)[];12726} | {12727 cc: string | EmailAddress | (string | EmailAddress)[];12728} | {12729 bcc: string | EmailAddress | (string | EmailAddress)[];12730});12731/**12732 * Fields shared by all composed emails (no recipients). Used directly by12733 * `ForwardableEmailMessage.reply()`, which always replies to the original12734 * sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.12735 */12736interface EmailReplyMessageBuilder {12737 from: string | EmailAddress;12738 subject: string;12739 replyTo?: string | EmailAddress;12740 headers?: Record<string, string>;12741 text?: string;12742 html?: string;12743 attachments?: EmailAttachment[];12744}12745/**12746 * Fields for composing an email without constructing raw MIME, for12747 * `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.12748 */12749type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;12750/**12751 * A binding that allows a Worker to send email messages.12752 */12753interface SendEmail {12754 send(message: EmailMessage): Promise<EmailSendResult>;12755 send(builder: EmailMessageBuilder): Promise<EmailSendResult>;12756}12757declare abstract class EmailEvent extends ExtendableEvent {12758 readonly message: ForwardableEmailMessage;12759}12760declare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;12761declare module "cloudflare:email" {12762 let _EmailMessage: {12763 prototype: EmailMessage;12764 new (from: string, to: string, raw: ReadableStream | string): EmailMessage;12765 };12766 export { _EmailMessage as EmailMessage };12767}12768/**12769 * Evaluation context for targeting rules.12770 * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.12771 */12772type FlagshipEvaluationContext = Record<string, string | number | boolean>;12773interface FlagshipEvaluationDetails<T> {12774 flagKey: string;12775 value: T;12776 variant?: string | undefined;12777 reason?: string | undefined;12778 errorCode?: string | undefined;12779 errorMessage?: string | undefined;12780}12781interface FlagshipEvaluationError extends Error {12782}12783/**12784 * Feature flags binding for evaluating feature flags from a Cloudflare Workers script.12785 *12786 * @example12787 * ```typescript12788 * // Get a boolean flag value with a default12789 * const enabled = await env.FLAGS.getBooleanValue('my-feature', false);12790 *12791 * // Get a flag value with evaluation context for targeting12792 * const variant = await env.FLAGS.getStringValue('experiment', 'control', {12793 * userId: 'user-123',12794 * country: 'US',12795 * });12796 *12797 * // Get full evaluation details including variant and reason12798 * const details = await env.FLAGS.getBooleanDetails('my-feature', false);12799 * console.log(details.variant, details.reason);12800 * ```12801 */12802declare abstract class Flagship {12803 /**12804 * Get a flag value without type checking.12805 * @param flagKey The key of the flag to evaluate.12806 * @param defaultValue Optional default value returned when evaluation fails.12807 * @param context Optional evaluation context for targeting rules.12808 */12809 get(flagKey: string, defaultValue?: unknown, context?: FlagshipEvaluationContext): Promise<unknown>;12810 /**12811 * Get a boolean flag value.12812 * @param flagKey The key of the flag to evaluate.12813 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12814 * @param context Optional evaluation context for targeting rules.12815 */12816 getBooleanValue(flagKey: string, defaultValue: boolean, context?: FlagshipEvaluationContext): Promise<boolean>;12817 /**12818 * Get a string flag value.12819 * @param flagKey The key of the flag to evaluate.12820 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12821 * @param context Optional evaluation context for targeting rules.12822 */12823 getStringValue(flagKey: string, defaultValue: string, context?: FlagshipEvaluationContext): Promise<string>;12824 /**12825 * Get a number flag value.12826 * @param flagKey The key of the flag to evaluate.12827 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12828 * @param context Optional evaluation context for targeting rules.12829 */12830 getNumberValue(flagKey: string, defaultValue: number, context?: FlagshipEvaluationContext): Promise<number>;12831 /**12832 * Get an object flag value.12833 * @param flagKey The key of the flag to evaluate.12834 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12835 * @param context Optional evaluation context for targeting rules.12836 */12837 getObjectValue<T extends object>(flagKey: string, defaultValue: T, context?: FlagshipEvaluationContext): Promise<T>;12838 /**12839 * Get a boolean flag value with full evaluation details.12840 * @param flagKey The key of the flag to evaluate.12841 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12842 * @param context Optional evaluation context for targeting rules.12843 */12844 getBooleanDetails(flagKey: string, defaultValue: boolean, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<boolean>>;12845 /**12846 * Get a string flag value with full evaluation details.12847 * @param flagKey The key of the flag to evaluate.12848 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12849 * @param context Optional evaluation context for targeting rules.12850 */12851 getStringDetails(flagKey: string, defaultValue: string, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<string>>;12852 /**12853 * Get a number flag value with full evaluation details.12854 * @param flagKey The key of the flag to evaluate.12855 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12856 * @param context Optional evaluation context for targeting rules.12857 */12858 getNumberDetails(flagKey: string, defaultValue: number, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<number>>;12859 /**12860 * Get an object flag value with full evaluation details.12861 * @param flagKey The key of the flag to evaluate.12862 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12863 * @param context Optional evaluation context for targeting rules.12864 */12865 getObjectDetails<T extends object>(flagKey: string, defaultValue: T, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<T>>;12866}12867/**12868 * Hello World binding to serve as an explanatory example. DO NOT USE12869 */12870interface HelloWorldBinding {12871 /**12872 * Retrieve the current stored value12873 */12874 get(): Promise<{12875 value: string;12876 ms?: number;12877 }>;12878 /**12879 * Set a new stored value12880 */12881 set(value: string): Promise<void>;12882}12883interface Hyperdrive {12884 /**12885 * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.12886 *12887 * Calling this method returns an identical socket to if you call12888 * `connect("host:port")` using the `host` and `port` fields from this object.12889 * Pick whichever approach works better with your preferred DB client library.12890 *12891 * Note that this socket is not yet authenticated -- it's expected that your12892 * code (or preferably, the client library of your choice) will authenticate12893 * using the information in this class's readonly fields.12894 */12895 connect(): Socket;12896 /**12897 * A valid DB connection string that can be passed straight into the typical12898 * client library/driver/ORM. This will typically be the easiest way to use12899 * Hyperdrive.12900 */12901 readonly connectionString: string;12902 /*12903 * A randomly generated hostname that is only valid within the context of the12904 * currently running Worker which, when passed into `connect()` function from12905 * the "cloudflare:sockets" module, will connect to the Hyperdrive instance12906 * for your database.12907 */12908 readonly host: string;12909 /*12910 * A synthetic IPv4 address (in the reserved 240.0.0.0/4 range) that, like the12911 * host field, is only valid within the context of the currently running12912 * Worker and, when passed into the `connect()` function from the12913 * "cloudflare:sockets" module, will connect to the Hyperdrive instance for12914 * your database. This is provided for database drivers that require the host12915 * to be an IP literal rather than a hostname.12916 */12917 readonly ip: string;12918 /*12919 * The port that must be paired the the host field when connecting.12920 */12921 readonly port: number;12922 /*12923 * The username to use when authenticating to your database via Hyperdrive.12924 * Unlike the host and password, this will be the same every time12925 */12926 readonly user: string;12927 /*12928 * The randomly generated password to use when authenticating to your12929 * database via Hyperdrive. Like the host field, this password is only valid12930 * within the context of the currently running Worker instance from which12931 * it's read.12932 */12933 readonly password: string;12934 /*12935 * The name of the database to connect to.12936 */12937 readonly database: string;12938}12939/**12940 * A handle to a dynamically-provisioned Hyperdrive connection, returned by12941 * `HyperdriveApi.get()`.12942 */12943interface HyperdriveDynamic extends Disposable {12944 /**12945 * The database name to use when connecting through this Hyperdrive.12946 */12947 readonly database: Promise<string>;12948 /*12949 * The randomly generated user to use when authenticating to your12950 * database via Hyperdrive.12951 */12952 readonly user: Promise<string>;12953 /*12954 * The randomly generated password to use when authenticating to your12955 * database via Hyperdrive.12956 */12957 readonly password: Promise<string>;12958 /**12959 * Open a TCP socket to the target database through this Hyperdrive.12960 *12961 */12962 connect(): Promise<Socket>;12963}12964/**12965 * Binding that provisions Hyperdrive connections at request time, rather than12966 * from static configuration.12967 */12968interface HyperdriveDynamicApi {12969 /**12970 * Provision a connection for the database described by `args`.12971 *12972 */12973 get(args: HyperdriveDynamicConfig): Promise<HyperdriveDynamic>;12974 /**12975 * Get a pre-generated connection string used for connecting to dynamic Hyperdrive.12976 */12977 getHyperdriveConnectionString(connectionString: string): Promise<string>;12978}12979/**12980 * Parameters identifying the database that a dynamically-provisioned12981 * Hyperdrive connection should target.12982 */12983interface HyperdriveDynamicConfig {12984 /**12985 * Generated connection string to pass into the dynamic worker.12986 *12987 */12988 dynamicHyperdriveConnectionString: string;12989 /**12990 * Connection string for the origin database Hyperdrive should connect to.12991 * Contains credentials, so treat it as a secret.12992 *12993 * The scheme selects the database engine. PostgreSQL origins are supported.12994 */12995 connectionString: string;12996 /**12997 * Region in which to place the connection pool. See the Hyperdrive12998 * documentation for the set of supported regions.12999 */13000 targetRegion: string;13001 /**13002 * Whether Hyperdrive should cache query results for this connection.13003 */13004 cachingEnabled?: boolean;13005 /**13006 * Maximum number of connections the pool may open to the origin database.13007 * Defaults to 60.13008 */13009 maxConnections?: number;13010}13011// Copyright (c) 2024 Cloudflare, Inc.13012// Licensed under the Apache 2.0 license found in the LICENSE file or at:13013// https://opensource.org/licenses/Apache-2.013014type ImageInfoResponse = {13015 format: 'image/svg+xml';13016} | {13017 format: string;13018 fileSize: number;13019 width: number;13020 height: number;13021};13022/**13023 * Parameters for rasterizing text into an image.13024 */13025type TextRasterize = {13026 /** The text content to render */13027 content: string;13028 /** rasterization options for the text **/13029 options: TextOptions;13030};13031type TextOptions = {13032 /** Font configuration */13033 font: {13034 /** URL to a font file in TrueType (.ttf), OpenType (.otf), WOFF (.woff), or WOFF2 (.woff2) format */13035 url: string;13036 };13037 /** Font size in points (pt) */13038 size?: number;13039 /** Text color in CSS format: hex (#RRGGBB or #RRGGBBAA), rgb(r,g,b), rgba(r,g,b,a), or named colors */13040 color?: string;13041};13042type ImageSource = ReadableStream<Uint8Array> | TextRasterize;13043type ImageTransform = {13044 width?: number;13045 height?: number;13046 background?: string;13047 blur?: number;13048 border?: {13049 color?: string;13050 width?: number;13051 } | {13052 top?: number;13053 bottom?: number;13054 left?: number;13055 right?: number;13056 };13057 brightness?: number;13058 contrast?: number;13059 fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop';13060 flip?: 'h' | 'v' | 'hv';13061 gamma?: number;13062 segment?: 'foreground';13063 gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {13064 x?: number;13065 y?: number;13066 mode: 'remainder' | 'box-center';13067 };13068 rotate?: 0 | 90 | 180 | 270;13069 saturation?: number;13070 sharpen?: number;13071 trim?: 'border' | {13072 top?: number;13073 bottom?: number;13074 left?: number;13075 right?: number;13076 width?: number;13077 height?: number;13078 border?: boolean | {13079 color?: string;13080 tolerance?: number;13081 keep?: number;13082 };13083 };13084};13085type ImageDrawOptions = {13086 opacity?: number;13087 repeat?: boolean | string;13088 composite?: ImageCompositeMode;13089 top?: number;13090 left?: number;13091 bottom?: number;13092 right?: number;13093};13094type ImageCompositeMode = 13095/** Foreground drawn on top of backdrop (default) */13096'over'13097/** Foreground shown only where backdrop is opaque */13098 | 'in'13099/** Foreground drawn on top, but clipped to the backdrop's shape */13100 | 'atop'13101/** Foreground shown only where backdrop is transparent */13102 | 'out'13103/** Foreground and backdrop visible only where the other is not */13104 | 'xor'13105/** Foreground and backdrop channels added (brightening) */13106 | 'lighter';13107type ImageInputOptions = {13108 encoding?: 'base64';13109};13110type ImageOutputOptions = {13111 format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba';13112 quality?: number;13113 background?: string;13114 anim?: boolean;13115};13116interface ImageMetadata {13117 id: string;13118 filename?: string;13119 uploaded?: string;13120 requireSignedURLs: boolean;13121 meta?: Record<string, unknown>;13122 variants: string[];13123 draft?: boolean;13124 creator?: string;13125}13126interface ImageUploadOptions {13127 id?: string;13128 filename?: string;13129 requireSignedURLs?: boolean;13130 metadata?: Record<string, unknown>;13131 creator?: string;13132 /**13133 * If 'base64', the input data will be decoded from base64 before processing13134 */13135 encoding?: 'base64';13136}13137interface ImageUpdateOptions {13138 requireSignedURLs?: boolean;13139 metadata?: Record<string, unknown>;13140 creator?: string;13141}13142type ImageMetadataFilterOperators = {13143 eq?: string | number | boolean;13144 in?: string[] | number[];13145 gt?: number;13146 gte?: number;13147 lt?: number;13148 lte?: number;13149};13150type ImageMetadataFilterValue = string | number | boolean | ImageMetadataFilterOperators;13151interface ImageListFilter {13152 metadata?: Record<string, ImageMetadataFilterValue>;13153}13154interface ImageListOptions {13155 limit?: number;13156 cursor?: string;13157 sortOrder?: 'asc' | 'desc';13158 creator?: string;13159 filter?: ImageListFilter;13160}13161interface ImageSignedUrlOptions {13162 variant: string;13163 expiresIn?: number;13164 keyName?: string;13165}13166interface ImageDirectUploadOptions {13167 id?: string;13168 requireSignedURLs?: boolean;13169 metadata?: Record<string, unknown>;13170 creator?: string;13171 expiresIn?: number;13172}13173interface ImageDirectUploadResult {13174 id: string;13175 uploadURL: string;13176}13177interface ImageList {13178 images: ImageMetadata[];13179 cursor?: string;13180 listComplete: boolean;13181}13182interface ImageHandle {13183 /**13184 * Get metadata for a hosted image13185 * @returns Image metadata, or null if not found13186 */13187 details(): Promise<ImageMetadata | null>;13188 /**13189 * Get the raw image data for a hosted image13190 * @returns ReadableStream of image bytes, or null if not found13191 */13192 bytes(): Promise<ReadableStream<Uint8Array> | null>;13193 /**13194 * Generate a signed delivery URL for this hosted image.13195 * @param options Signing configuration13196 * @returns A signed image delivery URL13197 * @throws {@link ImagesError} if signing fails13198 */13199 signedUrl(options: ImageSignedUrlOptions): Promise<string>;13200 /**13201 * Update hosted image metadata13202 * @param options Properties to update13203 * @returns Updated image metadata13204 * @throws {@link ImagesError} if update fails13205 */13206 update(options: ImageUpdateOptions): Promise<ImageMetadata>;13207 /**13208 * Delete a hosted image13209 * @returns True if deleted, false if not found13210 */13211 delete(): Promise<boolean>;13212}13213interface HostedImagesBinding {13214 /**13215 * Get a handle for a hosted image13216 * @param imageId The ID of the image (UUID or custom ID)13217 * @returns A handle for per-image operations13218 */13219 image(imageId: string): ImageHandle;13220 /**13221 * Upload a new hosted image13222 * @param image The image file to upload13223 * @param options Upload configuration13224 * @returns Metadata for the uploaded image13225 * @throws {@link ImagesError} if upload fails13226 */13227 upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;13228 /**13229 * List hosted images with pagination13230 * @param options List configuration13231 * @returns List of images with pagination info13232 * @throws {@link ImagesError} if list fails13233 */13234 list(options?: ImageListOptions): Promise<ImageList>;13235 /**13236 * Create a Direct Creator Upload link, letting an end user upload an13237 * image straight to Cloudflare without exposing an API token13238 * @param options Upload link configuration13239 * @returns The new image ID and the upload URL to hand to the end user13240 * @throws {@link ImagesError} if creation fails13241 */13242 createDirectUpload(options?: ImageDirectUploadOptions): Promise<ImageDirectUploadResult>;13243}13244interface ImagesBinding {13245 /**13246 * Get image metadata (type, width and height)13247 * @throws {@link ImagesError} with code 9412 if input is not an image13248 * @param stream The image bytes13249 */13250 info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>;13251 /**13252 * Begin applying a series of transformations to an image13253 * @param stream The image bytes13254 * @returns A transform handle13255 */13256 input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;13257 /**13258 * Begin applying a series of transformations to text13259 * @param content string to be rendered13260 * @param options font, optional color and size to use in rendering text13261 * @returns A transform handle13262 */13263 text(content: string, options: TextOptions): ImageTransformer;13264 /**13265 * Access hosted images CRUD operations13266 */13267 readonly hosted: HostedImagesBinding;13268}13269interface ImageTransformer {13270 /**13271 * Apply transform next, returning a transform handle.13272 * You can then apply more transformations, draw, or retrieve the output.13273 * @param transform13274 */13275 transform(transform: ImageTransform): ImageTransformer;13276 /**13277 * Draw an image on this transformer, returning a transform handle.13278 * You can then apply more transformations, draw, or retrieve the output.13279 * @param image The image (or transformer that will give the image) to draw13280 * @param options The options configuring how to draw the image13281 */13282 draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer;13283 /**13284 * Retrieve the image that results from applying the transforms to the13285 * provided input13286 * @param options Options that apply to the output e.g. output format13287 */13288 output(options: ImageOutputOptions): Promise<ImageTransformationResult>;13289}13290type ImageTransformationOutputOptions = {13291 encoding?: 'base64';13292};13293type ImageTransformationResponseOptions = {13294 headers?: HeadersInit;13295};13296interface ImageTransformationResult {13297 /**13298 * The image as a response, ready to store in cache or return to users13299 * @param options Options that apply to the returned response, e.g. additional headers13300 */13301 response(options?: ImageTransformationResponseOptions): Response;13302 /**13303 * The content type of the returned image13304 */13305 contentType(): string;13306 /**13307 * The bytes of the response13308 */13309 image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>;13310}13311interface ImagesError extends Error {13312 readonly code: number;13313 readonly message: string;13314 readonly stack?: string;13315}13316/**13317 * Media binding for transforming media streams.13318 * Provides the entry point for media transformation operations.13319 */13320interface MediaBinding {13321 /**13322 * Creates a media transformer from an input stream.13323 * @param media - The input media bytes13324 * @returns A MediaTransformer instance for applying transformations13325 */13326 input(media: ReadableStream<Uint8Array>): MediaTransformer;13327}13328/**13329 * Media transformer for applying transformation operations to media content.13330 * Handles sizing, fitting, and other input transformation parameters.13331 */13332interface MediaTransformer {13333 /**13334 * Applies transformation options to the media content.13335 * @param transform - Configuration for how the media should be transformed13336 * @returns A generator for producing the transformed media output13337 */13338 transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;13339 /**13340 * Generates the final media output with specified options.13341 * @param output - Configuration for the output format and parameters13342 * @returns The final transformation result containing the transformed media13343 */13344 output(output?: MediaTransformationOutputOptions): MediaTransformationResult;13345}13346/**13347 * Generator for producing media transformation results.13348 * Configures the output format and parameters for the transformed media.13349 */13350interface MediaTransformationGenerator {13351 /**13352 * Generates the final media output with specified options.13353 * @param output - Configuration for the output format and parameters13354 * @returns The final transformation result containing the transformed media13355 */13356 output(output?: MediaTransformationOutputOptions): MediaTransformationResult;13357}13358/**13359 * Result of a media transformation operation.13360 * Provides multiple ways to access the transformed media content.13361 */13362interface MediaTransformationResult {13363 /**13364 * Returns the transformed media as a readable stream of bytes.13365 * @returns A promise containing a readable stream with the transformed media13366 */13367 media(): Promise<ReadableStream<Uint8Array>>;13368 /**13369 * Returns the transformed media as an HTTP response object.13370 * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users13371 */13372 response(): Promise<Response>;13373 /**13374 * Returns the MIME type of the transformed media.13375 * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')13376 */13377 contentType(): Promise<string>;13378}13379/**13380 * Configuration options for transforming media input.13381 * Controls how the media should be resized and fitted.13382 */13383type MediaTransformationInputOptions = {13384 /** How the media should be resized to fit the specified dimensions */13385 fit?: 'contain' | 'cover' | 'scale-down';13386 /** Target width in pixels */13387 width?: number;13388 /** Target height in pixels */13389 height?: number;13390};13391/**13392 * Configuration options for Media Transformations output.13393 * Controls the format, timing, and type of the generated output.13394 */13395type MediaTransformationOutputOptions = {13396 /**13397 * Output mode determining the type of media to generate13398 */13399 mode?: 'video' | 'spritesheet' | 'frame' | 'audio';13400 /** Whether to include audio in the output */13401 audio?: boolean;13402 /**13403 * Starting timestamp for frame extraction or start time for clips. (e.g. '2s').13404 */13405 time?: string;13406 /**13407 * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').13408 */13409 duration?: string;13410 /**13411 * Number of frames in the spritesheet.13412 */13413 imageCount?: number;13414 /**13415 * Output format for the generated media.13416 */13417 format?: 'jpg' | 'png' | 'm4a';13418};13419/**13420 * Error object for media transformation operations.13421 * Extends the standard Error interface with additional media-specific information.13422 */13423interface MediaError extends Error {13424 readonly code: number;13425 readonly message: string;13426 readonly stack?: string;13427}13428declare module 'cloudflare:node' {13429 interface NodeStyleServer {13430 listen(...args: unknown[]): this;13431 address(): {13432 port?: number | null | undefined;13433 };13434 }13435 export function httpServerHandler(port: number): ExportedHandler;13436 export function httpServerHandler(options: {13437 port: number;13438 }): ExportedHandler;13439 export function httpServerHandler(server: NodeStyleServer): ExportedHandler;13440}13441type Params<P extends string = any> = Record<P, string | string[]>;13442type EventContext<Env, P extends string, Data> = {13443 request: Request<unknown, IncomingRequestCfProperties<unknown>>;13444 functionPath: string;13445 waitUntil: (promise: Promise<any>) => void;13446 passThroughOnException: () => void;13447 next: (input?: Request | string, init?: RequestInit) => Promise<Response>;13448 env: Env & {13449 ASSETS: {13450 fetch: typeof fetch;13451 };13452 };13453 params: Params<P>;13454 data: Data;13455};13456type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;13457type EventPluginContext<Env, P extends string, Data, PluginArgs> = {13458 request: Request<unknown, IncomingRequestCfProperties<unknown>>;13459 functionPath: string;13460 waitUntil: (promise: Promise<any>) => void;13461 passThroughOnException: () => void;13462 next: (input?: Request | string, init?: RequestInit) => Promise<Response>;13463 env: Env & {13464 ASSETS: {13465 fetch: typeof fetch;13466 };13467 };13468 params: Params<P>;13469 data: Data;13470 pluginArgs: PluginArgs;13471};13472type PagesPluginFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>, PluginArgs = unknown> = (context: EventPluginContext<Env, Params, Data, PluginArgs>) => Response | Promise<Response>;13473declare module "assets:*" {13474 export const onRequest: PagesFunction;13475}13476// Copyright (c) 2022-2023 Cloudflare, Inc.13477// Licensed under the Apache 2.0 license found in the LICENSE file or at:13478// https://opensource.org/licenses/Apache-2.013479declare module "cloudflare:pipelines" {13480 export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> {13481 protected env: Env;13482 protected ctx: ExecutionContext;13483 constructor(ctx: ExecutionContext, env: Env);13484 /**13485 * run receives an array of PipelineRecord which can be13486 * transformed and returned to the pipeline13487 * @param records Incoming records from the pipeline to be transformed13488 * @param metadata Information about the specific pipeline calling the transformation entrypoint13489 * @returns A promise containing the transformed PipelineRecord array13490 */13491 public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;13492 }13493 export type PipelineRecord = Record<string, unknown>;13494 export type PipelineBatchMetadata = {13495 pipelineId: string;13496 pipelineName: string;13497 };13498 export interface Pipeline<T extends PipelineRecord = PipelineRecord> {13499 /**13500 * The Pipeline interface represents the type of a binding to a Pipeline13501 *13502 * @param records The records to send to the pipeline13503 */13504 send(records: T[]): Promise<void>;13505 }13506}13507// PubSubMessage represents an incoming PubSub message.13508// The message includes metadata about the broker, the client, and the payload13509// itself.13510// https://developers.cloudflare.com/pub-sub/13511interface PubSubMessage {13512 // Message ID13513 readonly mid: number;13514 // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT13515 readonly broker: string;13516 // The MQTT topic the message was sent on.13517 readonly topic: string;13518 // The client ID of the client that published this message.13519 readonly clientId: string;13520 // The unique identifier (JWT ID) used by the client to authenticate, if token13521 // auth was used.13522 readonly jti?: string;13523 // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker13524 // received the message from the client.13525 readonly receivedAt: number;13526 // An (optional) string with the MIME type of the payload, if set by the13527 // client.13528 readonly contentType: string;13529 // Set to 1 when the payload is a UTF-8 string13530 // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc390106313531 readonly payloadFormatIndicator: number;13532 // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.13533 // You can use payloadFormatIndicator to inspect this before decoding.13534 payload: string | Uint8Array;13535}13536// JsonWebKey extended by kid parameter13537interface JsonWebKeyWithKid extends JsonWebKey {13538 // Key Identifier of the JWK13539 readonly kid: string;13540}13541interface RateLimitOptions {13542 key: string;13543}13544interface RateLimitOutcome {13545 success: boolean;13546}13547interface RateLimit {13548 /**13549 * Rate limit a request based on the provided options.13550 * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/13551 * @returns A promise that resolves with the outcome of the rate limit.13552 */13553 limit(options: RateLimitOptions): Promise<RateLimitOutcome>;13554}13555// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need13556// to referenced by `Fetcher`. This is included in the "importable" version of the types which13557// strips all `module` blocks.13558declare namespace Rpc {13559 // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.13560 // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.13561 // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to13562 // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)13563 export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND';13564 export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND';13565 export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND';13566 export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND';13567 export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND';13568 export interface RpcTargetBranded {13569 [__RPC_TARGET_BRAND]: never;13570 }13571 export interface WorkerEntrypointBranded {13572 [__WORKER_ENTRYPOINT_BRAND]: never;13573 }13574 export interface DurableObjectBranded {13575 [__DURABLE_OBJECT_BRAND]: never;13576 }13577 export interface WorkflowEntrypointBranded {13578 [__WORKFLOW_ENTRYPOINT_BRAND]: never;13579 }13580 export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded;13581 // Types that can be used through `Stub`s13582 export type Stubable = RpcTargetBranded | ((...args: any[]) => any);13583 // Types that can be passed over RPC13584 // The reason for using a generic type here is to build a serializable subset of structured13585 // cloneable composite types. This allows types defined with the "interface" keyword to pass the13586 // serializable check as well. Otherwise, only types defined with the "type" keyword would pass.13587 type Serializable<T> = 13588 // Structured cloneables13589 BaseType13590 // Structured cloneable composites13591 | Map<T extends Map<infer U, unknown> ? Serializable<U> : never, T extends Map<unknown, infer U> ? Serializable<U> : never> | Set<T extends Set<infer U> ? Serializable<U> : never> | ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never> | {13592 [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;13593 }13594 // Special types13595 | Stub<Stubable>13596 // Serialized as stubs, see `Stubify`13597 | Stubable;13598 // Base type for all RPC stubs, including common memory management methods.13599 // `T` is used as a marker type for unwrapping `Stub`s later.13600 interface StubBase<T extends Stubable> extends Disposable {13601 [__RPC_STUB_BRAND]: T;13602 dup(): this;13603 }13604 export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;13605 // This represents all the types that can be sent as-is over an RPC boundary13606 type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;13607 // Recursively rewrite all `Stubable` types with `Stub`s13608 // prettier-ignore13609 type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer K, infer V> ? Map<Stubify<K>, Stubify<V>> : T extends Set<infer V> ? Set<Stubify<V>> : T extends Array<infer V> ? Array<Stubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Stubify<V>> : T extends BaseType ? T : T extends {13610 [key: string | number]: any;13611 } ? {13612 [K in keyof T]: Stubify<T[K]>;13613 } : T;13614 // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.13615 // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:13616 // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.13617 // prettier-ignore13618 type Unstubify<T> = T extends StubBase<infer V> ? V : T extends Map<infer K, infer V> ? Map<Unstubify<K>, Unstubify<V>> : T extends Set<infer V> ? Set<Unstubify<V>> : T extends Array<infer V> ? Array<Unstubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Unstubify<V>> : T extends BaseType ? T : T extends {13619 [key: string | number]: unknown;13620 } ? {13621 [K in keyof T]: Unstubify<T[K]>;13622 } : T;13623 type UnstubifyAll<A extends any[]> = {13624 [I in keyof A]: Unstubify<A[I]>;13625 };13626 // Utility type for adding `Provider`/`Disposable`s to `object` types only.13627 // Note `unknown & T` is equivalent to `T`.13628 type MaybeProvider<T> = T extends object ? Provider<T> : unknown;13629 type MaybeDisposable<T> = T extends object ? Disposable : unknown;13630 // Type for method return or property on an RPC interface.13631 // - Stubable types are replaced by stubs.13632 // - Serializable types are passed by value, with stubable types replaced by stubs13633 // and a top-level `Disposer`.13634 // Everything else can't be passed over PRC.13635 // Technically, we use custom thenables here, but they quack like `Promise`s.13636 // Intersecting with `(Maybe)Provider` allows pipelining.13637 // prettier-ignore13638 type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never;13639 // Type for method or property on an RPC interface.13640 // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.13641 // Unwrapping `Stub`s allows calling with `Stubable` arguments.13642 // For properties, rewrite types to be `Result`s.13643 // In each case, unwrap `Promise`s.13644 type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>;13645 // Type for the callable part of an `Provider` if `T` is callable.13646 // This is intersected with methods/properties.13647 type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown;13648 // Base type for all other types providing RPC-like interfaces.13649 // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.13650 // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.13651 export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{13652 [K in keyof T]: MethodOrProperty<T[K]>;13653 }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>;13654}13655declare namespace Cloudflare {13656 // Type of `env`.13657 //13658 // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript13659 // will merge all declarations.13660 //13661 // You can use `wrangler types` to generate the `Env` type automatically.13662 interface Env {13663 }13664 // Project-specific parameters used to inform types.13665 //13666 // This interface is, again, intended to be declared in project-specific files, and then that13667 // declaration will be merged with this one.13668 //13669 // A project should have a declaration like this:13670 //13671 // interface GlobalProps {13672 // // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type13673 // // of `ctx.exports`.13674 // mainModule: typeof import("my-main-module");13675 //13676 // // Declares which of the main module's exports are configured with durable storage, and13677 // // thus should behave as Durable Object namsepace bindings.13678 // durableNamespaces: "MyDurableObject" | "AnotherDurableObject";13679 // }13680 //13681 // You can use `wrangler types` to generate `GlobalProps` automatically.13682 interface GlobalProps {13683 }13684 // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not13685 // present.13686 type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default;13687 // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the13688 // `mainModule` property.13689 type MainModule = GlobalProp<"mainModule", {}>;13690 // The type of ctx.exports, which contains loopback bindings for all top-level exports.13691 type Exports = {13692 [K in keyof MainModule]: LoopbackForExport<MainModule[K]>13693 // If the export is listed in `durableNamespaces`, then it is also a13694 // DurableObjectNamespace.13695 & (K extends GlobalProp<"durableNamespaces", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {});13696 };13697}13698declare namespace CloudflareWorkersModule {13699 export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;13700 export const RpcStub: {13701 new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;13702 };13703 export abstract class RpcTarget implements Rpc.RpcTargetBranded {13704 [Rpc.__RPC_TARGET_BRAND]: never;13705 }13706 // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC13707 export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded {13708 [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;13709 protected ctx: ExecutionContext<Props>;13710 protected env: Env;13711 constructor(ctx: ExecutionContext, env: Env);13712 email?(message: ForwardableEmailMessage): void | Promise<void>;13713 fetch?(request: Request): Response | Promise<Response>;13714 connect?(socket: Socket): void | Promise<void>;13715 queue?(batch: MessageBatch): void | Promise<void>;13716 scheduled?(controller: ScheduledController): void | Promise<void>;13717 tail?(events: TraceItem[]): void | Promise<void>;13718 tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;13719 test?(controller: TestController): void | Promise<void>;13720 trace?(traces: TraceItem[]): void | Promise<void>;13721 }13722 export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {13723 [Rpc.__DURABLE_OBJECT_BRAND]: never;13724 protected ctx: DurableObjectState<Props>;13725 protected env: Env;13726 constructor(ctx: DurableObjectState, env: Env);13727 alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;13728 fetch?(request: Request): Response | Promise<Response>;13729 connect?(socket: Socket): void | Promise<void>;13730 webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;13731 webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;13732 webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;13733 }13734 export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';13735 export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;13736 export type WorkflowDelayDuration = WorkflowSleepDuration;13737 export type WorkflowDynamicDelayContext = {13738 ctx: WorkflowStepContext<WorkflowDelayFunction>;13739 error: Error;13740 };13741 export type WorkflowDelayFunction = (input: WorkflowDynamicDelayContext) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;13742 export type WorkflowTimeoutDuration = WorkflowSleepDuration;13743 export type WorkflowRetentionDuration = WorkflowSleepDuration;13744 export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';13745 export type WorkflowStepSensitivity = 'output';13746 export type WorkflowStepConfig = {13747 retries?: {13748 limit: number;13749 delay: WorkflowDelayDuration | number | WorkflowDelayFunction;13750 backoff?: WorkflowBackoff;13751 };13752 timeout?: WorkflowTimeoutDuration | number;13753 sensitive?: WorkflowStepSensitivity;13754 };13755 // Internal discriminators used only for `WorkflowStep.do` overload13756 // resolution. They mirror `WorkflowStepConfig` but pin `retries.delay` to a13757 // single kind so the callback context can be narrowed based on the shape of13758 // the config argument (rather than on an inferred type parameter, which is13759 // lost when the caller supplies an explicit return-type argument). Not13760 // exported: they must not widen the public type surface.13761 type WorkflowStepConfigWithStaticDelay = Omit<WorkflowStepConfig, 'retries'> & {13762 retries?: {13763 limit: number;13764 delay: WorkflowDelayDuration | number;13765 backoff?: WorkflowBackoff;13766 };13767 };13768 type WorkflowStepConfigWithDelayFunction = Omit<WorkflowStepConfig, 'retries'> & {13769 retries: {13770 limit: number;13771 delay: WorkflowDelayFunction;13772 backoff?: WorkflowBackoff;13773 };13774 };13775 export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;13776 export type WorkflowCronSchedule = {13777 /** Cron expression that triggered this event. */13778 cron: string;13779 /** Timestamp of the scheduled trigger, in milliseconds since the Unix epoch. */13780 scheduledTime: number;13781 };13782 export type WorkflowEvent<T> = {13783 payload: Readonly<T>;13784 timestamp: Date;13785 instanceId: string;13786 workflowName: string;13787 schedule?: WorkflowCronSchedule;13788 };13789 export type WorkflowStepEvent<T> = {13790 payload: Readonly<T>;13791 timestamp: Date;13792 type: string;13793 sensitive?: WorkflowStepSensitivity;13794 };13795 export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {13796 step: {13797 name: string;13798 count: number;13799 };13800 attempt: number;13801 config: {13802 retries?: {13803 limit: number;13804 backoff?: WorkflowBackoff;13805 } & (Delay extends WorkflowDelayFunction ? {} : {13806 delay: WorkflowDelayDuration | number;13807 });13808 timeout?: WorkflowTimeoutDuration | number;13809 sensitive?: WorkflowStepSensitivity;13810 };13811 };13812 // The rollback handler receives the step context, so it mirrors the same13813 // delay discriminant as the step callback: when the step was configured with13814 // a dynamic delay function the resolved `config.retries.delay` is omitted,13815 // otherwise it is present. `Delay` is threaded from the `WorkflowStep.do`13816 // overload that matched the step config.13817 export type WorkflowRollbackContext<T = unknown, Delay = WorkflowDelayDuration | number> = {13818 ctx: WorkflowStepContext<Delay>;13819 error: Error;13820 output: T | undefined;13821 /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */13822 stepName: string;13823 };13824 export type WorkflowRollbackHandler<T = unknown, Delay = WorkflowDelayDuration | number> = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;13825 export type WorkflowStepRollbackOptions<T = unknown, Delay = WorkflowDelayDuration | number> = {13826 rollback: WorkflowRollbackHandler<T, Delay>;13827 rollbackConfig?: WorkflowStepRollbackConfig;13828 };13829 export abstract class WorkflowStep {13830 do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;13831 // The config overloads discriminate on the shape of `config.retries.delay`13832 // so the callback context reflects whether the resolved delay is present13833 // (static delay) or omitted (dynamic delay function). Each has a single13834 // type parameter, so an explicit return-type argument (`do<T>(...)`) still13835 // resolves here. ORDERING IS LOAD-BEARING: the broad `WorkflowStepConfig`13836 // fallback MUST remain last, otherwise it shadows the discriminating13837 // overloads and narrowing is silently lost.13838 do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>): Promise<T>;13839 do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext<WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayDuration | number>): Promise<T>;13840 do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;13841 sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;13842 sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;13843 waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {13844 type: string;13845 timeout?: WorkflowTimeoutDuration | number;13846 }): Promise<WorkflowStepEvent<T>>;13847 }13848 export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown';13849 export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded {13850 [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;13851 protected ctx: ExecutionContext;13852 protected env: Env;13853 constructor(ctx: ExecutionContext, env: Env);13854 run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;13855 }13856 export function waitUntil(promise: Promise<unknown>): void;13857 export function withEnv(newEnv: unknown, fn: () => unknown): unknown;13858 export function withExports(newExports: unknown, fn: () => unknown): unknown;13859 export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown;13860 export const env: Cloudflare.Env;13861 export const exports: Cloudflare.Exports;13862 export const cache: CacheContext;13863 export const tracing: Tracing;13864}13865declare module 'cloudflare:workers' {13866 export = CloudflareWorkersModule;13867}13868interface SecretsStoreSecret {13869 /**13870 * Get a secret from the Secrets Store, returning a string of the secret value13871 * if it exists, or throws an error if it does not exist13872 */13873 get(): Promise<string>;13874}13875declare module "cloudflare:sockets" {13876 function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;13877 export { _connect as connect };13878}13879/**13880 * Binding entrypoint for Cloudflare Stream.13881 *13882 * Usage:13883 * - Binding-level operations:13884 * `await env.STREAM.videos.upload`13885 * `await env.STREAM.videos.createDirectUpload`13886 * `await env.STREAM.videos.*`13887 * `await env.STREAM.watermarks.*`13888 * - Per-video operations:13889 * `await env.STREAM.video(id).downloads.*`13890 * `await env.STREAM.video(id).captions.*`13891 *13892 * Example usage:13893 * ```ts13894 * await env.STREAM.video(id).downloads.generate();13895 *13896 * const video = env.STREAM.video(id)13897 * const captions = video.captions.list();13898 * const videoDetails = video.details()13899 * ```13900 */13901interface StreamBinding {13902 /**13903 * Returns a handle scoped to a single video for per-video operations.13904 * @param id The unique identifier for the video.13905 * @returns A handle for per-video operations.13906 */13907 video(id: string): StreamVideoHandle;13908 /**13909 * Uploads a new video from a provided URL.13910 * @param url The URL to upload from.13911 * @param params Optional upload parameters.13912 * @returns The uploaded video details.13913 * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid13914 * @throws {QuotaReachedError} if the account storage capacity is exceeded13915 * @throws {MaxFileSizeError} if the file size is too large13916 * @throws {RateLimitedError} if the server received too many requests13917 * @throws {AlreadyUploadedError} if a video was already uploaded to this URL13918 * @throws {InternalError} if an unexpected error occurs13919 */13920 upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;13921 /**13922 * Creates a direct upload that allows video uploads without an API key.13923 * @param params Parameters for the direct upload13924 * @returns The direct upload details.13925 * @throws {BadRequestError} if the parameters are invalid13926 * @throws {RateLimitedError} if the server received too many requests13927 * @throws {InternalError} if an unexpected error occurs13928 */13929 createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;13930 videos: StreamVideos;13931 watermarks: StreamWatermarks;13932}13933/**13934 * Handle for operations scoped to a single Stream video.13935 */13936interface StreamVideoHandle {13937 /**13938 * The unique identifier for the video.13939 */13940 id: string;13941 /**13942 * Get a full videos details13943 * @returns The full video details.13944 * @throws {NotFoundError} if the video is not found13945 * @throws {InternalError} if an unexpected error occurs13946 */13947 details(): Promise<StreamVideo>;13948 /**13949 * Update details for a single video.13950 * @param params The fields to update for the video.13951 * @returns The updated video details.13952 * @throws {NotFoundError} if the video is not found13953 * @throws {BadRequestError} if the parameters are invalid13954 * @throws {InternalError} if an unexpected error occurs13955 */13956 update(params: StreamUpdateVideoParams): Promise<StreamVideo>;13957 /**13958 * Deletes a video and its copies from Cloudflare Stream.13959 * @returns A promise that resolves when deletion completes.13960 * @throws {NotFoundError} if the video is not found13961 * @throws {InternalError} if an unexpected error occurs13962 */13963 delete(): Promise<void>;13964 /**13965 * Creates a signed URL token for a video.13966 * @returns The signed token that was created.13967 * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed13968 */13969 generateToken(): Promise<string>;13970 downloads: StreamScopedDownloads;13971 captions: StreamScopedCaptions;13972}13973interface StreamVideo {13974 /**13975 * The unique identifier for the video.13976 */13977 id: string;13978 /**13979 * A user-defined identifier for the media creator.13980 */13981 creator: string | null;13982 /**13983 * The thumbnail URL for the video.13984 */13985 thumbnail: string;13986 /**13987 * The thumbnail timestamp percentage.13988 */13989 thumbnailTimestampPct: number;13990 /**13991 * Indicates whether the video is ready to stream.13992 */13993 readyToStream: boolean;13994 /**13995 * The date and time the video became ready to stream.13996 */13997 readyToStreamAt: string | null;13998 /**13999 * Processing status information.14000 */14001 status: StreamVideoStatus;14002 /**14003 * A user modifiable key-value store.14004 */14005 meta: Record<string, string>;14006 /**14007 * The date and time the video was created.14008 */14009 created: string;14010 /**14011 * The date and time the video was last modified.14012 */14013 modified: string;14014 /**14015 * The date and time at which the video will be deleted.14016 */14017 scheduledDeletion: string | null;14018 /**14019 * The size of the video in bytes.14020 */14021 size: number;14022 /**14023 * The preview URL for the video.14024 */14025 preview?: string;14026 /**14027 * Origins allowed to display the video.14028 */14029 allowedOrigins: Array<string>;14030 /**14031 * Indicates whether signed URLs are required.14032 */14033 requireSignedURLs: boolean | null;14034 /**14035 * The date and time the video was uploaded.14036 */14037 uploaded: string | null;14038 /**14039 * The date and time when the upload URL expires.14040 */14041 uploadExpiry: string | null;14042 /**14043 * The maximum size in bytes for direct uploads.14044 */14045 maxSizeBytes: number | null;14046 /**14047 * The maximum duration in seconds for direct uploads.14048 */14049 maxDurationSeconds: number | null;14050 /**14051 * The video duration in seconds. -1 indicates unknown.14052 */14053 duration: number;14054 /**14055 * Input metadata for the original upload.14056 */14057 input: StreamVideoInput;14058 /**14059 * Playback URLs for the video.14060 */14061 hlsPlaybackUrl: string;14062 dashPlaybackUrl: string;14063 /**14064 * The watermark applied to the video, if any.14065 */14066 watermark: StreamWatermark | null;14067 /**14068 * The live input id associated with the video, if any.14069 */14070 liveInputId?: string | null;14071 /**14072 * The source video id if this is a clip.14073 */14074 clippedFromId: string | null;14075 /**14076 * Public details associated with the video.14077 */14078 publicDetails: StreamPublicDetails | null;14079}14080type StreamVideoStatus = {14081 /**14082 * The current processing state.14083 */14084 state: string;14085 /**14086 * The current processing step.14087 */14088 step?: string;14089 /**14090 * The percent complete as a string.14091 */14092 pctComplete?: string;14093 /**14094 * An error reason code, if applicable.14095 */14096 errorReasonCode: string;14097 /**14098 * An error reason text, if applicable.14099 */14100 errorReasonText: string;14101};14102type StreamVideoInput = {14103 /**14104 * The input width in pixels.14105 */14106 width: number;14107 /**14108 * The input height in pixels.14109 */14110 height: number;14111};14112type StreamPublicDetails = {14113 /**14114 * The public title for the video.14115 */14116 title: string | null;14117 /**14118 * The public share link.14119 */14120 share_link: string | null;14121 /**14122 * The public channel link.14123 */14124 channel_link: string | null;14125 /**14126 * The public logo URL.14127 */14128 logo: string | null;14129};14130type StreamDirectUpload = {14131 /**14132 * The URL an unauthenticated upload can use for a single multipart request.14133 */14134 uploadURL: string;14135 /**14136 * A Cloudflare-generated unique identifier for a media item.14137 */14138 id: string;14139 /**14140 * The watermark profile applied to the upload.14141 */14142 watermark: StreamWatermark | null;14143 /**14144 * The scheduled deletion time, if any.14145 */14146 scheduledDeletion: string | null;14147};14148type StreamDirectUploadCreateParams = {14149 /**14150 * The maximum duration in seconds for a video upload.14151 */14152 maxDurationSeconds: number;14153 /**14154 * The date and time after upload when videos will not be accepted.14155 */14156 expiry?: string;14157 /**14158 * A user-defined identifier for the media creator.14159 */14160 creator?: string;14161 /**14162 * A user modifiable key-value store used to reference other systems of record for14163 * managing videos.14164 */14165 meta?: Record<string, string>;14166 /**14167 * Lists the origins allowed to display the video.14168 */14169 allowedOrigins?: Array<string>;14170 /**14171 * Indicates whether the video can be accessed using the id. When set to `true`,14172 * a signed token must be generated with a signing key to view the video.14173 */14174 requireSignedURLs?: boolean;14175 /**14176 * The thumbnail timestamp percentage.14177 */14178 thumbnailTimestampPct?: number;14179 /**14180 * The date and time at which the video will be deleted. Include `null` to remove14181 * a scheduled deletion.14182 */14183 scheduledDeletion?: string | null;14184 /**14185 * The watermark profile to apply.14186 */14187 watermark?: StreamDirectUploadWatermark;14188};14189type StreamDirectUploadWatermark = {14190 /**14191 * The unique identifier for the watermark profile.14192 */14193 id: string;14194};14195type StreamUrlUploadParams = {14196 /**14197 * Lists the origins allowed to display the video. Enter allowed origin14198 * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the14199 * video to be viewed on any origin.14200 */14201 allowedOrigins?: Array<string>;14202 /**14203 * A user-defined identifier for the media creator.14204 */14205 creator?: string;14206 /**14207 * A user modifiable key-value store used to reference other systems of14208 * record for managing videos.14209 */14210 meta?: Record<string, string>;14211 /**14212 * Indicates whether the video can be a accessed using the id. When14213 * set to `true`, a signed token must be generated with a signing key to view the14214 * video.14215 */14216 requireSignedURLs?: boolean;14217 /**14218 * Indicates the date and time at which the video will be deleted. Omit14219 * the field to indicate no change, or include with a `null` value to remove an14220 * existing scheduled deletion. If specified, must be at least 30 days from upload14221 * time.14222 */14223 scheduledDeletion?: string | null;14224 /**14225 * The timestamp for a thumbnail image calculated as a percentage value14226 * of the video's duration. To convert from a second-wise timestamp to a14227 * percentage, divide the desired timestamp by the total duration of the video. If14228 * this value is not set, the default thumbnail image is taken from 0s of the14229 * video.14230 */14231 thumbnailTimestampPct?: number;14232 /**14233 * The identifier for the watermark profile14234 */14235 watermarkId?: string;14236};14237interface StreamScopedCaptions {14238 /**14239 * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.14240 * One caption or subtitle file per language is allowed.14241 * @param language The BCP 47 language tag for the caption or subtitle.14242 * @param input The caption or subtitle stream to upload.14243 * @returns The created caption entry.14244 * @throws {NotFoundError} if the video is not found14245 * @throws {BadRequestError} if the language or file is invalid14246 * @throws {InternalError} if an unexpected error occurs14247 */14248 upload(language: string, input: ReadableStream): Promise<StreamCaption>;14249 /**14250 * Generate captions or subtitles for the provided language via AI.14251 * @param language The BCP 47 language tag to generate.14252 * @returns The generated caption entry.14253 * @throws {NotFoundError} if the video is not found14254 * @throws {BadRequestError} if the language is invalid14255 * @throws {StreamError} if a generated caption already exists14256 * @throws {StreamError} if the video duration is too long14257 * @throws {StreamError} if the video is missing audio14258 * @throws {StreamError} if the requested language is not supported14259 * @throws {InternalError} if an unexpected error occurs14260 */14261 generate(language: string): Promise<StreamCaption>;14262 /**14263 * Lists the captions or subtitles.14264 * Use the language parameter to filter by a specific language.14265 * @param language The optional BCP 47 language tag to filter by.14266 * @returns The list of captions or subtitles.14267 * @throws {NotFoundError} if the video or caption is not found14268 * @throws {InternalError} if an unexpected error occurs14269 */14270 list(language?: string): Promise<StreamCaption[]>;14271 /**14272 * Removes the captions or subtitles from a video.14273 * @param language The BCP 47 language tag to remove.14274 * @returns A promise that resolves when deletion completes.14275 * @throws {NotFoundError} if the video or caption is not found14276 * @throws {InternalError} if an unexpected error occurs14277 */14278 delete(language: string): Promise<void>;14279}14280interface StreamScopedDownloads {14281 /**14282 * Generates a download for a video when a video is ready to view. Available14283 * types are `default` and `audio`. Defaults to `default` when omitted.14284 * @param downloadType The download type to create.14285 * @returns The current downloads for the video.14286 * @throws {NotFoundError} if the video is not found14287 * @throws {BadRequestError} if the download type is invalid14288 * @throws {StreamError} if the video duration is too long to generate a download14289 * @throws {StreamError} if the video is not ready to stream14290 * @throws {InternalError} if an unexpected error occurs14291 */14292 generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;14293 /**14294 * Lists the downloads created for a video.14295 * @returns The current downloads for the video.14296 * @throws {NotFoundError} if the video or downloads are not found14297 * @throws {InternalError} if an unexpected error occurs14298 */14299 get(): Promise<StreamDownloadGetResponse>;14300 /**14301 * Delete the downloads for a video. Available types are `default` and `audio`.14302 * Defaults to `default` when omitted.14303 * @param downloadType The download type to delete.14304 * @returns A promise that resolves when deletion completes.14305 * @throws {NotFoundError} if the video or downloads are not found14306 * @throws {InternalError} if an unexpected error occurs14307 */14308 delete(downloadType?: StreamDownloadType): Promise<void>;14309}14310interface StreamVideos {14311 /**14312 * Lists all videos in a users account.14313 * @returns The list of videos.14314 * @throws {BadRequestError} if the parameters are invalid14315 * @throws {InternalError} if an unexpected error occurs14316 */14317 list(params?: StreamVideosListParams): Promise<StreamVideo[]>;14318}14319interface StreamWatermarks {14320 /**14321 * Generate a new watermark profile14322 * @param input The image stream to upload14323 * @param params The watermark creation parameters.14324 * @returns The created watermark profile.14325 * @throws {BadRequestError} if the parameters are invalid14326 * @throws {InvalidURLError} if the URL is invalid14327 * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached14328 * @throws {InternalError} if an unexpected error occurs14329 */14330 generate(input: ReadableStream, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;14331 /**14332 * Generate a new watermark profile14333 * @param url The image url to upload14334 * @param params The watermark creation parameters.14335 * @returns The created watermark profile.14336 * @throws {BadRequestError} if the parameters are invalid14337 * @throws {InvalidURLError} if the URL is invalid14338 * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached14339 * @throws {InternalError} if an unexpected error occurs14340 */14341 generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;14342 /**14343 * Lists all watermark profiles for an account.14344 * @returns The list of watermark profiles.14345 * @throws {InternalError} if an unexpected error occurs14346 */14347 list(): Promise<StreamWatermark[]>;14348 /**14349 * Retrieves details for a single watermark profile.14350 * @param watermarkId The watermark profile identifier.14351 * @returns The watermark profile details.14352 * @throws {NotFoundError} if the watermark is not found14353 * @throws {InternalError} if an unexpected error occurs14354 */14355 get(watermarkId: string): Promise<StreamWatermark>;14356 /**14357 * Deletes a watermark profile.14358 * @param watermarkId The watermark profile identifier.14359 * @returns A promise that resolves when deletion completes.14360 * @throws {NotFoundError} if the watermark is not found14361 * @throws {InternalError} if an unexpected error occurs14362 */14363 delete(watermarkId: string): Promise<void>;14364}14365type StreamUpdateVideoParams = {14366 /**14367 * Lists the origins allowed to display the video. Enter allowed origin14368 * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the14369 * video to be viewed on any origin.14370 */14371 allowedOrigins?: Array<string>;14372 /**14373 * A user-defined identifier for the media creator.14374 */14375 creator?: string;14376 /**14377 * The maximum duration in seconds for a video upload. Can be set for a14378 * video that is not yet uploaded to limit its duration. Uploads that exceed the14379 * specified duration will fail during processing. A value of `-1` means the value14380 * is unknown.14381 */14382 maxDurationSeconds?: number;14383 /**14384 * A user modifiable key-value store used to reference other systems of14385 * record for managing videos.14386 */14387 meta?: Record<string, string>;14388 /**14389 * Indicates whether the video can be a accessed using the id. When14390 * set to `true`, a signed token must be generated with a signing key to view the14391 * video.14392 */14393 requireSignedURLs?: boolean;14394 /**14395 * Indicates the date and time at which the video will be deleted. Omit14396 * the field to indicate no change, or include with a `null` value to remove an14397 * existing scheduled deletion. If specified, must be at least 30 days from upload14398 * time.14399 */14400 scheduledDeletion?: string | null;14401 /**14402 * The timestamp for a thumbnail image calculated as a percentage value14403 * of the video's duration. To convert from a second-wise timestamp to a14404 * percentage, divide the desired timestamp by the total duration of the video. If14405 * this value is not set, the default thumbnail image is taken from 0s of the14406 * video.14407 */14408 thumbnailTimestampPct?: number;14409};14410type StreamCaption = {14411 /**14412 * Whether the caption was generated via AI.14413 */14414 generated?: boolean;14415 /**14416 * The language label displayed in the native language to users.14417 */14418 label: string;14419 /**14420 * The language tag in BCP 47 format.14421 */14422 language: string;14423 /**14424 * The status of a generated caption.14425 */14426 status?: 'ready' | 'inprogress' | 'error';14427};14428type StreamDownloadStatus = 'ready' | 'inprogress' | 'error';14429type StreamDownloadType = 'default' | 'audio';14430type StreamDownload = {14431 /**14432 * Indicates the progress as a percentage between 0 and 100.14433 */14434 percentComplete: number;14435 /**14436 * The status of a generated download.14437 */14438 status: StreamDownloadStatus;14439 /**14440 * The URL to access the generated download.14441 */14442 url?: string;14443};14444/**14445 * An object with download type keys. Each key is optional and only present if that14446 * download type has been created.14447 */14448type StreamDownloadGetResponse = {14449 /**14450 * The audio-only download. Only present if this download type has been created.14451 */14452 audio?: StreamDownload;14453 /**14454 * The default video download. Only present if this download type has been created.14455 */14456 default?: StreamDownload;14457};14458type StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';14459type StreamWatermark = {14460 /**14461 * The unique identifier for a watermark profile.14462 */14463 id: string;14464 /**14465 * The size of the image in bytes.14466 */14467 size: number;14468 /**14469 * The height of the image in pixels.14470 */14471 height: number;14472 /**14473 * The width of the image in pixels.14474 */14475 width: number;14476 /**14477 * The date and a time a watermark profile was created.14478 */14479 created: string;14480 /**14481 * The source URL for a downloaded image. If the watermark profile was created via14482 * direct upload, this field is null.14483 */14484 downloadedFrom: string | null;14485 /**14486 * A short description of the watermark profile.14487 */14488 name: string;14489 /**14490 * The translucency of the image. A value of `0.0` makes the image completely14491 * transparent, and `1.0` makes the image completely opaque. Note that if the image14492 * is already semi-transparent, setting this to `1.0` will not make the image14493 * completely opaque.14494 */14495 opacity: number;14496 /**14497 * The whitespace between the adjacent edges (determined by position) of the video14498 * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded14499 * video width or length, as determined by the algorithm.14500 */14501 padding: number;14502 /**14503 * The size of the image relative to the overall size of the video. This parameter14504 * will adapt to horizontal and vertical videos automatically. `0.0` indicates no14505 * scaling (use the size of the image as-is), and `1.0 `fills the entire video.14506 */14507 scale: number;14508 /**14509 * The location of the image. Valid positions are: `upperRight`, `upperLeft`,14510 * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the14511 * `padding` parameter.14512 */14513 position: StreamWatermarkPosition;14514};14515type StreamWatermarkCreateParams = {14516 /**14517 * A short description of the watermark profile.14518 */14519 name?: string;14520 /**14521 * The translucency of the image. A value of `0.0` makes the image completely14522 * transparent, and `1.0` makes the image completely opaque. Note that if the14523 * image is already semi-transparent, setting this to `1.0` will not make the14524 * image completely opaque.14525 */14526 opacity?: number;14527 /**14528 * The whitespace between the adjacent edges (determined by position) of the14529 * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully14530 * padded video width or length, as determined by the algorithm.14531 */14532 padding?: number;14533 /**14534 * The size of the image relative to the overall size of the video. This14535 * parameter will adapt to horizontal and vertical videos automatically. `0.0`14536 * indicates no scaling (use the size of the image as-is), and `1.0 `fills the14537 * entire video.14538 */14539 scale?: number;14540 /**14541 * The location of the image.14542 */14543 position?: StreamWatermarkPosition;14544};14545type StreamVideosListParams = {14546 /**14547 * The maximum number of videos to return.14548 */14549 limit?: number;14550 /**14551 * Return videos created before this timestamp.14552 * (RFC3339/RFC3339Nano)14553 */14554 before?: string;14555 /**14556 * Comparison operator for the `before` field.14557 * @default 'lt'14558 */14559 beforeComp?: StreamPaginationComparison;14560 /**14561 * Return videos created after this timestamp.14562 * (RFC3339/RFC3339Nano)14563 */14564 after?: string;14565 /**14566 * Comparison operator for the `after` field.14567 * @default 'gte'14568 */14569 afterComp?: StreamPaginationComparison;14570};14571type StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';14572/**14573 * Error object for Stream binding operations.14574 */14575interface StreamError extends Error {14576 readonly code: number;14577 readonly statusCode: number;14578 readonly message: string;14579 readonly stack?: string;14580}14581interface InternalError extends StreamError {14582 name: 'InternalError';14583}14584interface BadRequestError extends StreamError {14585 name: 'BadRequestError';14586}14587interface NotFoundError extends StreamError {14588 name: 'NotFoundError';14589}14590interface ForbiddenError extends StreamError {14591 name: 'ForbiddenError';14592}14593interface RateLimitedError extends StreamError {14594 name: 'RateLimitedError';14595}14596interface QuotaReachedError extends StreamError {14597 name: 'QuotaReachedError';14598}14599interface MaxFileSizeError extends StreamError {14600 name: 'MaxFileSizeError';14601}14602interface InvalidURLError extends StreamError {14603 name: 'InvalidURLError';14604}14605interface AlreadyUploadedError extends StreamError {14606 name: 'AlreadyUploadedError';14607}14608interface TooManyWatermarksError extends StreamError {14609 name: 'TooManyWatermarksError';14610}14611type MarkdownDocument = {14612 name: string;14613 blob: Blob;14614};14615type OutputFormat = 'markdown' | 'text';14616type ConversionResponse = {14617 id: string;14618 name: string;14619 mimeType: string;14620 format: OutputFormat;14621 tokens: number;14622 data: string;14623} | {14624 id: string;14625 name: string;14626 mimeType: string;14627 format: 'error';14628 error: string;14629};14630type ImageConversionOptions = {14631 descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de';14632};14633type EmbeddedImageConversionOptions = ImageConversionOptions & {14634 convert?: boolean;14635 maxConvertedImages?: number;14636};14637type ConversionOutputOptions = {14638 format?: OutputFormat;14639};14640type ConversionOptions = {14641 output?: ConversionOutputOptions;14642 html?: {14643 images?: EmbeddedImageConversionOptions & {14644 convertOGImage?: boolean;14645 };14646 hostname?: string;14647 cssSelector?: string;14648 };14649 docx?: {14650 images?: EmbeddedImageConversionOptions;14651 };14652 image?: ImageConversionOptions;14653 pdf?: {14654 images?: EmbeddedImageConversionOptions;14655 metadata?: boolean;14656 };14657};14658type ConversionRequestOptions = {14659 gateway?: GatewayOptions;14660 extraHeaders?: object;14661 conversionOptions?: ConversionOptions;14662};14663type SupportedFileFormat = {14664 mimeType: string;14665 extension: string;14666};14667declare abstract class ToMarkdownService {14668 transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;14669 transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;14670 supported(): Promise<SupportedFileFormat[]>;14671}14672declare namespace TailStream {14673 interface Header {14674 readonly name: string;14675 readonly value: string;14676 }14677 interface FetchEventInfo {14678 readonly type: "fetch";14679 readonly method: string;14680 readonly url: string;14681 readonly cfJson?: object;14682 readonly headers: Header[];14683 }14684 interface JsRpcEventInfo {14685 readonly type: "jsrpc";14686 }14687 interface ScheduledEventInfo {14688 readonly type: "scheduled";14689 readonly scheduledTime: Date;14690 readonly cron: string;14691 }14692 interface AlarmEventInfo {14693 readonly type: "alarm";14694 readonly scheduledTime: Date;14695 }14696 interface QueueEventInfo {14697 readonly type: "queue";14698 readonly queueName: string;14699 readonly batchSize: number;14700 }14701 interface EmailEventInfo {14702 readonly type: "email";14703 readonly mailFrom: string;14704 readonly rcptTo: string;14705 readonly rawSize: number;14706 }14707 interface TraceEventInfo {14708 readonly type: "trace";14709 readonly traces: (string | null)[];14710 }14711 interface HibernatableWebSocketEventInfoMessage {14712 readonly type: "message";14713 }14714 interface HibernatableWebSocketEventInfoError {14715 readonly type: "error";14716 }14717 interface HibernatableWebSocketEventInfoClose {14718 readonly type: "close";14719 readonly code: number;14720 readonly wasClean: boolean;14721 }14722 interface HibernatableWebSocketEventInfo {14723 readonly type: "hibernatableWebSocket";14724 readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage;14725 }14726 interface CustomEventInfo {14727 readonly type: "custom";14728 }14729 interface FetchResponseInfo {14730 readonly type: "fetch";14731 readonly statusCode: number;14732 }14733 interface ConnectEventInfo {14734 readonly type: "connect";14735 }14736 type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime" | "aborted";14737 interface ScriptVersion {14738 readonly id: string;14739 readonly tag?: string;14740 readonly message?: string;14741 }14742 interface TracePreviewInfo {14743 readonly id: string;14744 readonly slug: string;14745 readonly name: string;14746 }14747 interface Onset {14748 readonly type: "onset";14749 readonly attributes: Attribute[];14750 // id for the span being opened by this Onset event.14751 readonly spanId: string;14752 readonly dispatchNamespace?: string;14753 readonly entrypoint?: string;14754 readonly executionModel: string;14755 readonly durableObjectId?: string;14756 readonly scriptName?: string;14757 readonly scriptTags?: string[];14758 readonly scriptVersion?: ScriptVersion;14759 readonly preview?: TracePreviewInfo;14760 readonly info: FetchEventInfo | ConnectEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo;14761 }14762 interface Outcome {14763 readonly type: "outcome";14764 readonly outcome: EventOutcome;14765 readonly cpuTime: number;14766 readonly wallTime: number;14767 }14768 interface SpanOpen {14769 readonly type: "spanOpen";14770 readonly name: string;14771 // id for the span being opened by this SpanOpen event.14772 readonly spanId: string;14773 readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;14774 }14775 interface SpanClose {14776 readonly type: "spanClose";14777 readonly outcome: EventOutcome;14778 }14779 interface DiagnosticChannelEvent {14780 readonly type: "diagnosticChannel";14781 readonly channel: string;14782 readonly message: any;14783 }14784 interface Exception {14785 readonly type: "exception";14786 readonly name: string;14787 readonly message: string;14788 readonly stack?: string;14789 }14790 interface TailStreamErrorInfo {14791 readonly name: string;14792 readonly message: string;14793 readonly stack?: string;14794 }14795 type Log = {14796 readonly type: "log";14797 readonly level: "debug" | "error" | "info" | "log" | "warn";14798 readonly errorInfo?: readonly (TailStreamErrorInfo | null)[];14799 } & ({14800 readonly message: object;14801 readonly truncated?: false;14802 } | {14803 readonly message: string;14804 readonly truncated: true;14805 });14806 interface DroppedEventsDiagnostic {14807 readonly diagnosticsType: "droppedEvents";14808 readonly count: number;14809 }14810 interface StreamDiagnostic {14811 readonly type: 'streamDiagnostic';14812 // To add new diagnostic types, define a new interface and add it to this union type.14813 readonly diagnostic: DroppedEventsDiagnostic;14814 }14815 // This marks the worker handler return information.14816 // This is separate from Outcome because the worker invocation can live for a long time after14817 // returning. For example - Websockets that return an http upgrade response but then continue14818 // streaming information or SSE http connections.14819 interface Return {14820 readonly type: "return";14821 readonly info?: FetchResponseInfo;14822 }14823 interface Attribute {14824 readonly name: string;14825 readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[];14826 }14827 interface Attributes {14828 readonly type: "attributes";14829 readonly info: Attribute[];14830 }14831 type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;14832 // Context in which this trace event lives.14833 interface SpanContext {14834 // Single id for the entire top-level invocation14835 // This should be a new traceId for the first worker stage invoked in the eyeball request and then14836 // same-account service-bindings should reuse the same traceId but cross-account service-bindings14837 // should use a new traceId.14838 readonly traceId: string;14839 // spanId in which this event is handled14840 // for Onset and SpanOpen events this would be the parent span id14841 // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events14842 // For Hibernate and Mark this would be the span under which they were emitted.14843 // spanId is not set ONLY if:14844 // 1. This is an Onset event14845 // 2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)14846 readonly spanId?: string;14847 // W3C trace flags from an upstream traceparent. Absent when no upstream14848 // sampling decision was made.14849 readonly traceFlags?: number;14850 }14851 interface TailEvent<Event extends EventType> {14852 // invocation id of the currently invoked worker stage.14853 // invocation id will always be unique to every Onset event and will be the same until the Outcome event.14854 readonly invocationId: string;14855 // Inherited spanContext for this event.14856 readonly spanContext: SpanContext;14857 readonly timestamp: Date;14858 readonly sequence: number;14859 readonly event: Event;14860 }14861 type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>;14862 type TailEventHandlerObject = {14863 outcome?: TailEventHandler<Outcome>;14864 spanOpen?: TailEventHandler<SpanOpen>;14865 spanClose?: TailEventHandler<SpanClose>;14866 diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;14867 exception?: TailEventHandler<Exception>;14868 log?: TailEventHandler<Log>;14869 return?: TailEventHandler<Return>;14870 attributes?: TailEventHandler<Attributes>;14871 };14872 type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;14873}14874// Copyright (c) 2022-2023 Cloudflare, Inc.14875// Licensed under the Apache 2.0 license found in the LICENSE file or at:14876// https://opensource.org/licenses/Apache-2.014877/**14878 * Data types supported for holding vector metadata.14879 */14880type VectorizeVectorMetadataValue = string | number | boolean | string[];14881/**14882 * Additional information to associate with a vector.14883 */14884type VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>;14885type VectorFloatArray = Float32Array | Float64Array;14886interface VectorizeError {14887 code?: number;14888 error: string;14889}14890/**14891 * Comparison logic/operation to use for metadata filtering.14892 *14893 * This list is expected to grow as support for more operations are released.14894 */14895type VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte';14896type VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin';14897/**14898 * Filter criteria for vector metadata used to limit the retrieved query result set.14899 */14900type VectorizeVectorMetadataFilter = {14901 [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | {14902 [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null;14903 } | {14904 [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[];14905 };14906};14907/**14908 * Supported distance metrics for an index.14909 * Distance metrics determine how other "similar" vectors are determined.14910 */14911type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";14912/**14913 * Metadata return levels for a Vectorize query.14914 *14915 * Default to "none".14916 *14917 * @property all Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.14918 * @property indexed Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).14919 * @property none No indexed metadata will be returned.14920 */14921type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";14922interface VectorizeQueryOptions {14923 topK?: number;14924 namespace?: string;14925 returnValues?: boolean;14926 returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;14927 filter?: VectorizeVectorMetadataFilter;14928}14929/**14930 * Information about the configuration of an index.14931 */14932type VectorizeIndexConfig = {14933 dimensions: number;14934 metric: VectorizeDistanceMetric;14935} | {14936 preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity14937};14938/**14939 * Metadata about an existing index.14940 *14941 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.14942 * See {@link VectorizeIndexInfo} for its post-beta equivalent.14943 */14944interface VectorizeIndexDetails {14945 /** The unique ID of the index */14946 readonly id: string;14947 /** The name of the index. */14948 name: string;14949 /** (optional) A human readable description for the index. */14950 description?: string;14951 /** The index configuration, including the dimension size and distance metric. */14952 config: VectorizeIndexConfig;14953 /** The number of records containing vectors within the index. */14954 vectorsCount: number;14955}14956/**14957 * Metadata about an existing index.14958 */14959interface VectorizeIndexInfo {14960 /** The number of records containing vectors within the index. */14961 vectorCount: number;14962 /** Number of dimensions the index has been configured for. */14963 dimensions: number;14964 /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */14965 processedUpToDatetime: number;14966 /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */14967 processedUpToMutation: number;14968}14969/**14970 * Represents a single vector value set along with its associated metadata.14971 */14972interface VectorizeVector {14973 /** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */14974 id: string;14975 /** The vector values */14976 values: VectorFloatArray | number[];14977 /** The namespace this vector belongs to. */14978 namespace?: string;14979 /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */14980 metadata?: Record<string, VectorizeVectorMetadata>;14981}14982/**14983 * Represents a matched vector for a query along with its score and (if specified) the matching vector information.14984 */14985type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> & Omit<VectorizeVector, "values"> & {14986 /** The score or rank for similarity, when returned as a result */14987 score: number;14988};14989/**14990 * A set of matching {@link VectorizeMatch} for a particular query.14991 */14992interface VectorizeMatches {14993 matches: VectorizeMatch[];14994 count: number;14995}14996/**14997 * Results of an operation that performed a mutation on a set of vectors.14998 * Here, `ids` is a list of vectors that were successfully processed.14999 *15000 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.15001 * See {@link VectorizeAsyncMutation} for its post-beta equivalent.15002 */15003interface VectorizeVectorMutation {15004 /* List of ids of vectors that were successfully processed. */15005 ids: string[];15006 /* Total count of the number of processed vectors. */15007 count: number;15008}15009/**15010 * Result type indicating a mutation on the Vectorize Index.15011 * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.15012 */15013interface VectorizeAsyncMutation {15014 /** The unique identifier for the async mutation operation containing the changeset. */15015 mutationId: string;15016}15017/**15018 * A Vectorize Vector Search Index for querying vectors/embeddings.15019 *15020 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.15021 * See {@link Vectorize} for its new implementation.15022 */15023declare abstract class VectorizeIndex {15024 /**15025 * Get information about the currently bound index.15026 * @returns A promise that resolves with information about the current index.15027 */15028 public describe(): Promise<VectorizeIndexDetails>;15029 /**15030 * Use the provided vector to perform a similarity search across the index.15031 * @param vector Input vector that will be used to drive the similarity search.15032 * @param options Configuration options to massage the returned data.15033 * @returns A promise that resolves with matched and scored vectors.15034 */15035 public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;15036 /**15037 * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.15038 * @param vectors List of vectors that will be inserted.15039 * @returns A promise that resolves with the ids & count of records that were successfully processed.15040 */15041 public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;15042 /**15043 * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.15044 * @param vectors List of vectors that will be upserted.15045 * @returns A promise that resolves with the ids & count of records that were successfully processed.15046 */15047 public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;15048 /**15049 * Delete a list of vectors with a matching id.15050 * @param ids List of vector ids that should be deleted.15051 * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).15052 */15053 public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;15054 /**15055 * Get a list of vectors with a matching id.15056 * @param ids List of vector ids that should be returned.15057 * @returns A promise that resolves with the raw unscored vectors matching the id set.15058 */15059 public getByIds(ids: string[]): Promise<VectorizeVector[]>;15060}15061/**15062 * A Vectorize Vector Search Index for querying vectors/embeddings.15063 *15064 * Mutations in this version are async, returning a mutation id.15065 */15066declare abstract class Vectorize {15067 /**15068 * Get information about the currently bound index.15069 * @returns A promise that resolves with information about the current index.15070 */15071 public describe(): Promise<VectorizeIndexInfo>;15072 /**15073 * Use the provided vector to perform a similarity search across the index.15074 * @param vector Input vector that will be used to drive the similarity search.15075 * @param options Configuration options to massage the returned data.15076 * @returns A promise that resolves with matched and scored vectors.15077 */15078 public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;15079 /**15080 * Use the provided vector-id to perform a similarity search across the index.15081 * @param vectorId Id for a vector in the index against which the index should be queried.15082 * @param options Configuration options to massage the returned data.15083 * @returns A promise that resolves with matched and scored vectors.15084 */15085 public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;15086 /**15087 * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.15088 * @param vectors List of vectors that will be inserted.15089 * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.15090 */15091 public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;15092 /**15093 * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.15094 * @param vectors List of vectors that will be upserted.15095 * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.15096 */15097 public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;15098 /**15099 * Delete a list of vectors with a matching id.15100 * @param ids List of vector ids that should be deleted.15101 * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.15102 */15103 public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;15104 /**15105 * Get a list of vectors with a matching id.15106 * @param ids List of vector ids that should be returned.15107 * @returns A promise that resolves with the raw unscored vectors matching the id set.15108 */15109 public getByIds(ids: string[]): Promise<VectorizeVector[]>;15110}15111/**15112 * The interface for "version_metadata" binding15113 * providing metadata about the Worker Version using this binding.15114 */15115type WorkerVersionMetadata = {15116 /** The ID of the Worker Version using this binding */15117 id: string;15118 /** The tag of the Worker Version using this binding */15119 tag: string;15120 /** The timestamp of when the Worker Version was uploaded */15121 timestamp: string;15122};15123// ============ Web Search Request Types ============15124/**15125 * Options for a Web Search query.15126 */15127type WebSearchSearchOptions = {15128 /** The search query. */15129 query: string;15130 /**15131 * Maximum number of results to return. Defaults to 10, capped at 20.15132 * The actual count may be lower if fewer matches exist.15133 */15134 limit?: number;15135};15136// ============ Web Search Response Types ============15137/**15138 * A single Web Search result.15139 *15140 * Web Search is discovery-only -- results carry catalog metadata about a page15141 * but never the page body. To read a result's content the caller invokes the15142 * global `fetch()` API against the result's `url`, at which point the15143 * destination's own access controls apply (including Cloudflare Pay-per-Crawl).15144 */15145type WebSearchResult = {15146 /** Canonical URL. */15147 url: string;15148 /** Page title. */15149 title: string;15150 /** Page-level description. May be absent. */15151 description?: string;15152 /**15153 * Last-modified date for the page, when known. Naive (no timezone)15154 * ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.15155 */15156 lastModifiedDate?: string;15157 /**15158 * Page meta image URL (typically the `og:image`). May be absent.15159 */15160 imageUrl?: string;15161 /** Optional favicon URL for UI hints. */15162 faviconUrl?: string;15163};15164/**15165 * Per-response metadata for a Web Search query. Carries operational15166 * fields useful for support and debugging.15167 */15168type WebSearchResponseMetadata = {15169 /** The query that was executed. */15170 query: string;15171 /** Opaque request identifier used for support and debugging. */15172 requestId: string;15173 /** End-to-end latency for this search request, in milliseconds. */15174 latencyMs: number;15175};15176/**15177 * Response from a Web Search query.15178 */15179type WebSearchSearchResponse = {15180 items: WebSearchResult[];15181 metadata: WebSearchResponseMetadata;15182};15183// ============ Web Search Binding Class ============15184/**15185 * Cloudflare Web Search binding.15186 *15187 * Discovery-only primitive for agents and Workers. Returns URLs and catalog15188 * metadata for a query; never returns page content or excerpts. To read a15189 * result's body, fetch the URL with the global `fetch()` API.15190 *15191 * Declared in wrangler with a single object (there is exactly one corpus, the15192 * public web, so there is no name, namespace, or instance to specify):15193 *15194 * ```jsonc15195 * { "web_search": { "binding": "WEBSEARCH" } }15196 * ```15197 *15198 * @example15199 * ```ts15200 * const { items, metadata } = await env.WEBSEARCH.search({15201 * query: "Cloudflare Workers",15202 * });15203 *15204 * const top = items[0];15205 * console.log(top.url, top.title, metadata.latencyMs);15206 *15207 * // Read content yourself; pay-per-crawl and other publisher15208 * // controls apply at the fetch site, not at search time.15209 * const page = await fetch(top.url);15210 * ```15211 */15212declare abstract class WebSearch {15213 /**15214 * Run a Web Search query.15215 * @param options Search options. Only `query` is required.15216 * @returns The matching results plus per-response metadata.15217 */15218 search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;15219}15220interface DynamicDispatchLimits {15221 /**15222 * Limit CPU time in milliseconds.15223 */15224 cpuMs?: number;15225 /**15226 * Limit number of subrequests.15227 */15228 subRequests?: number;15229}15230interface DynamicDispatchOptions {15231 /**15232 * Limit resources of invoked Worker script.15233 */15234 limits?: DynamicDispatchLimits;15235 /**15236 * Arguments for outbound Worker script, if configured.15237 */15238 outbound?: {15239 [key: string]: any;15240 };15241}15242interface DispatchNamespace {15243 /**15244 * @param name Name of the Worker script.15245 * @param args Arguments to Worker script.15246 * @param options Options for Dynamic Dispatch invocation.15247 * @returns A Fetcher object that allows you to send requests to the Worker script.15248 * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.15249 */15250 get(name: string, args?: {15251 [key: string]: any;15252 }, options?: DynamicDispatchOptions): Fetcher;15253}15254declare module 'cloudflare:workflows' {15255 /**15256 * NonRetryableError allows for a user to throw a fatal error15257 * that makes a Workflow instance fail immediately without triggering a retry15258 */15259 export class NonRetryableError extends Error {15260 public constructor(message: string, name?: string);15261 }15262}15263declare abstract class Workflow<PARAMS = unknown> {15264 /**15265 * Get a handle to an existing instance of the Workflow.15266 * @param id Id for the instance of this Workflow15267 * @returns A promise that resolves with a handle for the Instance15268 */15269 public get(id: string): Promise<WorkflowInstance>;15270 /**15271 * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.15272 * @param options Options when creating an instance including id and params15273 * @returns A promise that resolves with a handle for the Instance15274 */15275 public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>;15276 /**15277 * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.15278 * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.15279 * @param batch List of Options when creating an instance including name and params15280 * @returns A promise that resolves with a list of handles for the created instances.15281 */15282 public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;15283 /**15284 * Delete a batch of Workflow instances and their stored state.15285 * `deleteBatch` is limited to 100 instances at a time. Duplicate IDs are deleted once.15286 * The result contains one entry for each input position; IDs that do not exist are returned as per-instance errors.15287 * @param instanceIds IDs of the Workflow instances to delete15288 * @returns A promise that resolves with the successfully deleted instances and any per-instance errors.15289 */15290 public deleteBatch(instanceIds: string[]): Promise<WorkflowBatchDeleteResult>;15291}15292type WorkflowBatchDeleteResult = {15293 deleted: {15294 id: string;15295 }[];15296 errors: {15297 id: string;15298 code: number;15299 message: string;15300 }[];15301};15302type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';15303type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;15304type WorkflowRetentionDuration = WorkflowSleepDuration;15305/** Geographic regions supported when creating a Workflow instance.15306 * Location hints are best-effort placement preferences. */15307type WorkflowInstanceLocationHint = 'wnam' | 'enam' | 'sam' | 'weur' | 'eeur' | 'apac' | 'apac-ne' | 'apac-se' | 'oc' | 'afr' | 'me';15308interface WorkflowInstanceCreateOptions<PARAMS = unknown> {15309 /**15310 * An id for your Workflow instance. Must be unique within the Workflow.15311 */15312 id?: string;15313 /**15314 * The event payload the Workflow instance is triggered with15315 */15316 params?: PARAMS;15317 /**15318 * The retention policy for Workflow instance.15319 * Defaults to the maximum retention period available for the owner's account.15320 */15321 retention?: {15322 successRetention?: WorkflowRetentionDuration;15323 errorRetention?: WorkflowRetentionDuration;15324 };15325 /** A best-effort geographic placement preference for the Workflow instance.15326 * See `WorkflowInstanceLocationHint` for supported regions. */15327 locationHint?: WorkflowInstanceLocationHint;15328}15329type InstanceStatus = {15330 status: 'queued' // means that instance is waiting to be started (see concurrency limits)15331 | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running15332 | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish15333 | 'waitingForPause' // instance is finishing the current work to pause15334 | 'unknown';15335 error?: {15336 name: string;15337 message: string;15338 };15339 output?: unknown;15340};15341interface WorkflowError {15342 code?: number;15343 message: string;15344}15345interface WorkflowInstanceTerminateOptions {15346 /**15347 * If true, run registered rollback handlers before terminating the instance.15348 * Only steps that registered rollback handlers are rolled back.15349 */15350 rollback?: boolean;15351}15352interface WorkflowInstanceRestartOptions {15353 /**15354 * Restart from a specific step. If omitted, the instance restarts from the beginning.15355 * The step must exist in the instance's execution history.15356 */15357 from?: {15358 /**15359 * The step name as defined in your workflow code.15360 */15361 name: string;15362 /**15363 * 1-indexed occurrence of this step name. Use when the same step name appears multiple times (e.g. in a loop).15364 * @default 115365 */15366 count?: number;15367 /**15368 * Step type filter. Use when different step types share the same name.15369 */15370 type?: 'do' | 'sleep' | 'waitForEvent';15371 };15372}15373declare abstract class WorkflowInstance {15374 public id: string;15375 /**15376 * Pause the instance.15377 */15378 public pause(): Promise<void>;15379 /**15380 * Resume the instance. If it is already running, an error will be thrown.15381 */15382 public resume(): Promise<void>;15383 /**15384 * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.15385 * @param options Options for termination, including whether registered rollback handlers should run.15386 */15387 public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;15388 /**15389 * Restart the instance. Optionally restart from a specific step, preserving15390 * cached results for all steps before it.15391 * @param options Options for the restart, including an optional step to restart from.15392 */15393 public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;15394 /**15395 * Delete the instance and its stored state.15396 */15397 public delete(): Promise<void>;15398 /**15399 * Returns the current status of the instance.15400 */15401 public status(): Promise<InstanceStatus>;15402 /**15403 * Send an event to this instance.15404 */15405 public sendEvent({ type, payload, }: {15406 type: string;15407 payload: unknown;15408 }): Promise<void>;15409}