1/* eslint-disable */2// Generated by Wrangler by running `wrangler types` (hash: 68f3b880cc9406b46cec917794c0d592)3// Runtime types generated with workerd@1.20260820.1 2026-08-20 nodejs_compat4interface __BaseEnv_Env {5 CONTENT: R2Bucket;6 DB: D1Database;7}8declare namespace Cloudflare {9 interface GlobalProps {10 mainModule: typeof import("./src/index");11 }12 interface Env extends __BaseEnv_Env {}13}14interface Env extends __BaseEnv_Env {}1516// Begin runtime types17/*! *****************************************************************************18Copyright (c) Cloudflare. All rights reserved.19Copyright (c) Microsoft Corporation. All rights reserved.2021Licensed under the Apache License, Version 2.0 (the "License"); you may not use22this file except in compliance with the License. You may obtain a copy of the23License at http://www.apache.org/licenses/LICENSE-2.024THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY25KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED26WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,27MERCHANTABLITY OR NON-INFRINGEMENT.28See the Apache Version 2.0 License for specific language governing permissions29and limitations under the License.30***************************************************************************** */31/* eslint-disable */32// noinspection JSUnusedGlobalSymbols33declare var onmessage: never;34/**35 * 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.36 *37 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)38 */39declare class DOMException extends Error {40 constructor(message?: string, name?: string);41 /**42 * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.43 *44 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)45 */46 readonly message: string;47 /**48 * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.49 *50 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)51 */52 readonly name: string;53 /**54 * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.55 * @deprecated56 *57 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)58 */59 readonly code: number;60 static readonly INDEX_SIZE_ERR: number;61 static readonly DOMSTRING_SIZE_ERR: number;62 static readonly HIERARCHY_REQUEST_ERR: number;63 static readonly WRONG_DOCUMENT_ERR: number;64 static readonly INVALID_CHARACTER_ERR: number;65 static readonly NO_DATA_ALLOWED_ERR: number;66 static readonly NO_MODIFICATION_ALLOWED_ERR: number;67 static readonly NOT_FOUND_ERR: number;68 static readonly NOT_SUPPORTED_ERR: number;69 static readonly INUSE_ATTRIBUTE_ERR: number;70 static readonly INVALID_STATE_ERR: number;71 static readonly SYNTAX_ERR: number;72 static readonly INVALID_MODIFICATION_ERR: number;73 static readonly NAMESPACE_ERR: number;74 static readonly INVALID_ACCESS_ERR: number;75 static readonly VALIDATION_ERR: number;76 static readonly TYPE_MISMATCH_ERR: number;77 static readonly SECURITY_ERR: number;78 static readonly NETWORK_ERR: number;79 static readonly ABORT_ERR: number;80 static readonly URL_MISMATCH_ERR: number;81 static readonly QUOTA_EXCEEDED_ERR: number;82 static readonly TIMEOUT_ERR: number;83 static readonly INVALID_NODE_TYPE_ERR: number;84 static readonly DATA_CLONE_ERR: number;85 get stack(): any;86 set stack(value: any);87}88type WorkerGlobalScopeEventMap = {89 fetch: FetchEvent;90 scheduled: ScheduledEvent;91 queue: QueueEvent;92 unhandledrejection: PromiseRejectionEvent;93 rejectionhandled: PromiseRejectionEvent;94};95declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {96 EventTarget: typeof EventTarget;97}98/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *99 * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).100 *101 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)102 */103interface Console {104 "assert"(condition?: boolean, ...data: any[]): void;105 /**106 * The **`console.clear()`** static method clears the console if possible.107 *108 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)109 */110 clear(): void;111 /**112 * The **`console.count()`** static method logs the number of times that this particular call to count() has been called.113 *114 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)115 */116 count(label?: string): void;117 /**118 * The **`console.countReset()`** static method resets counter used with console.count().119 *120 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)121 */122 countReset(label?: string): void;123 /**124 * 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.125 *126 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)127 */128 debug(...data: any[]): void;129 /**130 * 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.131 *132 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)133 */134 dir(item?: any, options?: any): void;135 /**136 * 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.137 *138 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)139 */140 dirxml(...data: any[]): void;141 /**142 * 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.143 *144 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)145 */146 error(...data: any[]): void;147 /**148 * 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.149 *150 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)151 */152 group(...data: any[]): void;153 /**154 * 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.155 *156 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)157 */158 groupCollapsed(...data: any[]): void;159 /**160 * 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.161 *162 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)163 */164 groupEnd(): void;165 /**166 * 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.167 *168 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)169 */170 info(...data: any[]): void;171 /**172 * The **`console.log()`** static method outputs a message to the console.173 *174 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)175 */176 log(...data: any[]): void;177 /**178 * The **`console.table()`** static method displays tabular data as a table.179 *180 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)181 */182 table(tabularData?: any, properties?: string[]): void;183 /**184 * 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.185 *186 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)187 */188 time(label?: string): void;189 /**190 * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time().191 *192 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)193 */194 timeEnd(label?: string): void;195 /**196 * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time().197 *198 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)199 */200 timeLog(label?: string, ...data: any[]): void;201 /* 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. */202 timeStamp(label?: string): void;203 /**204 * The **`console.trace()`** static method outputs a stack trace to the console.205 *206 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)207 */208 trace(...data: any[]): void;209 /**210 * 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.211 *212 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)213 */214 warn(...data: any[]): void;215}216declare const console: Console;217type BufferSource = ArrayBufferView | ArrayBuffer;218type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;219declare namespace WebAssembly {220 class CompileError extends Error {221 constructor(message?: string);222 }223 class RuntimeError extends Error {224 constructor(message?: string);225 }226 type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128";227 interface GlobalDescriptor {228 value: ValueType;229 mutable?: boolean;230 }231 class Global {232 constructor(descriptor: GlobalDescriptor, value?: any);233 value: any;234 valueOf(): any;235 }236 type ImportValue = ExportValue | number;237 type ModuleImports = Record<string, ImportValue>;238 type Imports = Record<string, ModuleImports>;239 type ExportValue = Function | Global | Memory | Table;240 type Exports = Record<string, ExportValue>;241 class Instance {242 constructor(module: Module, imports?: Imports);243 readonly exports: Exports;244 }245 interface MemoryDescriptor {246 initial: number;247 maximum?: number;248 shared?: boolean;249 }250 class Memory {251 constructor(descriptor: MemoryDescriptor);252 readonly buffer: ArrayBuffer;253 grow(delta: number): number;254 }255 type ImportExportKind = "function" | "global" | "memory" | "table";256 interface ModuleExportDescriptor {257 kind: ImportExportKind;258 name: string;259 }260 interface ModuleImportDescriptor {261 kind: ImportExportKind;262 module: string;263 name: string;264 }265 abstract class Module {266 static customSections(module: Module, sectionName: string): ArrayBuffer[];267 static exports(module: Module): ModuleExportDescriptor[];268 static imports(module: Module): ModuleImportDescriptor[];269 }270 type TableKind = "anyfunc" | "externref";271 interface TableDescriptor {272 element: TableKind;273 initial: number;274 maximum?: number;275 }276 class Table {277 constructor(descriptor: TableDescriptor, value?: any);278 readonly length: number;279 get(index: number): any;280 grow(delta: number, value?: any): number;281 set(index: number, value?: any): void;282 }283 function instantiate(module: Module, imports?: Imports): Promise<Instance>;284 function validate(bytes: BufferSource): boolean;285}286/**287 * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.288 * Available only in secure contexts.289 *290 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)291 */292interface ServiceWorkerGlobalScope extends WorkerGlobalScope {293 DOMException: typeof DOMException;294 WorkerGlobalScope: typeof WorkerGlobalScope;295 btoa(data: string): string;296 atob(data: string): string;297 setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;298 setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;299 clearTimeout(timeoutId: number | null): void;300 setInterval(callback: (...args: any[]) => void, msDelay?: number): number;301 setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;302 clearInterval(timeoutId: number | null): void;303 queueMicrotask(task: Function): void;304 structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;305 reportError(error: any): void;306 fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;307 self: ServiceWorkerGlobalScope;308 crypto: Crypto;309 caches: CacheStorage;310 scheduler: Scheduler;311 performance: Performance;312 Cloudflare: Cloudflare;313 readonly origin: string;314 Event: typeof Event;315 ExtendableEvent: typeof ExtendableEvent;316 CustomEvent: typeof CustomEvent;317 PromiseRejectionEvent: typeof PromiseRejectionEvent;318 FetchEvent: typeof FetchEvent;319 TailEvent: typeof TailEvent;320 TraceEvent: typeof TailEvent;321 ScheduledEvent: typeof ScheduledEvent;322 MessageEvent: typeof MessageEvent;323 CloseEvent: typeof CloseEvent;324 ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;325 ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;326 ReadableStream: typeof ReadableStream;327 WritableStream: typeof WritableStream;328 WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;329 TransformStream: typeof TransformStream;330 ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;331 CountQueuingStrategy: typeof CountQueuingStrategy;332 ErrorEvent: typeof ErrorEvent;333 MessageChannel: typeof MessageChannel;334 MessagePort: typeof MessagePort;335 EventSource: typeof EventSource;336 ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;337 ReadableStreamDefaultController: typeof ReadableStreamDefaultController;338 ReadableByteStreamController: typeof ReadableByteStreamController;339 WritableStreamDefaultController: typeof WritableStreamDefaultController;340 TransformStreamDefaultController: typeof TransformStreamDefaultController;341 CompressionStream: typeof CompressionStream;342 DecompressionStream: typeof DecompressionStream;343 TextEncoderStream: typeof TextEncoderStream;344 TextDecoderStream: typeof TextDecoderStream;345 Headers: typeof Headers;346 Body: typeof Body;347 Request: typeof Request;348 Response: typeof Response;349 WebSocket: typeof WebSocket;350 WebSocketPair: typeof WebSocketPair;351 WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;352 AbortController: typeof AbortController;353 AbortSignal: typeof AbortSignal;354 TextDecoder: typeof TextDecoder;355 TextEncoder: typeof TextEncoder;356 navigator: Navigator;357 Navigator: typeof Navigator;358 URL: typeof URL;359 URLSearchParams: typeof URLSearchParams;360 URLPattern: typeof URLPattern;361 Blob: typeof Blob;362 File: typeof File;363 FormData: typeof FormData;364 Crypto: typeof Crypto;365 SubtleCrypto: typeof SubtleCrypto;366 CryptoKey: typeof CryptoKey;367 CacheStorage: typeof CacheStorage;368 Cache: typeof Cache;369 FixedLengthStream: typeof FixedLengthStream;370 IdentityTransformStream: typeof IdentityTransformStream;371 HTMLRewriter: typeof HTMLRewriter;372}373declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;374declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;375/**376 * 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().377 *378 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)379 */380declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;381/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */382declare function btoa(data: string): string;383/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */384declare function atob(data: string): string;385/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */386declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;387/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */388declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;389/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */390declare function clearTimeout(timeoutId: number | null): void;391/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */392declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;393/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */394declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;395/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */396declare function clearInterval(timeoutId: number | null): void;397/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */398declare function queueMicrotask(task: Function): void;399/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */400declare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;401/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */402declare function reportError(error: any): void;403/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */404declare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;405declare const self: ServiceWorkerGlobalScope;406/**407* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.408* The Workers runtime implements the full surface of this API, but with some differences in409* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)410* compared to those implemented in most browsers.411*412* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)413*/414declare const crypto: Crypto;415/**416* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.417*418* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)419*/420declare const caches: CacheStorage;421/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scheduler) */422declare const scheduler: Scheduler;423/**424* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,425* as well as timing of subrequests and other operations.426*427* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)428*/429declare const performance: Performance;430declare const Cloudflare: Cloudflare;431declare const origin: string;432declare const navigator: Navigator;433interface TestController {434}435interface ExecutionContext<Props = unknown> {436 waitUntil(promise: Promise<any>): void;437 passThroughOnException(): void;438 readonly exports: Cloudflare.Exports;439 readonly props: Props;440 cache?: CacheContext;441 readonly access?: CloudflareAccessContext;442 tracing: Tracing;443 abort(reason?: any): void;444}445type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;446type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;447type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;448type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;449type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;450type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;451type ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;452type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;453interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {454 fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;455 connect?: ExportedHandlerConnectHandler<Env, Props>;456 tail?: ExportedHandlerTailHandler<Env, Props>;457 trace?: ExportedHandlerTraceHandler<Env, Props>;458 tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;459 scheduled?: ExportedHandlerScheduledHandler<Env, Props>;460 test?: ExportedHandlerTestHandler<Env, Props>;461 email?: EmailExportedHandler<Env, Props>;462 queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;463}464interface StructuredSerializeOptions {465 transfer?: any[];466}467declare abstract class Navigator {468 sendBeacon(url: string, body?: BodyInit): boolean;469 readonly userAgent: string;470 readonly hardwareConcurrency: number;471 readonly platform: string;472 readonly language: string;473 readonly languages: string[];474}475interface AlarmInvocationInfo {476 readonly isRetry: boolean;477 readonly retryCount: number;478 readonly scheduledTime: number;479}480interface Cloudflare {481 readonly compatibilityFlags: Record<string, boolean>;482}483interface CachePurgeError {484 code: number;485 message: string;486}487interface CachePurgeResult {488 success: boolean;489 errors: CachePurgeError[];490}491interface CachePurgeOptions {492 tags?: string[];493 pathPrefixes?: string[];494 purgeEverything?: boolean;495}496interface CacheContext {497 purge(options: CachePurgeOptions): Promise<CachePurgeResult>;498}499interface CloudflareAccessContext {500 readonly aud: string;501 getIdentity(): Promise<CloudflareAccessIdentity | undefined>;502}503declare abstract class ColoLocalActorNamespace {504 get(actorId: string): Fetcher;505}506interface DurableObject {507 fetch(request: Request): Response | Promise<Response>;508 connect?(socket: Socket): void | Promise<void>;509 alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;510 webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;511 webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;512 webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;513}514type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"> & {515 readonly id: DurableObjectId;516 readonly name?: string;517};518interface DurableObjectId {519 toString(): string;520 equals(other: DurableObjectId): boolean;521 readonly name?: string;522 readonly jurisdiction?: string;523}524declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {525 newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;526 idFromName(name: string): DurableObjectId;527 idFromString(id: string): DurableObjectId;528 get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;529 getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;530 jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;531}532type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";533interface DurableObjectNamespaceNewUniqueIdOptions {534 jurisdiction?: DurableObjectJurisdiction;535}536type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "apac-ne" | "apac-se" | "oc" | "afr" | "me";537type DurableObjectRoutingMode = "primary-only";538interface DurableObjectNamespaceGetDurableObjectOptions {539 locationHint?: DurableObjectLocationHint;540 routingMode?: DurableObjectRoutingMode;541}542interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {543}544interface DurableObjectState<Props = unknown> {545 waitUntil(promise: Promise<any>): void;546 readonly exports: Cloudflare.Exports;547 readonly props: Props;548 readonly id: DurableObjectId;549 readonly storage: DurableObjectStorage;550 container?: Container;551 facets: DurableObjectFacets;552 blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;553 acceptWebSocket(ws: WebSocket, tags?: string[]): void;554 getWebSockets(tag?: string): WebSocket[];555 setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;556 getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;557 getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;558 setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;559 getHibernatableWebSocketEventTimeout(): number | null;560 getTags(ws: WebSocket): string[];561 abort(reason?: string): void;562}563interface DurableObjectTransaction {564 get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;565 get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;566 list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;567 put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;568 put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;569 delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;570 delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;571 rollback(): void;572 getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;573 setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;574 deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;575}576interface DurableObjectStorage {577 get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;578 get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;579 list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;580 put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;581 put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;582 delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;583 delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;584 deleteAll(options?: DurableObjectPutOptions): Promise<void>;585 transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;586 getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;587 setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;588 deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;589 sync(): Promise<void>;590 sql: SqlStorage;591 kv: SyncKvStorage;592 transactionSync<T>(closure: () => T): T;593 getCurrentBookmark(): Promise<string>;594 getBookmarkForTime(timestamp: number | Date): Promise<string>;595 onNextSessionRestoreBookmark(bookmark: string): Promise<string>;596}597interface DurableObjectListOptions {598 start?: string;599 startAfter?: string;600 end?: string;601 prefix?: string;602 reverse?: boolean;603 limit?: number;604 allowConcurrency?: boolean;605 noCache?: boolean;606}607interface DurableObjectGetOptions {608 allowConcurrency?: boolean;609 noCache?: boolean;610}611interface DurableObjectGetAlarmOptions {612 allowConcurrency?: boolean;613}614interface DurableObjectPutOptions {615 allowConcurrency?: boolean;616 allowUnconfirmed?: boolean;617 noCache?: boolean;618}619interface DurableObjectSetAlarmOptions {620 allowConcurrency?: boolean;621 allowUnconfirmed?: boolean;622}623declare class WebSocketRequestResponsePair {624 constructor(request: string, response: string);625 get request(): string;626 get response(): string;627}628interface DurableObjectFacets {629 get<T extends Rpc.DurableObjectBranded | undefined = undefined>(name: string, getStartupOptions: () => FacetStartupOptions<T> | Promise<FacetStartupOptions<T>>): Fetcher<T>;630 abort(name: string, reason: any): void;631 delete(name: string): void;632 clone(src: string, dst: string): void;633}634interface FacetStartupOptions<T extends Rpc.DurableObjectBranded | undefined = undefined> {635 id?: DurableObjectId | string;636 class: DurableObjectClass<T>;637}638interface AnalyticsEngineDataset {639 writeDataPoint(event?: AnalyticsEngineDataPoint): void;640}641interface AnalyticsEngineDataPoint {642 indexes?: ((ArrayBuffer | string) | null)[];643 doubles?: number[];644 blobs?: ((ArrayBuffer | string) | null)[];645}646/**647 * The **`Event`** interface represents an event which takes place on an EventTarget.648 *649 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)650 */651declare class Event {652 constructor(type: string, init?: EventInit);653 /**654 * 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.655 *656 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)657 */658 get type(): string;659 /**660 * The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.661 *662 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)663 */664 get eventPhase(): number;665 /**666 * 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.667 *668 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)669 */670 get composed(): boolean;671 /**672 * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.673 *674 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)675 */676 get bubbles(): boolean;677 /**678 * 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.679 *680 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)681 */682 get cancelable(): boolean;683 /**684 * 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.685 *686 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)687 */688 get defaultPrevented(): boolean;689 /**690 * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.691 * @deprecated692 *693 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)694 */695 get returnValue(): boolean;696 /**697 * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.698 *699 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)700 */701 get currentTarget(): EventTarget | undefined;702 /**703 * 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.704 *705 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)706 */707 get target(): EventTarget | undefined;708 /**709 * The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.710 * @deprecated711 *712 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)713 */714 get srcElement(): EventTarget | undefined;715 /**716 * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.717 *718 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)719 */720 get timeStamp(): number;721 /**722 * 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.723 *724 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)725 */726 get isTrusted(): boolean;727 /**728 * 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.729 * @deprecated730 *731 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)732 */733 get cancelBubble(): boolean;734 /**735 * 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.736 * @deprecated737 *738 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)739 */740 set cancelBubble(value: boolean);741 /**742 * The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.743 *744 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)745 */746 stopImmediatePropagation(): void;747 /**748 * 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.749 *750 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)751 */752 preventDefault(): void;753 /**754 * 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().755 *756 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)757 */758 stopPropagation(): void;759 /**760 * 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.761 *762 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)763 */764 composedPath(): EventTarget[];765 static readonly NONE: number;766 static readonly CAPTURING_PHASE: number;767 static readonly AT_TARGET: number;768 static readonly BUBBLING_PHASE: number;769}770interface EventInit {771 bubbles?: boolean;772 cancelable?: boolean;773 composed?: boolean;774}775type EventListener<EventType extends Event = Event> = (event: EventType) => void;776interface EventListenerObject<EventType extends Event = Event> {777 handleEvent(event: EventType): void;778}779type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;780/**781 * 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.782 *783 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)784 */785declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {786 constructor();787 /**788 * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.789 *790 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)791 */792 addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;793 /**794 * 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.795 *796 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)797 */798 removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;799 /**800 * 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().801 *802 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)803 */804 dispatchEvent(event: EventMap[keyof EventMap]): boolean;805}806interface EventTargetEventListenerOptions {807 capture?: boolean;808}809interface EventTargetAddEventListenerOptions {810 capture?: boolean;811 passive?: boolean;812 once?: boolean;813 signal?: AbortSignal;814}815interface EventTargetHandlerObject {816 handleEvent: (event: Event) => any | undefined;817}818/**819 * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.820 *821 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)822 */823declare class AbortController {824 constructor();825 /**826 * 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.827 *828 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)829 */830 get signal(): AbortSignal;831 /**832 * 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.833 *834 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)835 */836 abort(reason?: any): void;837}838/**839 * 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.840 *841 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)842 */843declare abstract class AbortSignal extends EventTarget {844 /**845 * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an abort event).846 *847 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)848 */849 static abort(reason?: any): AbortSignal;850 /**851 * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.852 *853 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)854 */855 static timeout(delay: number): AbortSignal;856 /**857 * 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.858 *859 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)860 */861 static any(signals: AbortSignal[]): AbortSignal;862 /**863 * 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).864 *865 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)866 */867 get aborted(): boolean;868 /**869 * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.870 *871 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)872 */873 get reason(): any;874 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */875 get onabort(): any | null;876 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */877 set onabort(value: any | null);878 /**879 * The **`throwIfAborted()`** method throws the signal's abort reason if the signal has been aborted; otherwise it does nothing.880 *881 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)882 */883 throwIfAborted(): void;884}885/**886 * The **`Scheduler`** interface of the Prioritized Task Scheduling API provides methods for scheduling prioritized tasks.887 *888 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Scheduler)889 */890interface Scheduler {891 wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;892}893interface SchedulerWaitOptions {894 signal?: AbortSignal;895}896/**897 * 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.898 *899 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)900 */901declare abstract class ExtendableEvent extends Event {902 /**903 * 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.904 *905 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)906 */907 waitUntil(promise: Promise<any>): void;908}909/**910 * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.911 *912 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)913 */914declare class CustomEvent<T = any> extends Event {915 constructor(type: string, init?: CustomEventCustomEventInit);916 /**917 * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.918 *919 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)920 */921 get detail(): T;922}923interface CustomEventCustomEventInit {924 bubbles?: boolean;925 cancelable?: boolean;926 composed?: boolean;927 detail?: any;928}929/**930 * 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.931 *932 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)933 */934declare class Blob {935 constructor(bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);936 /**937 * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.938 *939 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)940 */941 get size(): number;942 /**943 * The **`type`** read-only property of the Blob interface returns the MIME type of the file.944 *945 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)946 */947 get type(): string;948 /**949 * 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.950 *951 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)952 */953 slice(start?: number, end?: number, type?: string): Blob;954 /**955 * 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.956 *957 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)958 */959 arrayBuffer(): Promise<ArrayBuffer>;960 /**961 * 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.962 *963 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)964 */965 bytes(): Promise<Uint8Array>;966 /**967 * 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.968 *969 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)970 */971 text(): Promise<string>;972 /**973 * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob.974 *975 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)976 */977 stream(): ReadableStream;978}979interface BlobOptions {980 type?: string;981}982/**983 * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.984 *985 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)986 */987declare class File extends Blob {988 constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);989 /**990 * 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.991 *992 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)993 */994 get name(): string;995 /**996 * 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.997 *998 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)999 */1000 get lastModified(): number;1001}1002interface FileOptions {1003 type?: string;1004 lastModified?: number;1005}1006/**1007* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.1008*1009* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)1010*/1011declare abstract class CacheStorage {1012 /**1013 * The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.1014 *1015 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)1016 */1017 open(cacheName: string): Promise<Cache>;1018 readonly default: Cache;1019}1020/**1021* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.1022*1023* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)1024*/1025declare abstract class Cache {1026 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */1027 delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;1028 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */1029 match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;1030 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */1031 put(request: RequestInfo | URL, response: Response): Promise<void>;1032}1033interface CacheQueryOptions {1034 ignoreMethod?: boolean;1035}1036/**1037* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.1038* The Workers runtime implements the full surface of this API, but with some differences in1039* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)1040* compared to those implemented in most browsers.1041*1042* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)1043*/1044declare abstract class Crypto {1045 /**1046 * The **`Crypto.subtle`** read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations.1047 * Available only in secure contexts.1048 *1049 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)1050 */1051 get subtle(): SubtleCrypto;1052 /**1053 * 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).1054 *1055 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)1056 */1057 getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;1058 /**1059 * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.1060 * Available only in secure contexts.1061 *1062 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)1063 */1064 randomUUID(): string;1065 DigestStream: typeof DigestStream;1066}1067/**1068 * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.1069 * Available only in secure contexts.1070 *1071 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)1072 */1073declare abstract class SubtleCrypto {1074 /**1075 * The **`encrypt()`** method of the SubtleCrypto interface encrypts data.1076 *1077 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)1078 */1079 encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1080 /**1081 * 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").1082 *1083 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)1084 */1085 decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1086 /**1087 * The **`sign()`** method of the SubtleCrypto interface generates a digital signature.1088 *1089 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)1090 */1091 sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1092 /**1093 * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.1094 *1095 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)1096 */1097 verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;1098 /**1099 * 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.1100 *1101 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)1102 */1103 digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;1104 /**1105 * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).1106 *1107 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)1108 */1109 generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;1110 /**1111 * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.1112 *1113 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)1114 */1115 deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;1116 /**1117 * The **`deriveBits()`** method of the SubtleCrypto interface can be used to derive an array of bits from a base key.1118 *1119 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)1120 */1121 deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;1122 /**1123 * 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.1124 *1125 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)1126 */1127 importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;1128 /**1129 * 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.1130 *1131 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)1132 */1133 exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;1134 /**1135 * 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.1136 *1137 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)1138 */1139 wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;1140 /**1141 * 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.1142 *1143 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)1144 */1145 unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;1146 timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;1147}1148/**1149 * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods generateKey(), deriveKey(), importKey(), or unwrapKey().1150 * Available only in secure contexts.1151 *1152 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)1153 */1154declare abstract class CryptoKey {1155 /**1156 * 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:1157 *1158 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)1159 */1160 readonly type: string;1161 /**1162 * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using SubtleCrypto.exportKey() or SubtleCrypto.wrapKey().1163 *1164 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)1165 */1166 readonly extractable: boolean;1167 /**1168 * 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.1169 *1170 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)1171 */1172 readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;1173 /**1174 * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.1175 *1176 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)1177 */1178 readonly usages: string[];1179}1180interface CryptoKeyPair {1181 publicKey: CryptoKey;1182 privateKey: CryptoKey;1183}1184interface JsonWebKey {1185 kty: string;1186 use?: string;1187 key_ops?: string[];1188 alg?: string;1189 ext?: boolean;1190 crv?: string;1191 x?: string;1192 y?: string;1193 d?: string;1194 n?: string;1195 e?: string;1196 p?: string;1197 q?: string;1198 dp?: string;1199 dq?: string;1200 qi?: string;1201 oth?: RsaOtherPrimesInfo[];1202 k?: string;1203}1204interface RsaOtherPrimesInfo {1205 r?: string;1206 d?: string;1207 t?: string;1208}1209interface SubtleCryptoDeriveKeyAlgorithm {1210 name: string;1211 salt?: (ArrayBuffer | ArrayBufferView);1212 iterations?: number;1213 hash?: (string | SubtleCryptoHashAlgorithm);1214 $public?: CryptoKey;1215 info?: (ArrayBuffer | ArrayBufferView);1216}1217interface SubtleCryptoEncryptAlgorithm {1218 name: string;1219 iv?: (ArrayBuffer | ArrayBufferView);1220 additionalData?: (ArrayBuffer | ArrayBufferView);1221 tagLength?: number;1222 counter?: (ArrayBuffer | ArrayBufferView);1223 length?: number;1224 label?: (ArrayBuffer | ArrayBufferView);1225}1226interface SubtleCryptoGenerateKeyAlgorithm {1227 name: string;1228 hash?: (string | SubtleCryptoHashAlgorithm);1229 modulusLength?: number;1230 publicExponent?: (ArrayBuffer | ArrayBufferView);1231 length?: number;1232 namedCurve?: string;1233}1234interface SubtleCryptoHashAlgorithm {1235 name: string;1236}1237interface SubtleCryptoImportKeyAlgorithm {1238 name: string;1239 hash?: (string | SubtleCryptoHashAlgorithm);1240 length?: number;1241 namedCurve?: string;1242 compressed?: boolean;1243}1244interface SubtleCryptoSignAlgorithm {1245 name: string;1246 hash?: (string | SubtleCryptoHashAlgorithm);1247 dataLength?: number;1248 saltLength?: number;1249}1250interface CryptoKeyKeyAlgorithm {1251 name: string;1252}1253interface CryptoKeyAesKeyAlgorithm {1254 name: string;1255 length: number;1256}1257interface CryptoKeyHmacKeyAlgorithm {1258 name: string;1259 hash: CryptoKeyKeyAlgorithm;1260 length: number;1261}1262interface CryptoKeyRsaKeyAlgorithm {1263 name: string;1264 modulusLength: number;1265 publicExponent: ArrayBuffer | ArrayBufferView;1266 hash?: CryptoKeyKeyAlgorithm;1267}1268interface CryptoKeyEllipticKeyAlgorithm {1269 name: string;1270 namedCurve: string;1271}1272interface CryptoKeyArbitraryKeyAlgorithm {1273 name: string;1274 hash?: CryptoKeyKeyAlgorithm;1275 namedCurve?: string;1276 length?: number;1277}1278declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {1279 constructor(algorithm: string | SubtleCryptoHashAlgorithm);1280 readonly digest: Promise<ArrayBuffer>;1281 get bytesWritten(): number | bigint;1282}1283/**1284 * 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.1285 *1286 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)1287 */1288declare class TextDecoder {1289 constructor(label?: string, options?: TextDecoderConstructorOptions);1290 /**1291 * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.1292 *1293 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)1294 */1295 decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string;1296 get encoding(): string;1297 get fatal(): boolean;1298 get ignoreBOM(): boolean;1299}1300/**1301 * The **`TextEncoder`** interface enables you to encode a JavaScript string using UTF-8.1302 *1303 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)1304 */1305declare class TextEncoder {1306 constructor();1307 /**1308 * The **`TextEncoder.encode()`** method takes a string as input, and returns a Uint8Array containing the string encoded using UTF-8.1309 *1310 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)1311 */1312 encode(input?: string): Uint8Array;1313 /**1314 * 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.1315 *1316 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)1317 */1318 encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;1319 get encoding(): string;1320}1321interface TextDecoderConstructorOptions {1322 fatal: boolean;1323 ignoreBOM: boolean;1324}1325interface TextDecoderDecodeOptions {1326 stream: boolean;1327}1328interface TextEncoderEncodeIntoResult {1329 read: number;1330 written: number;1331}1332/**1333 * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.1334 *1335 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)1336 */1337declare class ErrorEvent extends Event {1338 constructor(type: string, init?: ErrorEventErrorEventInit);1339 /**1340 * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.1341 *1342 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)1343 */1344 get filename(): string;1345 /**1346 * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.1347 *1348 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)1349 */1350 get message(): string;1351 /**1352 * 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.1353 *1354 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)1355 */1356 get lineno(): number;1357 /**1358 * 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.1359 *1360 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)1361 */1362 get colno(): number;1363 /**1364 * 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.1365 *1366 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)1367 */1368 get error(): any;1369}1370interface ErrorEventErrorEventInit {1371 message?: string;1372 filename?: string;1373 lineno?: number;1374 colno?: number;1375 error?: any;1376}1377/**1378 * The **`MessageEvent`** interface represents a message received by a target object.1379 *1380 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)1381 */1382declare class MessageEvent extends Event {1383 constructor(type: string, initializer: MessageEventInit);1384 /**1385 * The **`data`** read-only property of the MessageEvent interface represents the data sent by the message emitter.1386 *1387 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)1388 */1389 readonly data: any;1390 /**1391 * The **`origin`** read-only property of the MessageEvent interface is a string representing the origin of the message emitter.1392 *1393 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)1394 */1395 readonly origin: string | null;1396 /**1397 * The **`lastEventId`** read-only property of the MessageEvent interface is a string representing a unique ID for the event.1398 *1399 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)1400 */1401 readonly lastEventId: string;1402 /**1403 * 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.1404 *1405 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)1406 */1407 readonly source: MessagePort | null;1408 /**1409 * 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.1410 *1411 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)1412 */1413 readonly ports: MessagePort[];1414}1415interface MessageEventInit {1416 data: ArrayBuffer | string;1417}1418/**1419 * 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.1420 *1421 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)1422 */1423declare abstract class PromiseRejectionEvent extends Event {1424 /**1425 * 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.1426 *1427 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)1428 */1429 readonly promise: Promise<any>;1430 /**1431 * 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.1432 *1433 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)1434 */1435 readonly reason: any;1436}1437/**1438 * 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".1439 *1440 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)1441 */1442declare class FormData {1443 constructor();1444 /**1445 * 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.1446 *1447 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)1448 */1449 append(name: string, value: string | Blob): void;1450 /**1451 * 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.1452 *1453 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)1454 */1455 append(name: string, value: string): void;1456 /**1457 * 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.1458 *1459 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)1460 */1461 append(name: string, value: Blob, filename?: string): void;1462 /**1463 * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a FormData object.1464 *1465 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)1466 */1467 delete(name: string): void;1468 /**1469 * 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.1470 *1471 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)1472 */1473 get(name: string): (File | string) | null;1474 /**1475 * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a FormData object.1476 *1477 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)1478 */1479 getAll(name: string): (File | string)[];1480 /**1481 * The **`has()`** method of the FormData interface returns whether a FormData object contains a certain key.1482 *1483 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)1484 */1485 has(name: string): boolean;1486 /**1487 * 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.1488 *1489 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)1490 */1491 set(name: string, value: string | Blob): void;1492 /**1493 * 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.1494 *1495 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)1496 */1497 set(name: string, value: string): void;1498 /**1499 * 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.1500 *1501 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)1502 */1503 set(name: string, value: Blob, filename?: string): void;1504 entries(): IterableIterator<[1505 key: string,1506 value: File | string1507 ]>;1508 keys(): IterableIterator<string>;1509 values(): IterableIterator<(File | string)>;1510 forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;1511 [Symbol.iterator](): IterableIterator<[1512 key: string,1513 value: File | string1514 ]>;1515}1516interface ContentOptions {1517 html?: boolean;1518}1519declare class HTMLRewriter {1520 constructor();1521 on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;1522 onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;1523 transform(response: Response): Response;1524}1525interface HTMLRewriterElementContentHandlers {1526 element?(element: Element): void | Promise<void>;1527 comments?(comment: Comment): void | Promise<void>;1528 text?(element: Text): void | Promise<void>;1529}1530interface HTMLRewriterDocumentContentHandlers {1531 doctype?(doctype: Doctype): void | Promise<void>;1532 comments?(comment: Comment): void | Promise<void>;1533 text?(text: Text): void | Promise<void>;1534 end?(end: DocumentEnd): void | Promise<void>;1535}1536interface Doctype {1537 readonly name: string | null;1538 readonly publicId: string | null;1539 readonly systemId: string | null;1540}1541interface Element {1542 tagName: string;1543 readonly attributes: IterableIterator<string[]>;1544 readonly removed: boolean;1545 readonly namespaceURI: string;1546 getAttribute(name: string): string | null;1547 hasAttribute(name: string): boolean;1548 setAttribute(name: string, value: string): Element;1549 removeAttribute(name: string): Element;1550 before(content: string | ReadableStream | Response, options?: ContentOptions): Element;1551 after(content: string | ReadableStream | Response, options?: ContentOptions): Element;1552 prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;1553 append(content: string | ReadableStream | Response, options?: ContentOptions): Element;1554 replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;1555 remove(): Element;1556 removeAndKeepContent(): Element;1557 setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;1558 onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;1559}1560interface EndTag {1561 name: string;1562 before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;1563 after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;1564 remove(): EndTag;1565}1566interface Comment {1567 text: string;1568 readonly removed: boolean;1569 before(content: string, options?: ContentOptions): Comment;1570 after(content: string, options?: ContentOptions): Comment;1571 replace(content: string, options?: ContentOptions): Comment;1572 remove(): Comment;1573}1574interface Text {1575 readonly text: string;1576 readonly lastInTextNode: boolean;1577 readonly removed: boolean;1578 before(content: string | ReadableStream | Response, options?: ContentOptions): Text;1579 after(content: string | ReadableStream | Response, options?: ContentOptions): Text;1580 replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;1581 remove(): Text;1582}1583interface DocumentEnd {1584 append(content: string, options?: ContentOptions): DocumentEnd;1585}1586/**1587 * 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.1588 *1589 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)1590 */1591declare abstract class FetchEvent extends ExtendableEvent {1592 /**1593 * The **`request`** read-only property of the FetchEvent interface returns the Request that triggered the event handler.1594 *1595 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)1596 */1597 readonly request: Request;1598 /**1599 * The **`respondWith()`** method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself.1600 *1601 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)1602 */1603 respondWith(promise: Response | Promise<Response>): void;1604 passThroughOnException(): void;1605}1606type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;1607/**1608 * 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.1609 *1610 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)1611 */1612declare class Headers {1613 constructor(init?: HeadersInit);1614 /**1615 * 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.1616 *1617 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)1618 */1619 get(name: string): string | null;1620 getAll(name: string): string[];1621 /**1622 * 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.1623 *1624 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)1625 */1626 getSetCookie(): string[];1627 /**1628 * The **`has()`** method of the Headers interface returns a boolean stating whether a Headers object contains a certain header.1629 *1630 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)1631 */1632 has(name: string): boolean;1633 /**1634 * 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.1635 *1636 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)1637 */1638 set(name: string, value: string): void;1639 /**1640 * 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.1641 *1642 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)1643 */1644 append(name: string, value: string): void;1645 /**1646 * The **`delete()`** method of the Headers interface deletes a header from the current Headers object.1647 *1648 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)1649 */1650 delete(name: string): void;1651 forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;1652 entries(): IterableIterator<[1653 key: string,1654 value: string1655 ]>;1656 keys(): IterableIterator<string>;1657 values(): IterableIterator<string>;1658 [Symbol.iterator](): IterableIterator<[1659 key: string,1660 value: string1661 ]>;1662}1663type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;1664declare abstract class Body {1665 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */1666 get body(): ReadableStream | null;1667 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */1668 get bodyUsed(): boolean;1669 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */1670 arrayBuffer(): Promise<ArrayBuffer>;1671 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */1672 bytes(): Promise<Uint8Array>;1673 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */1674 text(): Promise<string>;1675 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */1676 json<T>(): Promise<T>;1677 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */1678 formData(): Promise<FormData>;1679 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */1680 blob(): Promise<Blob>;1681}1682/**1683 * The **`Response`** interface of the Fetch API represents the response to a request.1684 *1685 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)1686 */1687declare var Response: {1688 prototype: Response;1689 new (body?: BodyInit | null, init?: ResponseInit): Response;1690 error(): Response;1691 redirect(url: string, status?: number): Response;1692 json(any: any, maybeInit?: (ResponseInit | Response)): Response;1693};1694/**1695 * The **`Response`** interface of the Fetch API represents the response to a request.1696 *1697 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)1698 */1699interface Response extends Body {1700 /**1701 * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.1702 *1703 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)1704 */1705 clone(): Response;1706 /**1707 * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.1708 *1709 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)1710 */1711 status: number;1712 /**1713 * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.1714 *1715 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)1716 */1717 statusText: string;1718 /**1719 * The **`headers`** read-only property of the Response interface contains the Headers object associated with the response.1720 *1721 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)1722 */1723 headers: Headers;1724 /**1725 * 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.1726 *1727 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)1728 */1729 ok: boolean;1730 /**1731 * 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.1732 *1733 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)1734 */1735 redirected: boolean;1736 /**1737 * 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.1738 *1739 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)1740 */1741 url: string;1742 webSocket: WebSocket | null;1743 cf: any | undefined;1744 /**1745 * 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.1746 *1747 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)1748 */1749 type: "default" | "error";1750}1751interface ResponseInit {1752 status?: number;1753 statusText?: string;1754 headers?: HeadersInit;1755 cf?: any;1756 webSocket?: (WebSocket | null);1757 encodeBody?: "automatic" | "manual";1758}1759type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;1760/**1761 * The **`Request`** interface of the Fetch API represents a resource request.1762 *1763 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)1764 */1765declare var Request: {1766 prototype: Request;1767 new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;1768};1769/**1770 * The **`Request`** interface of the Fetch API represents a resource request.1771 *1772 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)1773 */1774interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {1775 /**1776 * The **`clone()`** method of the Request interface creates a copy of the current Request object.1777 *1778 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)1779 */1780 clone(): Request<CfHostMetadata, Cf>;1781 /**1782 * The **`method`** read-only property of the Request interface contains the request's method (GET, POST, etc.)1783 *1784 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)1785 */1786 method: string;1787 /**1788 * The **`url`** read-only property of the Request interface contains the URL of the request.1789 *1790 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)1791 */1792 url: string;1793 /**1794 * The **`headers`** read-only property of the Request interface contains the Headers object associated with the request.1795 *1796 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)1797 */1798 headers: Headers;1799 /**1800 * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.1801 *1802 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)1803 */1804 redirect: string;1805 fetcher: Fetcher | null;1806 /**1807 * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.1808 *1809 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)1810 */1811 signal: AbortSignal;1812 cf?: Cf;1813 /**1814 * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.1815 *1816 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)1817 */1818 integrity: string;1819 /**1820 * 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.1821 *1822 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)1823 */1824 keepalive: boolean;1825 /**1826 * 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.1827 *1828 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)1829 */1830 cache?: "no-store" | "no-cache";1831}1832interface RequestInit<Cf = CfProperties> {1833 /* A string to set request's method. */1834 method?: string;1835 /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */1836 headers?: HeadersInit;1837 /* A BodyInit object or null to set request's body. */1838 body?: BodyInit | null;1839 /* 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. */1840 redirect?: string;1841 fetcher?: (Fetcher | null);1842 cf?: Cf;1843 /* A string indicating how the request will interact with the browser's cache to set request's cache. */1844 cache?: "no-store" | "no-cache";1845 /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */1846 integrity?: string;1847 /* An AbortSignal to set request's signal. */1848 signal?: (AbortSignal | null);1849 encodeResponseBody?: "automatic" | "manual";1850}1851type 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>;1852type Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | "fetch" | "connect"> : unknown) & {1853 fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;1854 connect(address: SocketAddress | string, options?: SocketOptions): Socket;1855};1856interface KVNamespaceListKey<Metadata, Key extends string = string> {1857 name: Key;1858 expiration?: number;1859 metadata?: Metadata;1860}1861type KVNamespaceListResult<Metadata, Key extends string = string> = {1862 list_complete: false;1863 keys: KVNamespaceListKey<Metadata, Key>[];1864 cursor: string;1865 cacheStatus: string | null;1866} | {1867 list_complete: true;1868 keys: KVNamespaceListKey<Metadata, Key>[];1869 cacheStatus: string | null;1870};1871interface KVNamespace<Key extends string = string> {1872 get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;1873 get(key: Key, type: "text"): Promise<string | null>;1874 get<ExpectedValue = unknown>(key: Key, type: "json"): Promise<ExpectedValue | null>;1875 get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>;1876 get(key: Key, type: "stream"): Promise<ReadableStream | null>;1877 get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise<string | null>;1878 get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<"json">): Promise<ExpectedValue | null>;1879 get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise<ArrayBuffer | null>;1880 get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise<ReadableStream | null>;1881 get(key: Array<Key>, type: "text"): Promise<Map<string, string | null>>;1882 get<ExpectedValue = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, ExpectedValue | null>>;1883 get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;1884 get(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, string | null>>;1885 get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, ExpectedValue | null>>;1886 list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;1887 put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;1888 getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;1889 getWithMetadata<Metadata = unknown>(key: Key, type: "text"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;1890 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: "json"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;1891 getWithMetadata<Metadata = unknown>(key: Key, type: "arrayBuffer"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;1892 getWithMetadata<Metadata = unknown>(key: Key, type: "stream"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;1893 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"text">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;1894 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"json">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;1895 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;1896 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"stream">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;1897 getWithMetadata<Metadata = unknown>(key: Array<Key>, type: "text"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;1898 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;1899 getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;1900 getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;1901 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;1902 delete(key: Key): Promise<void>;1903}1904interface KVNamespaceListOptions {1905 limit?: number;1906 prefix?: (string | null);1907 cursor?: (string | null);1908}1909interface KVNamespaceGetOptions<Type> {1910 type: Type;1911 cacheTtl?: number;1912}1913interface KVNamespacePutOptions {1914 expiration?: number;1915 expirationTtl?: number;1916 metadata?: (any | null);1917}1918interface KVNamespaceGetWithMetadataResult<Value, Metadata> {1919 value: Value | null;1920 metadata: Metadata | null;1921 cacheStatus: string | null;1922}1923type QueueContentType = "text" | "bytes" | "json" | "v8";1924interface Queue<Body = unknown> {1925 metrics(): Promise<QueueMetrics>;1926 send(message: Body, options?: QueueSendOptions): Promise<QueueSendResponse>;1927 sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<QueueSendBatchResponse>;1928}1929interface QueueSendMetrics {1930 backlogCount: number;1931 backlogBytes: number;1932 oldestMessageTimestamp?: Date;1933}1934interface QueueSendMetadata {1935 metrics: QueueSendMetrics;1936}1937interface QueueSendResponse {1938 metadata: QueueSendMetadata;1939}1940interface QueueSendBatchMetrics {1941 backlogCount: number;1942 backlogBytes: number;1943 oldestMessageTimestamp?: Date;1944}1945interface QueueSendBatchMetadata {1946 metrics: QueueSendBatchMetrics;1947}1948interface QueueSendBatchResponse {1949 metadata: QueueSendBatchMetadata;1950}1951interface QueueSendOptions {1952 contentType?: QueueContentType;1953 delaySeconds?: number;1954}1955interface QueueSendBatchOptions {1956 delaySeconds?: number;1957}1958interface MessageSendRequest<Body = unknown> {1959 body: Body;1960 contentType?: QueueContentType;1961 delaySeconds?: number;1962}1963interface QueueMetrics {1964 backlogCount: number;1965 backlogBytes: number;1966 oldestMessageTimestamp?: Date;1967}1968interface MessageBatchMetrics {1969 backlogCount: number;1970 backlogBytes: number;1971 oldestMessageTimestamp?: Date;1972}1973interface MessageBatchMetadata {1974 metrics: MessageBatchMetrics;1975}1976interface QueueRetryOptions {1977 delaySeconds?: number;1978}1979interface Message<Body = unknown> {1980 readonly id: string;1981 readonly timestamp: Date;1982 readonly body: Body;1983 readonly attempts: number;1984 retry(options?: QueueRetryOptions): void;1985 ack(): void;1986}1987interface QueueEvent<Body = unknown> extends ExtendableEvent {1988 readonly messages: readonly Message<Body>[];1989 readonly queue: string;1990 readonly metadata: MessageBatchMetadata;1991 retryAll(options?: QueueRetryOptions): void;1992 ackAll(): void;1993}1994interface MessageBatch<Body = unknown> {1995 readonly messages: readonly Message<Body>[];1996 readonly queue: string;1997 readonly metadata: MessageBatchMetadata;1998 retryAll(options?: QueueRetryOptions): void;1999 ackAll(): void;2000}2001interface R2Error extends Error {2002 readonly name: string;2003 readonly code: number;2004 readonly message: string;2005 readonly action: string;2006 readonly stack: any;2007}2008interface R2ListOptions {2009 limit?: number;2010 prefix?: string;2011 cursor?: string;2012 delimiter?: string;2013 startAfter?: string;2014 include?: ("httpMetadata" | "customMetadata")[];2015}2016interface R2Bucket {2017 head(key: string): Promise<R2Object | null>;2018 get(key: string, options: R2GetOptions & {2019 onlyIf: R2Conditional | Headers;2020 }): Promise<R2ObjectBody | R2Object | null>;2021 get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;2022 put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & {2023 onlyIf: R2Conditional | Headers;2024 }): Promise<R2Object | null>;2025 put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>;2026 createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;2027 resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;2028 delete(keys: string | string[]): Promise<void>;2029 list(options?: R2ListOptions): Promise<R2Objects>;2030}2031interface R2MultipartUpload {2032 readonly key: string;2033 readonly uploadId: string;2034 uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>;2035 abort(): Promise<void>;2036 complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;2037}2038interface R2UploadedPart {2039 partNumber: number;2040 etag: string;2041}2042declare abstract class R2Object {2043 readonly key: string;2044 readonly version: string;2045 readonly size: number;2046 readonly etag: string;2047 readonly httpEtag: string;2048 readonly checksums: R2Checksums;2049 readonly uploaded: Date;2050 readonly httpMetadata?: R2HTTPMetadata;2051 readonly customMetadata?: Record<string, string>;2052 readonly range?: R2Range;2053 readonly storageClass: string;2054 readonly ssecKeyMd5?: string;2055 writeHttpMetadata(headers: Headers): void;2056}2057interface R2ObjectBody extends R2Object {2058 get body(): ReadableStream;2059 get bodyUsed(): boolean;2060 arrayBuffer(): Promise<ArrayBuffer>;2061 bytes(): Promise<Uint8Array>;2062 text(): Promise<string>;2063 json<T>(): Promise<T>;2064 blob(): Promise<Blob>;2065}2066type R2Range = {2067 offset: number;2068 length?: number;2069} | {2070 offset?: number;2071 length: number;2072} | {2073 suffix: number;2074};2075interface R2Conditional {2076 etagMatches?: string;2077 etagDoesNotMatch?: string;2078 uploadedBefore?: Date;2079 uploadedAfter?: Date;2080 secondsGranularity?: boolean;2081}2082interface R2GetOptions {2083 onlyIf?: (R2Conditional | Headers);2084 range?: (R2Range | Headers);2085 ssecKey?: (ArrayBuffer | string);2086}2087interface R2PutOptions {2088 onlyIf?: (R2Conditional | Headers);2089 httpMetadata?: (R2HTTPMetadata | Headers);2090 customMetadata?: Record<string, string>;2091 md5?: ((ArrayBuffer | ArrayBufferView) | string);2092 sha1?: ((ArrayBuffer | ArrayBufferView) | string);2093 sha256?: ((ArrayBuffer | ArrayBufferView) | string);2094 sha384?: ((ArrayBuffer | ArrayBufferView) | string);2095 sha512?: ((ArrayBuffer | ArrayBufferView) | string);2096 storageClass?: string;2097 ssecKey?: (ArrayBuffer | string);2098}2099interface R2MultipartOptions {2100 httpMetadata?: (R2HTTPMetadata | Headers);2101 customMetadata?: Record<string, string>;2102 storageClass?: string;2103 ssecKey?: (ArrayBuffer | string);2104}2105interface R2Checksums {2106 readonly md5?: ArrayBuffer;2107 readonly sha1?: ArrayBuffer;2108 readonly sha256?: ArrayBuffer;2109 readonly sha384?: ArrayBuffer;2110 readonly sha512?: ArrayBuffer;2111 toJSON(): R2StringChecksums;2112}2113interface R2StringChecksums {2114 md5?: string;2115 sha1?: string;2116 sha256?: string;2117 sha384?: string;2118 sha512?: string;2119}2120interface R2HTTPMetadata {2121 contentType?: string;2122 contentLanguage?: string;2123 contentDisposition?: string;2124 contentEncoding?: string;2125 cacheControl?: string;2126 cacheExpiry?: Date;2127}2128type R2Objects = {2129 objects: R2Object[];2130 delimitedPrefixes: string[];2131} & ({2132 truncated: true;2133 cursor: string;2134} | {2135 truncated: false;2136});2137interface R2UploadPartOptions {2138 ssecKey?: (ArrayBuffer | string);2139}2140declare abstract class ScheduledEvent extends ExtendableEvent {2141 readonly scheduledTime: number;2142 readonly cron: string;2143 noRetry(): void;2144}2145interface ScheduledController {2146 readonly scheduledTime: number;2147 readonly cron: string;2148 noRetry(): void;2149}2150interface QueuingStrategy<T = any> {2151 highWaterMark?: (number | bigint);2152 size?: (chunk: T) => number | bigint;2153}2154interface UnderlyingSink<W = any> {2155 type?: string;2156 start?: (controller: WritableStreamDefaultController) => void | Promise<void>;2157 write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;2158 abort?: (reason: any) => void | Promise<void>;2159 close?: () => void | Promise<void>;2160}2161interface UnderlyingByteSource {2162 type: "bytes";2163 autoAllocateChunkSize?: number;2164 start?: (controller: ReadableByteStreamController) => void | Promise<void>;2165 pull?: (controller: ReadableByteStreamController) => void | Promise<void>;2166 cancel?: (reason: any) => void | Promise<void>;2167}2168interface UnderlyingSource<R = any> {2169 type?: "" | undefined;2170 start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;2171 pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;2172 cancel?: (reason: any) => void | Promise<void>;2173 expectedLength?: (number | bigint);2174}2175interface Transformer<I = any, O = any> {2176 readableType?: string;2177 writableType?: string;2178 start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;2179 transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;2180 flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;2181 cancel?: (reason: any) => void | Promise<void>;2182 expectedLength?: number;2183}2184interface StreamPipeOptions {2185 preventAbort?: boolean;2186 preventCancel?: boolean;2187 /**2188 * 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.2189 *2190 * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.2191 *2192 * Errors and closures of the source and destination streams propagate as follows:2193 *2194 * 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.2195 *2196 * 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.2197 *2198 * 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.2199 *2200 * 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.2201 *2202 * 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.2203 */2204 preventClose?: boolean;2205 signal?: AbortSignal;2206}2207type ReadableStreamReadResult<R = any> = {2208 done: false;2209 value: R;2210} | {2211 done: true;2212 value?: undefined;2213};2214/**2215 * 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.2216 *2217 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)2218 */2219interface ReadableStream<R = any> {2220 /**2221 * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.2222 *2223 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)2224 */2225 get locked(): boolean;2226 /**2227 * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.2228 *2229 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)2230 */2231 cancel(reason?: any): Promise<void>;2232 /**2233 * 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.2234 *2235 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)2236 */2237 getReader(): ReadableStreamDefaultReader<R>;2238 /**2239 * 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.2240 *2241 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)2242 */2243 getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;2244 /**2245 * 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.2246 *2247 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)2248 */2249 pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;2250 /**2251 * 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.2252 *2253 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)2254 */2255 pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;2256 /**2257 * 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.2258 *2259 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)2260 */2261 tee(): [2262 ReadableStream<R>,2263 ReadableStream<R>2264 ];2265 values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;2266 [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;2267}2268/**2269 * 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.2270 *2271 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)2272 */2273declare const ReadableStream: {2274 prototype: ReadableStream;2275 new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;2276 new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;2277};2278/**2279 * 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).2280 *2281 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)2282 */2283declare class ReadableStreamDefaultReader<R = any> {2284 constructor(stream: ReadableStream);2285 get closed(): Promise<void>;2286 cancel(reason?: any): Promise<void>;2287 /**2288 * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.2289 *2290 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)2291 */2292 read(): Promise<ReadableStreamReadResult<R>>;2293 /**2294 * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.2295 *2296 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)2297 */2298 releaseLock(): void;2299}2300/**2301 * 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.2302 *2303 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)2304 */2305declare class ReadableStreamBYOBReader {2306 constructor(stream: ReadableStream);2307 get closed(): Promise<void>;2308 cancel(reason?: any): Promise<void>;2309 /**2310 * 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.2311 *2312 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)2313 */2314 read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;2315 /**2316 * 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.2317 *2318 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)2319 */2320 releaseLock(): void;2321 readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;2322}2323interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {2324 min?: number;2325}2326interface ReadableStreamGetReaderOptions {2327 /**2328 * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.2329 *2330 * 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.2331 */2332 mode: "byob";2333}2334/**2335 * 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).2336 *2337 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)2338 */2339declare abstract class ReadableStreamBYOBRequest {2340 /**2341 * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.2342 *2343 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)2344 */2345 get view(): Uint8Array | null;2346 /**2347 * 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.2348 *2349 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)2350 */2351 respond(bytesWritten: number): void;2352 /**2353 * 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.2354 *2355 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)2356 */2357 respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;2358 get atLeast(): number | null;2359}2360/**2361 * 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.2362 *2363 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)2364 */2365declare abstract class ReadableStreamDefaultController<R = any> {2366 /**2367 * The **`desiredSize`** read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue.2368 *2369 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)2370 */2371 get desiredSize(): number | null;2372 /**2373 * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.2374 *2375 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)2376 */2377 close(): void;2378 /**2379 * The **`enqueue()`** method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream.2380 *2381 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)2382 */2383 enqueue(chunk?: R): void;2384 /**2385 * The **`error()`** method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error.2386 *2387 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)2388 */2389 error(reason: any): void;2390}2391/**2392 * 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.2393 *2394 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)2395 */2396declare abstract class ReadableByteStreamController {2397 /**2398 * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests.2399 *2400 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)2401 */2402 get byobRequest(): ReadableStreamBYOBRequest | null;2403 /**2404 * 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".2405 *2406 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)2407 */2408 get desiredSize(): number | null;2409 /**2410 * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.2411 *2412 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)2413 */2414 close(): void;2415 /**2416 * 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).2417 *2418 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)2419 */2420 enqueue(chunk: ArrayBuffer | ArrayBufferView): void;2421 /**2422 * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.2423 *2424 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)2425 */2426 error(reason: any): void;2427}2428/**2429 * 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.2430 *2431 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)2432 */2433declare abstract class WritableStreamDefaultController {2434 /**2435 * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.2436 *2437 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)2438 */2439 get signal(): AbortSignal;2440 /**2441 * The **`error()`** method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error.2442 *2443 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)2444 */2445 error(reason?: any): void;2446}2447/**2448 * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.2449 *2450 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)2451 */2452declare abstract class TransformStreamDefaultController<O = any> {2453 /**2454 * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.2455 *2456 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)2457 */2458 get desiredSize(): number | null;2459 /**2460 * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.2461 *2462 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)2463 */2464 enqueue(chunk?: O): void;2465 /**2466 * 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.2467 *2468 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)2469 */2470 error(reason: any): void;2471 /**2472 * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.2473 *2474 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)2475 */2476 terminate(): void;2477}2478interface ReadableWritablePair<R = any, W = any> {2479 readable: ReadableStream<R>;2480 /**2481 * 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.2482 *2483 * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.2484 */2485 writable: WritableStream<W>;2486}2487/**2488 * 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.2489 *2490 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)2491 */2492declare class WritableStream<W = any> {2493 constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);2494 /**2495 * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the WritableStream is locked to a writer.2496 *2497 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)2498 */2499 get locked(): boolean;2500 /**2501 * 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.2502 *2503 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)2504 */2505 abort(reason?: any): Promise<void>;2506 /**2507 * 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.2508 *2509 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)2510 */2511 close(): Promise<void>;2512 /**2513 * 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.2514 *2515 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)2516 */2517 getWriter(): WritableStreamDefaultWriter<W>;2518}2519/**2520 * 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.2521 *2522 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)2523 */2524declare class WritableStreamDefaultWriter<W = any> {2525 constructor(stream: WritableStream);2526 /**2527 * 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.2528 *2529 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)2530 */2531 get closed(): Promise<void>;2532 /**2533 * 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.2534 *2535 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)2536 */2537 get ready(): Promise<void>;2538 /**2539 * The **`desiredSize`** read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue.2540 *2541 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)2542 */2543 get desiredSize(): number | null;2544 /**2545 * 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.2546 *2547 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)2548 */2549 abort(reason?: any): Promise<void>;2550 /**2551 * The **`close()`** method of the WritableStreamDefaultWriter interface closes the associated writable stream.2552 *2553 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)2554 */2555 close(): Promise<void>;2556 /**2557 * 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.2558 *2559 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)2560 */2561 write(chunk?: W): Promise<void>;2562 /**2563 * 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.2564 *2565 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)2566 */2567 releaseLock(): void;2568}2569/**2570 * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain transform stream concept.2571 *2572 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)2573 */2574declare class TransformStream<I = any, O = any> {2575 constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);2576 /**2577 * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this TransformStream. This stream emits the transformed output data.2578 *2579 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)2580 */2581 get readable(): ReadableStream<O>;2582 /**2583 * 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.2584 *2585 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)2586 */2587 get writable(): WritableStream<I>;2588}2589declare class FixedLengthStream extends IdentityTransformStream {2590 constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);2591}2592declare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {2593 constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);2594}2595interface IdentityTransformStreamQueuingStrategy {2596 highWaterMark?: (number | bigint);2597}2598interface ReadableStreamValuesOptions {2599 preventCancel?: boolean;2600}2601/**2602 * 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.2603 *2604 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)2605 */2606declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {2607 constructor(format: "gzip" | "deflate" | "deflate-raw");2608}2609/**2610 * 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.2611 *2612 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)2613 */2614declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {2615 constructor(format: "gzip" | "deflate" | "deflate-raw");2616}2617/**2618 * 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.2619 *2620 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)2621 */2622declare class TextEncoderStream extends TransformStream<string, Uint8Array> {2623 constructor();2624 get encoding(): string;2625}2626/**2627 * 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.2628 *2629 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)2630 */2631declare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {2632 constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);2633 get encoding(): string;2634 get fatal(): boolean;2635 get ignoreBOM(): boolean;2636}2637interface TextDecoderStreamTextDecoderStreamInit {2638 fatal?: boolean;2639 ignoreBOM?: boolean;2640}2641/**2642 * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.2643 *2644 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)2645 */2646declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {2647 constructor(init: QueuingStrategyInit);2648 /**2649 * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.2650 *2651 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)2652 */2653 get highWaterMark(): number;2654 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */2655 get size(): (chunk?: any) => number;2656}2657/**2658 * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.2659 *2660 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)2661 */2662declare class CountQueuingStrategy implements QueuingStrategy {2663 constructor(init: QueuingStrategyInit);2664 /**2665 * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.2666 *2667 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)2668 */2669 get highWaterMark(): number;2670 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */2671 get size(): (chunk?: any) => number;2672}2673interface QueuingStrategyInit {2674 /**2675 * Creates a new ByteLengthQueuingStrategy with the provided high water mark.2676 *2677 * 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.2678 */2679 highWaterMark: number;2680}2681interface TracePreviewInfo {2682 id: string;2683 slug: string;2684 name: string;2685}2686interface ScriptVersion {2687 id?: string;2688 tag?: string;2689 message?: string;2690}2691declare abstract class TailEvent extends ExtendableEvent {2692 readonly events: TraceItem[];2693 readonly traces: TraceItem[];2694}2695interface TraceItem {2696 readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemConnectEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null;2697 readonly eventTimestamp: number | null;2698 readonly logs: TraceLog[];2699 readonly exceptions: TraceException[];2700 readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];2701 readonly scriptName: string | null;2702 readonly entrypoint?: string;2703 readonly scriptVersion?: ScriptVersion;2704 readonly dispatchNamespace?: string;2705 readonly scriptTags?: string[];2706 readonly tailAttributes?: Record<string, boolean | number | string>;2707 readonly preview?: TracePreviewInfo;2708 readonly durableObjectId?: string;2709 readonly outcome: string;2710 readonly executionModel: string;2711 readonly truncated: boolean;2712 readonly cpuTime: number;2713 readonly wallTime: number;2714}2715interface TraceItemAlarmEventInfo {2716 readonly scheduledTime: Date;2717}2718interface TraceItemConnectEventInfo {2719}2720interface TraceItemCustomEventInfo {2721}2722interface TraceItemScheduledEventInfo {2723 readonly scheduledTime: number;2724 readonly cron: string;2725}2726interface TraceItemQueueEventInfo {2727 readonly queue: string;2728 readonly batchSize: number;2729}2730interface TraceItemEmailEventInfo {2731 readonly mailFrom: string;2732 readonly rcptTo: string;2733 readonly rawSize: number;2734}2735interface TraceItemTailEventInfo {2736 readonly consumedEvents: TraceItemTailEventInfoTailItem[];2737}2738interface TraceItemTailEventInfoTailItem {2739 readonly scriptName: string | null;2740}2741interface TraceItemFetchEventInfo {2742 readonly response?: TraceItemFetchEventInfoResponse;2743 readonly request: TraceItemFetchEventInfoRequest;2744}2745interface TraceItemFetchEventInfoRequest {2746 readonly cf?: any;2747 readonly headers: Record<string, string>;2748 readonly method: string;2749 readonly url: string;2750 getUnredacted(): TraceItemFetchEventInfoRequest;2751}2752interface TraceItemFetchEventInfoResponse {2753 readonly status: number;2754}2755interface TraceItemJsRpcEventInfo {2756 readonly rpcMethod: string;2757}2758interface TraceItemHibernatableWebSocketEventInfo {2759 readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError;2760}2761interface TraceItemHibernatableWebSocketEventInfoMessage {2762 readonly webSocketEventType: string;2763}2764interface TraceItemHibernatableWebSocketEventInfoClose {2765 readonly webSocketEventType: string;2766 readonly code: number;2767 readonly wasClean: boolean;2768}2769interface TraceItemHibernatableWebSocketEventInfoError {2770 readonly webSocketEventType: string;2771}2772interface TraceLog {2773 readonly timestamp: number;2774 readonly level: string;2775 readonly message: any;2776 readonly errorInfo?: (TraceLogErrorInfo | null)[];2777}2778interface TraceLogErrorInfo {2779 name: string;2780 message: string;2781 stack?: string;2782}2783interface TraceException {2784 readonly timestamp: number;2785 readonly message: string;2786 readonly name: string;2787 readonly stack?: string;2788}2789interface TraceDiagnosticChannelEvent {2790 readonly timestamp: number;2791 readonly channel: string;2792 readonly message: any;2793}2794interface TraceMetrics {2795 readonly cpuTime: number;2796 readonly wallTime: number;2797}2798interface UnsafeTraceMetrics {2799 fromTrace(item: TraceItem): TraceMetrics;2800}2801/**2802 * 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.2803 *2804 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)2805 */2806declare class URL {2807 constructor(url: string | URL, base?: string | URL);2808 /**2809 * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.2810 *2811 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)2812 */2813 get origin(): string;2814 /**2815 * The **`href`** property of the URL interface is a string containing the whole URL.2816 *2817 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)2818 */2819 get href(): string;2820 /**2821 * The **`href`** property of the URL interface is a string containing the whole URL.2822 *2823 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)2824 */2825 set href(value: string);2826 /**2827 * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":".2828 *2829 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)2830 */2831 get protocol(): string;2832 /**2833 * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final ":".2834 *2835 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)2836 */2837 set protocol(value: string);2838 /**2839 * 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, "".2840 *2841 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)2842 */2843 get username(): string;2844 /**2845 * 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, "".2846 *2847 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)2848 */2849 set username(value: string);2850 /**2851 * 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, "".2852 *2853 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)2854 */2855 get password(): string;2856 /**2857 * 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, "".2858 *2859 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)2860 */2861 set password(value: string);2862 /**2863 * 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, "".2864 *2865 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)2866 */2867 get host(): string;2868 /**2869 * 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, "".2870 *2871 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)2872 */2873 set host(value: string);2874 /**2875 * 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.2876 *2877 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)2878 */2879 get hostname(): string;2880 /**2881 * 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.2882 *2883 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)2884 */2885 set hostname(value: string);2886 /**2887 * 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, "".2888 *2889 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)2890 */2891 get port(): string;2892 /**2893 * 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, "".2894 *2895 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)2896 */2897 set port(value: string);2898 /**2899 * 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.2900 *2901 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)2902 */2903 get pathname(): string;2904 /**2905 * 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.2906 *2907 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)2908 */2909 set pathname(value: string);2910 /**2911 * 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, "".2912 *2913 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)2914 */2915 get search(): string;2916 /**2917 * 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, "".2918 *2919 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)2920 */2921 set search(value: string);2922 /**2923 * 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, "".2924 *2925 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)2926 */2927 get hash(): string;2928 /**2929 * 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, "".2930 *2931 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)2932 */2933 set hash(value: string);2934 /**2935 * 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.2936 *2937 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)2938 */2939 get searchParams(): URLSearchParams;2940 /**2941 * 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().2942 *2943 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)2944 */2945 toJSON(): string;2946 /*function toString() { [native code] }*/2947 toString(): string;2948 /**2949 * 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.2950 *2951 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)2952 */2953 static canParse(url: string, base?: string): boolean;2954 /**2955 * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.2956 *2957 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)2958 */2959 static parse(url: string, base?: string): URL | null;2960 /**2961 * The **`createObjectURL()`** static method of the URL interface creates a string containing a blob URL pointing to the object given in the parameter.2962 *2963 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)2964 */2965 static createObjectURL(object: File | Blob): string;2966 /**2967 * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL().2968 *2969 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)2970 */2971 static revokeObjectURL(object_url: string): void;2972}2973/**2974 * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.2975 *2976 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)2977 */2978declare class URLSearchParams {2979 constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));2980 /**2981 * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.2982 *2983 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)2984 */2985 get size(): number;2986 /**2987 * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.2988 *2989 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)2990 */2991 append(name: string, value: string): void;2992 /**2993 * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.2994 *2995 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)2996 */2997 delete(name: string, value?: string): void;2998 /**2999 * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.3000 *3001 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)3002 */3003 get(name: string): string | null;3004 /**3005 * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.3006 *3007 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)3008 */3009 getAll(name: string): string[];3010 /**3011 * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.3012 *3013 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)3014 */3015 has(name: string, value?: string): boolean;3016 /**3017 * 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.3018 *3019 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)3020 */3021 set(name: string, value: string): void;3022 /**3023 * 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).3024 *3025 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)3026 */3027 sort(): void;3028 entries(): IterableIterator<[3029 key: string,3030 value: string3031 ]>;3032 keys(): IterableIterator<string>;3033 values(): IterableIterator<string>;3034 forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;3035 /*function toString() { [native code] }*/3036 toString(): string;3037 [Symbol.iterator](): IterableIterator<[3038 key: string,3039 value: string3040 ]>;3041}3042/**3043 * 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.3044 *3045 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern)3046 */3047declare class URLPattern {3048 constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions);3049 /**3050 * The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL.3051 *3052 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol)3053 */3054 get protocol(): string;3055 /**3056 * The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL.3057 *3058 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username)3059 */3060 get username(): string;3061 /**3062 * The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL.3063 *3064 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password)3065 */3066 get password(): string;3067 /**3068 * The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL.3069 *3070 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname)3071 */3072 get hostname(): string;3073 /**3074 * The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL.3075 *3076 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port)3077 */3078 get port(): string;3079 /**3080 * The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL.3081 *3082 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname)3083 */3084 get pathname(): string;3085 /**3086 * The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL.3087 *3088 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search)3089 */3090 get search(): string;3091 /**3092 * The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL.3093 *3094 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash)3095 */3096 get hash(): string;3097 /**3098 * 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.3099 *3100 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hasRegExpGroups)3101 */3102 get hasRegExpGroups(): boolean;3103 /**3104 * 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.3105 *3106 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test)3107 */3108 test(input?: (string | URLPatternInit), baseURL?: string): boolean;3109 /**3110 * 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.3111 *3112 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec)3113 */3114 exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null;3115}3116interface URLPatternInit {3117 protocol?: string;3118 username?: string;3119 password?: string;3120 hostname?: string;3121 port?: string;3122 pathname?: string;3123 search?: string;3124 hash?: string;3125 baseURL?: string;3126}3127interface URLPatternComponentResult {3128 input: string;3129 groups: Record<string, string>;3130}3131interface URLPatternResult {3132 inputs: (string | URLPatternInit)[];3133 protocol: URLPatternComponentResult;3134 username: URLPatternComponentResult;3135 password: URLPatternComponentResult;3136 hostname: URLPatternComponentResult;3137 port: URLPatternComponentResult;3138 pathname: URLPatternComponentResult;3139 search: URLPatternComponentResult;3140 hash: URLPatternComponentResult;3141}3142interface URLPatternOptions {3143 ignoreCase?: boolean;3144}3145/**3146 * 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.3147 *3148 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)3149 */3150declare class CloseEvent extends Event {3151 constructor(type: string, initializer?: CloseEventInit);3152 /**3153 * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.3154 *3155 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)3156 */3157 readonly code: number;3158 /**3159 * 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.3160 *3161 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)3162 */3163 readonly reason: string;3164 /**3165 * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.3166 *3167 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)3168 */3169 readonly wasClean: boolean;3170}3171interface CloseEventInit {3172 code?: number;3173 reason?: string;3174 wasClean?: boolean;3175}3176type WebSocketEventMap = {3177 close: CloseEvent;3178 message: MessageEvent;3179 open: Event;3180 error: ErrorEvent;3181};3182/**3183 * 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.3184 *3185 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)3186 */3187declare var WebSocket: {3188 prototype: WebSocket;3189 new (url: string, protocols?: (string[] | string)): WebSocket;3190 readonly READY_STATE_CONNECTING: number;3191 readonly CONNECTING: number;3192 readonly READY_STATE_OPEN: number;3193 readonly OPEN: number;3194 readonly READY_STATE_CLOSING: number;3195 readonly CLOSING: number;3196 readonly READY_STATE_CLOSED: number;3197 readonly CLOSED: number;3198};3199/**3200 * 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.3201 *3202 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)3203 */3204interface WebSocket extends EventTarget<WebSocketEventMap> {3205 accept(options?: WebSocketAcceptOptions): void;3206 /**3207 * 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.3208 *3209 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)3210 */3211 send(message: (ArrayBuffer | ArrayBufferView) | string): void;3212 /**3213 * The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.3214 *3215 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)3216 */3217 close(code?: number, reason?: string): void;3218 serializeAttachment(attachment: any): void;3219 deserializeAttachment(): any | null;3220 /**3221 * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.3222 *3223 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)3224 */3225 readyState: number;3226 /**3227 * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.3228 *3229 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)3230 */3231 url: string | null;3232 /**3233 * 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.3234 *3235 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)3236 */3237 protocol: string | null;3238 /**3239 * 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.3240 *3241 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)3242 */3243 extensions: string | null;3244 /**3245 * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.3246 *3247 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)3248 */3249 binaryType: "blob" | "arraybuffer";3250}3251interface WebSocketAcceptOptions {3252 /**3253 * When set to `true`, receiving a server-initiated WebSocket Close frame will not3254 * automatically send a reciprocal Close frame, leaving the connection in a half-open3255 * state. This is useful for proxying scenarios where you need to coordinate closing3256 * both sides independently. Defaults to `false` when the3257 * `no_web_socket_half_open_by_default` compatibility flag is enabled.3258 */3259 allowHalfOpen?: boolean;3260}3261declare const WebSocketPair: {3262 new (): {3263 0: WebSocket;3264 1: WebSocket;3265 };3266};3267interface SqlStorage {3268 exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;3269 get databaseSize(): number;3270 Cursor: typeof SqlStorageCursor;3271 Statement: typeof SqlStorageStatement;3272}3273declare abstract class SqlStorageStatement {3274}3275type SqlStorageValue = ArrayBuffer | string | number | null;3276declare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> {3277 next(): {3278 done?: false;3279 value: T;3280 } | {3281 done: true;3282 value?: never;3283 };3284 toArray(): T[];3285 one(): T;3286 raw<U extends SqlStorageValue[]>(): IterableIterator<U>;3287 columnNames: string[];3288 get rowsRead(): number;3289 get rowsWritten(): number;3290 [Symbol.iterator](): IterableIterator<T>;3291}3292interface Socket {3293 get readable(): ReadableStream;3294 get writable(): WritableStream;3295 get closed(): Promise<void>;3296 get opened(): Promise<SocketInfo>;3297 get upgraded(): boolean;3298 get secureTransport(): "on" | "off" | "starttls";3299 close(): Promise<void>;3300 startTls(options?: TlsOptions): Socket;3301}3302interface SocketOptions {3303 secureTransport?: string;3304 allowHalfOpen: boolean;3305 highWaterMark?: (number | bigint);3306}3307interface SocketAddress {3308 hostname: string;3309 port: number;3310}3311interface TlsOptions {3312 expectedServerHostname?: string;3313}3314interface SocketInfo {3315 remoteAddress?: string;3316 localAddress?: string;3317}3318/**3319 * The **`EventSource`** interface is web content's interface to server-sent events.3320 *3321 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)3322 */3323declare class EventSource extends EventTarget {3324 constructor(url: string, init?: EventSourceEventSourceInit);3325 /**3326 * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed).3327 *3328 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)3329 */3330 close(): void;3331 /**3332 * The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.3333 *3334 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)3335 */3336 get url(): string;3337 /**3338 * The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.3339 *3340 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)3341 */3342 get withCredentials(): boolean;3343 /**3344 * The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.3345 *3346 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)3347 */3348 get readyState(): number;3349 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */3350 get onopen(): any | null;3351 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */3352 set onopen(value: any | null);3353 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */3354 get onmessage(): any | null;3355 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */3356 set onmessage(value: any | null);3357 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */3358 get onerror(): any | null;3359 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */3360 set onerror(value: any | null);3361 static readonly CONNECTING: number;3362 static readonly OPEN: number;3363 static readonly CLOSED: number;3364 static from(stream: ReadableStream): EventSource;3365}3366interface EventSourceEventSourceInit {3367 withCredentials?: boolean;3368 fetcher?: Fetcher;3369}3370interface ExecOutput {3371 readonly stdout: ArrayBuffer;3372 readonly stderr: ArrayBuffer;3373 readonly exitCode: number;3374}3375interface ContainerExecOptions {3376 cwd?: string;3377 env?: Record<string, string>;3378 user?: string;3379 signal?: AbortSignal;3380 pty?: boolean | ContainerExecPtyOptions;3381 stdin?: ReadableStream | "pipe";3382 stdout?: "pipe" | "ignore";3383 stderr?: "pipe" | "ignore" | "combined";3384}3385interface ContainerExecPtyOptions {3386 cols?: number;3387 rows?: number;3388}3389interface ExecProcess {3390 readonly stdin: WritableStream | null;3391 readonly stdout: ReadableStream | null;3392 readonly stderr: ReadableStream | null;3393 readonly pid: number;3394 readonly isPty: boolean;3395 readonly exitCode: Promise<number>;3396 output(): Promise<ExecOutput>;3397 kill(signal?: number): void;3398 resize(cols: number, rows: number): void;3399}3400interface Container {3401 get running(): boolean;3402 start(options?: ContainerStartupOptions): void;3403 monitor(): Promise<void>;3404 destroy(error?: any): Promise<void>;3405 signal(signo: number): void;3406 getTcpPort(port: number): Fetcher;3407 setInactivityTimeout(durationMs: number | bigint): Promise<void>;3408 interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;3409 interceptAllOutboundHttp(binding: Fetcher): Promise<void>;3410 snapshotDirectory(options: ContainerDirectorySnapshotOptions): Promise<ContainerDirectorySnapshot>;3411 snapshotContainer(options: ContainerSnapshotOptions): Promise<ContainerSnapshot>;3412 interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;3413 exec(cmd: string[], options?: ContainerExecOptions): Promise<ExecProcess>;3414}3415interface ContainerDirectorySnapshot {3416 id: string;3417 size: number;3418 dir: string;3419 name?: string;3420}3421interface ContainerDirectorySnapshotOptions {3422 dir: string;3423 name?: string;3424}3425interface ContainerDirectorySnapshotRestoreParams {3426 snapshot: ContainerDirectorySnapshot;3427 mountPoint?: string;3428}3429interface ContainerSnapshot {3430 id: string;3431 size: number;3432 name?: string;3433}3434interface ContainerSnapshotRestoreParams {3435 id: string;3436}3437interface ContainerSnapshotOptions {3438 name?: string;3439}3440type ContainerStartupOptions = {3441 entrypoint?: string[];3442 enableInternet: boolean;3443 env?: Record<string, string>;3444 instance?: "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | ContainerStartResources;3445 labels?: Record<string, string>;3446 directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];3447} & ({3448 image: string;3449 containerSnapshot?: never;3450} | {3451 image?: never;3452 containerSnapshot?: ContainerSnapshotRestoreParams;3453});3454interface ContainerStartResources {3455 vcpu: number;3456 memoryMib: number;3457 diskMb: number;3458}3459/**3460 * 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.3461 *3462 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)3463 */3464declare abstract class MessagePort extends EventTarget {3465 /**3466 * The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.3467 *3468 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)3469 */3470 postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;3471 /**3472 * 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.3473 *3474 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)3475 */3476 close(): void;3477 /**3478 * 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.3479 *3480 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)3481 */3482 start(): void;3483 get onmessage(): any | null;3484 set onmessage(value: any | null);3485}3486/**3487 * 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.3488 *3489 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)3490 */3491declare class MessageChannel {3492 constructor();3493 /**3494 * 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.3495 *3496 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)3497 */3498 readonly port1: MessagePort;3499 /**3500 * 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.3501 *3502 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)3503 */3504 readonly port2: MessagePort;3505}3506interface MessagePortPostMessageOptions {3507 transfer?: any[];3508}3509type 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;3510type LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: {3511 props?: Props;3512}) => Fetcher<T> : (opts: {3513 props?: any;3514}) => Fetcher<T>);3515type LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: {3516 props?: Props;3517}) => DurableObjectClass<T> : (opts: {3518 props?: any;3519}) => DurableObjectClass<T>);3520interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {3521}3522interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {3523}3524interface SyncKvStorage {3525 get<T = unknown>(key: string): T | undefined;3526 list<T = unknown>(options?: SyncKvListOptions): Iterable<[3527 string,3528 T3529 ]>;3530 put<T>(key: string, value: T): void;3531 delete(key: string): boolean;3532}3533interface SyncKvListOptions {3534 start?: string;3535 startAfter?: string;3536 end?: string;3537 prefix?: string;3538 reverse?: boolean;3539 limit?: number;3540}3541interface WorkerStub {3542 getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>;3543 getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): DurableObjectClass<T>;3544}3545interface WorkerStubEntrypointOptions {3546 props?: any;3547 limits?: workerdResourceLimits;3548}3549interface WorkerLoader {3550 get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;3551 load(code: WorkerLoaderWorkerCode): WorkerStub;3552}3553interface WorkerLoaderModule {3554 js?: string;3555 cjs?: string;3556 text?: string;3557 data?: ArrayBuffer;3558 json?: any;3559 py?: string;3560 wasm?: ArrayBuffer;3561}3562interface WorkerLoaderWorkerCode {3563 compatibilityDate: string;3564 compatibilityFlags?: string[];3565 allowExperimental?: boolean;3566 limits?: workerdResourceLimits;3567 mainModule: string;3568 modules: Record<string, WorkerLoaderModule | string>;3569 env?: any;3570 globalOutbound?: (Fetcher | null);3571 tails?: Fetcher[];3572 streamingTails?: Fetcher[];3573}3574interface workerdResourceLimits {3575 cpuMs?: number;3576 subRequests?: number;3577}3578/**3579* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,3580* as well as timing of subrequests and other operations.3581*3582* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)3583*/3584declare abstract class Performance {3585 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */3586 get timeOrigin(): number;3587 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */3588 now(): number;3589 /**3590 * The **`toJSON()`** method of the Performance interface is a serializer; it returns a JSON representation of the Performance object.3591 *3592 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)3593 */3594 toJSON(): object;3595}3596interface Tracing {3597 enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;3598 startActiveSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;3599 startSpan(name: string): Span;3600 Span: typeof Span;3601}3602declare abstract class Span {3603 get isTraced(): boolean;3604 setAttribute(key: string, value: boolean | number | string): this;3605 setAttributes(attributes: Record<string, boolean | number | string | undefined>): this;3606 end(): void;3607}3608/**3609 * Represents the identity of a user authenticated via Cloudflare Access.3610 * This matches the result of calling /cdn-cgi/access/get-identity.3611 *3612 * The exact structure of the returned object depends on the identity provider3613 * configuration for the Access application. The fields below represent commonly3614 * available properties, but additional provider-specific fields may be present.3615 */3616interface CloudflareAccessIdentity extends Record<string, unknown> {3617 /** The user's email address, if available from the identity provider. */3618 email?: string;3619 /** The user's display name. */3620 name?: string;3621 /** The user's unique identifier. */3622 user_uuid?: string;3623 /** The Cloudflare account ID. */3624 account_id?: string;3625 /** Login timestamp (Unix epoch seconds). */3626 iat?: number;3627 /** The user's IP address at authentication time. */3628 ip?: string;3629 /** Authentication methods used (e.g., "pwd"). */3630 amr?: string[];3631 /** Identity provider information. */3632 idp?: {3633 id: string;3634 type: string;3635 };3636 /** Geographic information about where the user authenticated. */3637 geo?: {3638 country: string;3639 };3640 /** Group memberships from the identity provider. */3641 groups?: Array<{3642 id: string;3643 name: string;3644 email?: string;3645 }>;3646 /** Device posture check results, keyed by check ID. */3647 devicePosture?: Record<string, unknown>;3648 /** True if the user connected via Cloudflare WARP. */3649 is_warp?: boolean;3650 /** True if the user is authenticated via Cloudflare Gateway. */3651 is_gateway?: boolean;3652}3653// ============================================================================3654// Agent Memory3655//3656// Public type surface for user Workers binding to an Agent Memory namespace.3657// ============================================================================3658/** Memory type — every memory is classified into exactly one. */3659type AgentMemoryMemoryType = "fact" | "event" | "instruction" | "task";3660/** Search intensity for recall. */3661type AgentMemoryThinkingLevel = "low" | "medium" | "high";3662/** Response verbosity for recall. */3663type AgentMemoryResponseLength = "short" | "medium" | "long";3664/** A conversation message passed to ingest(). */3665interface AgentMemoryMessage {3666 role: "system" | "user" | "assistant";3667 content: string;3668 /** Optional message timestamp. */3669 timestamp?: Date;3670}3671/** Raw memory content passed to remember(). */3672interface AgentMemoryIncomingMemory {3673 /** Raw memory content. The service classifies and summarizes automatically. */3674 content: string;3675 /** Optional session identifier to associate with this memory. */3676 sessionId?: string | null | undefined;3677}3678/** A stored memory returned from remember(), get(), and delete(). */3679interface AgentMemoryMemory {3680 /** Memory ID. */3681 id: string;3682 /** Memory type. */3683 type: AgentMemoryMemoryType;3684 /** Text summary. */3685 summary: string;3686 /** Memory text. */3687 content: string;3688 /** Session that created this memory. */3689 sessionId: string | null;3690 /** Memory creation time. */3691 createdAt: Date;3692 /** Memory last-update time. */3693 updatedAt: Date;3694}3695/** Single entry in a list() response. Same shape as Memory minus full content. */3696type AgentMemoryMemoryListEntry = Omit<AgentMemoryMemory, "content">;3697/** A scored memory candidate in a recall result. */3698interface AgentMemoryScoredCandidate {3699 /** Candidate ID. */3700 id: string;3701 /** Text summary. */3702 summary: string;3703 /** Session that created this candidate, when known. */3704 sessionId: string | null;3705 /** Relevance score (higher is better). Comparable only within a single query. */3706 score: number;3707}3708/** Options for the ingest() method. */3709interface AgentMemoryIngestOptions {3710 /** Session identifier to associate with memories created during ingestion. */3711 sessionId?: string | null | undefined;3712}3713/** Options for the getSummary() method. */3714interface AgentMemoryGetSummaryOptions {3715 /** Session identifier to retrieve session summary for. */3716 sessionId?: string | null | undefined;3717}3718/** Response from the getSummary() method. */3719interface AgentMemoryGetSummaryResponse {3720 /** Markdown summary. */3721 summary: string;3722}3723/**3724 * Options for the recall() method.3725 *3726 * `referenceDate` accepts a Date object, an ISO-8601 date string3727 * (YYYY-MM-DD), or a full ISO-8601 datetime string. When provided, this3728 * date is used as "today" for resolving relative time references3729 * ("how many days ago", "last week") instead of the server's wall-clock time.3730 */3731interface AgentMemoryRecallOptions {3732 /** Recall intensity: "low" (default), "medium", or "high". */3733 thinkingLevel?: AgentMemoryThinkingLevel;3734 /** Response verbosity: "short", "medium" (default), or "long". */3735 responseLength?: AgentMemoryResponseLength;3736 /** Temporal anchor for date arithmetic. */3737 referenceDate?: Date | string;3738}3739/** Response from the recall() method. */3740interface AgentMemoryRecallResult {3741 /** Number of memories retrieved. */3742 count: number;3743 /** LLM-generated answer synthesizing the matching memories. */3744 answer: string;3745 /** Matching memories ranked by relevance. */3746 candidates: AgentMemoryScoredCandidate[];3747}3748/**3749 * Options for the list() method.3750 *3751 * `cursor` is the opaque continuation token returned by the previous page;3752 * pass it back unchanged to fetch the next page. `sessionId` and `type`3753 * are exact-match filters; combining them is allowed.3754 */3755interface AgentMemoryListMemoriesOptions {3756 /** Maximum number of memories to return. Default 20, max 500. */3757 limit?: number;3758 /** Opaque cursor from a previous page. */3759 cursor?: string;3760 /** Exact-match session filter. */3761 sessionId?: string;3762 /** Exact-match memory-type filter. */3763 type?: AgentMemoryMemoryType;3764}3765/** Response from the list() method. */3766interface AgentMemoryListMemoriesResult {3767 memories: AgentMemoryMemoryListEntry[];3768 /** Continuation cursor; absent when this page exhausted the result set. */3769 cursor?: string;3770}3771/**3772 * A single Agent Memory profile, scoped to a profile name.3773 *3774 * Returned by {@link AgentMemoryNamespace.getProfile}.3775 */3776declare abstract class AgentMemoryProfile {3777 /**3778 * Retrieve a memory by ID.3779 *3780 * @param memoryId - ULID of the memory to retrieve.3781 * @throws if the memory does not exist.3782 */3783 get(memoryId: string): Promise<AgentMemoryMemory>;3784 /**3785 * Delete a memory by ID.3786 *3787 * Removes the memory and any source messages linked by the memory's3788 * source message IDs.3789 *3790 * @param memoryId - ULID of the memory to delete.3791 * @throws if the memory does not exist.3792 */3793 delete(memoryId: string): Promise<AgentMemoryMemory>;3794 /**3795 * Store a memory in this profile. The content is automatically classified,3796 * summarized, and indexed.3797 *3798 * @param memory - Raw memory content to persist.3799 */3800 remember(memory: AgentMemoryIncomingMemory): Promise<AgentMemoryMemory>;3801 /**3802 * Extract memories from a conversation.3803 *3804 * @param messages - Conversation messages to extract memories from.3805 * @param options - Optional ingest options.3806 */3807 ingest(messages: Iterable<AgentMemoryMessage>, options?: AgentMemoryIngestOptions): Promise<void>;3808 /**3809 * Get a profile summary.3810 *3811 * @param options - Optional getSummary options.3812 */3813 getSummary(options?: AgentMemoryGetSummaryOptions): Promise<AgentMemoryGetSummaryResponse>;3814 /**3815 * Recall memories in this profile.3816 *3817 * @param query - Recall query matched against memory content and keywords.3818 * @param options - Optional recall parameters.3819 * @returns Matching memories with relevance scores and a synthesized answer.3820 */3821 recall(query: string, options?: AgentMemoryRecallOptions): Promise<AgentMemoryRecallResult>;3822 /**3823 * List active memories in this profile.3824 *3825 * Returns a paginated, filterable view of stored memories. Superseded3826 * versions are excluded. Use the returned `cursor` (when present) to3827 * fetch the next page.3828 *3829 * @param options - Optional pagination and filter options.3830 */3831 list(options?: AgentMemoryListMemoriesOptions): Promise<AgentMemoryListMemoriesResult>;3832 /**3833 * Soft-delete every memory and message in this profile that is tagged3834 * with `sessionId`.3835 *3836 * Idempotent: deleting a sessionId that has no rows is a no-op.3837 *3838 * @param sessionId - Session to delete.3839 */3840 deleteSession(sessionId: string): Promise<void>;3841}3842/**3843 * Namespace-level Agent Memory binding.3844 *3845 * Used as the type of an `env.MEMORY`-style binding backed by the Agent3846 * Memory product.3847 *3848 * @example3849 * ```ts3850 * export default {3851 * async fetch(_request: Request, env: Env): Promise<Response> {3852 * const profile = await env.MEMORY.getProfile("wrangler-e2e");3853 * const summary = await profile.getSummary();3854 * return Response.json(summary);3855 * },3856 * };3857 * ```3858 */3859declare abstract class AgentMemoryNamespace {3860 /**3861 * Get a memory profile by name. Profiles are isolated by namespace and3862 * addressed by a compound key (namespaceId:profileName).3863 *3864 * @param profileName - Profile name (validated against naming rules).3865 * @returns RPC target for interacting with the profile.3866 */3867 getProfile(profileName: string): Promise<AgentMemoryProfile>;3868 /**3869 * Soft-delete a profile and schedule deferred purge. Marks all3870 * memories and messages as deleted.3871 *3872 * @param profileName - Name of the profile to delete.3873 */3874 deleteProfile(profileName: string): Promise<void>;3875}3876// ============ AI Search Error Interfaces ============3877interface AiSearchInternalError extends Error {3878}3879interface AiSearchNotFoundError extends Error {3880}3881// ============ AI Search Common Types ============3882/** A single message in a conversation-style search or chat request. */3883type AiSearchMessage = {3884 role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';3885 content: string | null;3886};3887/**3888 * Common shape for `ai_search_options` used by both single-instance and multi-instance requests.3889 * Contains retrieval, query rewrite, reranking, and cache sub-options.3890 */3891type AiSearchOptions = {3892 retrieval?: {3893 /** Which retrieval backend to use. Defaults to the instance's configured index_method. */3894 retrieval_type?: 'vector' | 'keyword' | 'hybrid';3895 /** Fusion method for combining vector + keyword results. */3896 fusion_method?: 'max' | 'rrf';3897 /** How keyword terms are combined: "and" = all terms must match, "or" = any term matches. */3898 keyword_match_mode?: 'and' | 'or';3899 /** Minimum similarity score (0-1) for a result to be included. Default 0.4. */3900 match_threshold?: number;3901 /** Maximum number of results to return (1-50). Default 10. */3902 max_num_results?: number;3903 /** Vectorize metadata filters applied to the search. */3904 filters?: VectorizeVectorMetadataFilter;3905 /** Number of surrounding chunks to include for context (0-3). Default 0. */3906 context_expansion?: number;3907 /** If true, return only item metadata without chunk text. */3908 metadata_only?: boolean;3909 /** If true (default), return empty results on retrieval failure instead of throwing. */3910 return_on_failure?: boolean;3911 /** Boost results by metadata field values. Max 3 entries. */3912 boost_by?: Array<{3913 field: string;3914 direction?: 'asc' | 'desc' | 'exists' | 'not_exists';3915 }>;3916 [key: string]: unknown;3917 };3918 query_rewrite?: {3919 enabled?: boolean;3920 model?: string;3921 rewrite_prompt?: string;3922 [key: string]: unknown;3923 };3924 reranking?: {3925 enabled?: boolean;3926 model?: string;3927 /** Match threshold (0-1, default 0.4) */3928 match_threshold?: number;3929 [key: string]: unknown;3930 };3931 cache?: {3932 enabled?: boolean;3933 cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';3934 };3935 [key: string]: unknown;3936};3937// ============ AI Search Request Types ============3938/**3939 * Request body for single-instance search.3940 * Exactly one of `query` or `messages` must be provided.3941 */3942type AiSearchSearchRequest = {3943 /** Simple query string. */3944 query: string;3945 messages?: never;3946 ai_search_options?: AiSearchOptions;3947} | {3948 query?: never;3949 /** Conversation-style input. At least one user message with non-empty content is required. */3950 messages: AiSearchMessage[];3951 ai_search_options?: AiSearchOptions;3952};3953type AiSearchChatCompletionsRequest = {3954 messages: AiSearchMessage[];3955 model?: string;3956 stream?: boolean;3957 ai_search_options?: AiSearchOptions;3958 [key: string]: unknown;3959};3960// ============ AI Search Multi-Instance Types (Namespace-Scoped) ============3961/** `ai_search_options` shape for multi-instance requests — requires `instance_ids`. */3962type AiSearchMultiSearchOptions = AiSearchOptions & {3963 /** Instance IDs to search across (1-10). */3964 instance_ids: string[];3965};3966/**3967 * Request for searching across multiple instances within a namespace.3968 * `ai_search_options` is required and must include `instance_ids`.3969 * Exactly one of `query` or `messages` must be provided.3970 */3971type AiSearchMultiSearchRequest = {3972 /** Simple query string. */3973 query: string;3974 messages?: never;3975 ai_search_options: AiSearchMultiSearchOptions;3976} | {3977 query?: never;3978 /** Conversation-style input. */3979 messages: AiSearchMessage[];3980 ai_search_options: AiSearchMultiSearchOptions;3981};3982/** A search result chunk tagged with the instance it originated from. */3983type AiSearchMultiSearchChunk = AiSearchSearchResponse['chunks'][number] & {3984 instance_id: string;3985};3986/** Describes a per-instance error during a multi-instance operation. */3987type AiSearchMultiSearchError = {3988 instance_id: string;3989 message: string;3990};3991/** Response from a multi-instance search, with chunks tagged by instance and optional partial-failure errors. */3992type AiSearchMultiSearchResponse = {3993 search_query: string;3994 chunks: AiSearchMultiSearchChunk[];3995 errors?: AiSearchMultiSearchError[];3996};3997/** Request for chat completions across multiple instances within a namespace. `ai_search_options` is required and must include `instance_ids`. */3998type AiSearchMultiChatCompletionsRequest = Omit<AiSearchChatCompletionsRequest, 'ai_search_options'> & {3999 ai_search_options: AiSearchMultiSearchOptions;4000};4001/** Response from multi-instance chat completions, with chunks tagged by instance and optional partial-failure errors. */4002type AiSearchMultiChatCompletionsResponse = Omit<AiSearchChatCompletionsResponse, 'chunks'> & {4003 chunks: AiSearchMultiSearchChunk[];4004 errors?: AiSearchMultiSearchError[];4005};4006// ============ AI Search Response Types ============4007type AiSearchSearchResponse = {4008 search_query: string;4009 chunks: Array<{4010 id: string;4011 type: string;4012 /** Match score (0-1) */4013 score: number;4014 text: string;4015 item: {4016 timestamp?: number;4017 key: string;4018 metadata?: Record<string, unknown>;4019 };4020 scoring_details?: {4021 /** Keyword match score (0-1) */4022 keyword_score?: number;4023 /** Vector similarity score (0-1) */4024 vector_score?: number;4025 /** Keyword rank position */4026 keyword_rank?: number;4027 /** Vector rank position */4028 vector_rank?: number;4029 /** Reranking model score */4030 reranking_score?: number;4031 /** Fusion method used to combine results */4032 fusion_method?: 'rrf' | 'max';4033 [key: string]: unknown;4034 };4035 }>;4036};4037type AiSearchChatCompletionsResponse = {4038 id?: string;4039 object?: string;4040 model?: string;4041 choices: Array<{4042 index?: number;4043 message: {4044 role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';4045 content: string | null;4046 [key: string]: unknown;4047 };4048 [key: string]: unknown;4049 }>;4050 chunks: AiSearchSearchResponse['chunks'];4051 [key: string]: unknown;4052};4053type AiSearchStatsResponse = {4054 queued?: number;4055 running?: number;4056 completed?: number;4057 error?: number;4058 skipped?: number;4059 outdated?: number;4060 last_activity?: string;4061 /** Storage engine statistics. */4062 engine?: {4063 vectorize?: {4064 vectorsCount: number;4065 dimensions: number;4066 };4067 r2?: {4068 payloadSizeBytes: number;4069 metadataSizeBytes: number;4070 objectCount: number;4071 };4072 };4073};4074// ============ AI Search Instance Info Types ============4075type AiSearchInstanceInfo = {4076 id: string;4077 type?: 'r2' | 'web-crawler' | string;4078 source?: string;4079 source_params?: unknown;4080 paused?: boolean;4081 status?: string;4082 namespace?: string;4083 created_at?: string;4084 modified_at?: string;4085 token_id?: string;4086 ai_gateway_id?: string;4087 rewrite_query?: boolean;4088 reranking?: boolean;4089 embedding_model?: string;4090 ai_search_model?: string;4091 rewrite_model?: string;4092 reranking_model?: string;4093 /** @deprecated Use index_method instead. */4094 hybrid_search_enabled?: boolean;4095 /** Controls which storage backends are active. */4096 index_method?: {4097 vector?: boolean;4098 keyword?: boolean;4099 };4100 /** Fusion method for combining vector and keyword results. */4101 fusion_method?: 'max' | 'rrf';4102 indexing_options?: {4103 keyword_tokenizer?: 'porter' | 'trigram';4104 } | null;4105 retrieval_options?: {4106 keyword_match_mode?: 'and' | 'or';4107 boost_by?: Array<{4108 field: string;4109 direction?: 'asc' | 'desc' | 'exists' | 'not_exists';4110 }>;4111 } | null;4112 chunk?: boolean;4113 chunk_size?: number;4114 chunk_overlap?: number;4115 score_threshold?: number;4116 max_num_results?: number;4117 cache?: boolean;4118 cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';4119 custom_metadata?: Array<{4120 field_name: string;4121 data_type: 'text' | 'number' | 'boolean' | 'datetime';4122 }>;4123 /** Sync interval in seconds. */4124 sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400;4125 metadata?: Record<string, unknown>;4126 [key: string]: unknown;4127};4128/** Pagination, search, and ordering parameters for listing instances within a namespace. */4129type AiSearchListInstancesParams = {4130 page?: number;4131 per_page?: number;4132 /** Search instances by ID. */4133 search?: string;4134 /** Field to sort by. */4135 order_by?: 'created_at';4136 /** Sort direction. */4137 order_by_direction?: 'asc' | 'desc';4138};4139type AiSearchListResponse = {4140 result: AiSearchInstanceInfo[];4141 result_info?: {4142 count: number;4143 page: number;4144 per_page: number;4145 total_count: number;4146 };4147};4148// ============ AI Search Config Types ============4149type AiSearchConfig = {4150 /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */4151 id: string;4152 /** Instance type. Omit to create with built-in storage. */4153 type?: 'r2' | 'web-crawler' | string;4154 /** Source URL (required for web-crawler type). */4155 source?: string;4156 source_params?: unknown;4157 /** Token ID (UUID format) */4158 token_id?: string;4159 ai_gateway_id?: string;4160 /** Enable query rewriting (default false) */4161 rewrite_query?: boolean;4162 /** Enable reranking (default false) */4163 reranking?: boolean;4164 embedding_model?: string;4165 ai_search_model?: string;4166 rewrite_model?: string;4167 reranking_model?: string;4168 /** @deprecated Use index_method instead. */4169 hybrid_search_enabled?: boolean;4170 /** Controls which storage backends are used during indexing. Defaults to vector-only. */4171 index_method?: {4172 vector?: boolean;4173 keyword?: boolean;4174 };4175 /** Fusion method for combining vector and keyword results. "rrf" = reciprocal rank fusion (default), "max" = maximum score. */4176 fusion_method?: 'max' | 'rrf';4177 indexing_options?: {4178 keyword_tokenizer?: 'porter' | 'trigram';4179 } | null;4180 retrieval_options?: {4181 keyword_match_mode?: 'and' | 'or';4182 boost_by?: Array<{4183 field: string;4184 direction?: 'asc' | 'desc' | 'exists' | 'not_exists';4185 }>;4186 } | null;4187 chunk?: boolean;4188 chunk_size?: number;4189 chunk_overlap?: number;4190 /** Minimum similarity score (0-1) for a result to be included. */4191 score_threshold?: number;4192 max_num_results?: number;4193 cache?: boolean;4194 /** Similarity threshold for cache hits. Stricter = fewer cache hits but higher relevance. */4195 cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes';4196 custom_metadata?: Array<{4197 field_name: string;4198 data_type: 'text' | 'number' | 'boolean' | 'datetime';4199 }>;4200 namespace?: string;4201 /** Sync interval in seconds. 3600=1h, 7200=2h, 14400=4h, 21600=6h, 43200=12h, 86400=24h. */4202 sync_interval?: 3600 | 7200 | 14400 | 21600 | 43200 | 86400;4203 metadata?: Record<string, unknown>;4204 [key: string]: unknown;4205};4206// ============ AI Search Item Types ============4207type AiSearchItemInfo = {4208 id: string;4209 key: string;4210 status: 'completed' | 'error' | 'skipped' | 'queued' | 'running' | 'outdated';4211 next_action?: 'INDEX' | 'DELETE' | null;4212 error?: string;4213 checksum?: string;4214 namespace?: string;4215 chunks_count?: number | null;4216 file_size?: number | null;4217 source_id?: string | null;4218 last_seen_at?: string;4219 created_at?: string;4220 metadata?: Record<string, unknown>;4221 [key: string]: unknown;4222};4223type AiSearchItemContentResult = {4224 body: ReadableStream;4225 contentType: string;4226 filename: string;4227 size: number;4228};4229type AiSearchUploadItemOptions = {4230 metadata?: Record<string, unknown>;4231};4232type AiSearchListItemsParams = {4233 page?: number;4234 per_page?: number;4235 /** Search items by key name. */4236 search?: string;4237 /** Sort order for results. */4238 sort_by?: 'status' | 'modified_at';4239 /** Filter items by processing status. */4240 status?: 'queued' | 'running' | 'completed' | 'error' | 'skipped' | 'outdated';4241 /** Filter items by source (e.g. "builtin" or "web-crawler:https://example.com"). */4242 source?: string;4243 /** JSON-encoded Vectorize filter for metadata filtering. */4244 metadata_filter?: string;4245 /** Filter items by their unique ID. Returns at most one item. */4246 item_id?: string;4247 /**4248 * Filter items by their exact key (object key / filename). Keys are unique4249 * per source, so combine with `source` to disambiguate across data sources.4250 */4251 key?: string;4252};4253type AiSearchListItemsResponse = {4254 result: AiSearchItemInfo[];4255 result_info?: {4256 count: number;4257 page: number;4258 per_page: number;4259 total_count: number;4260 };4261};4262// ============ AI Search Item Logs Types ============4263type AiSearchItemLogsParams = {4264 /** Maximum number of log entries to return (1-100, default 50). */4265 limit?: number;4266 /** Opaque cursor for pagination. Pass the `cursor` value from a previous response. */4267 cursor?: string;4268};4269type AiSearchItemLog = {4270 timestamp: string;4271 action: string;4272 message: string;4273 fileKey?: string;4274 chunkCount?: number;4275 processingTimeMs?: number;4276 errorType?: string;4277};4278/** Paginated response for item processing logs (cursor-based). */4279type AiSearchItemLogsResponse = {4280 result: AiSearchItemLog[];4281 result_info: {4282 count: number;4283 per_page: number;4284 cursor: string | null;4285 truncated: boolean;4286 };4287};4288// ============ AI Search Item Chunks Types ============4289type AiSearchItemChunksParams = {4290 /** Maximum number of chunks to return (1-100, default 20). */4291 limit?: number;4292 /** Offset into the chunks list (default 0). */4293 offset?: number;4294};4295/** A single indexed chunk belonging to an item, including its text content and byte range. */4296type AiSearchItemChunk = {4297 id: string;4298 text: string;4299 start_byte: number;4300 end_byte: number;4301 item?: {4302 timestamp?: number;4303 key: string;4304 metadata?: Record<string, unknown>;4305 };4306};4307/** Paginated response for item chunks (offset-based). */4308type AiSearchItemChunksResponse = {4309 result: AiSearchItemChunk[];4310 result_info: {4311 count: number;4312 total: number;4313 limit: number;4314 offset: number;4315 };4316};4317// ============ AI Search Job Types ============4318type AiSearchJobInfo = {4319 id: string;4320 source: 'user' | 'schedule';4321 description?: string;4322 last_seen_at?: string;4323 started_at?: string;4324 ended_at?: string;4325 end_reason?: string;4326};4327type AiSearchJobLog = {4328 id: number;4329 message: string;4330 message_type: number;4331 created_at: number;4332};4333type AiSearchCreateJobParams = {4334 description?: string;4335};4336type AiSearchListJobsParams = {4337 page?: number;4338 per_page?: number;4339};4340type AiSearchListJobsResponse = {4341 result: AiSearchJobInfo[];4342 result_info?: {4343 count: number;4344 page: number;4345 per_page: number;4346 total_count: number;4347 };4348};4349type AiSearchJobLogsParams = {4350 page?: number;4351 per_page?: number;4352};4353type AiSearchJobLogsResponse = {4354 result: AiSearchJobLog[];4355 result_info?: {4356 count: number;4357 page: number;4358 per_page: number;4359 total_count: number;4360 };4361};4362// ============ AI Search Sub-Service Classes ============4363/**4364 * Single item service for an AI Search instance.4365 * Provides info, download, sync, logs, and chunks operations on a specific item.4366 */4367declare abstract class AiSearchItem {4368 /** Get metadata about this item. */4369 info(): Promise<AiSearchItemInfo>;4370 /**4371 * Download the item's content.4372 * @returns Object with body stream, content type, filename, and size.4373 */4374 download(): Promise<AiSearchItemContentResult>;4375 /**4376 * Trigger re-indexing of this item.4377 * @returns The updated item info.4378 */4379 sync(): Promise<AiSearchItemInfo>;4380 /**4381 * Retrieve processing logs for this item (cursor-based pagination).4382 * @param params Optional pagination parameters (limit, cursor).4383 * @returns Paginated log entries for this item.4384 */4385 logs(params?: AiSearchItemLogsParams): Promise<AiSearchItemLogsResponse>;4386 /**4387 * List indexed chunks for this item (offset-based pagination).4388 * @param params Optional pagination parameters (limit, offset).4389 * @returns Paginated chunk entries for this item.4390 */4391 chunks(params?: AiSearchItemChunksParams): Promise<AiSearchItemChunksResponse>;4392}4393/**4394 * Items collection service for an AI Search instance.4395 * Provides list, upload, and access to individual items.4396 */4397declare abstract class AiSearchItems {4398 /** List items in this instance. */4399 list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;4400 /**4401 * Upload a file as an item. Behaves as an upsert: if an item with the same4402 * filename already exists, it is overwritten and re-indexed.4403 * @param name Filename for the uploaded item.4404 * @param content File content as a ReadableStream, Blob, or string.4405 * @param options Optional metadata to attach to the item.4406 * @returns The created item info.4407 */4408 upload(name: string, content: ReadableStream | Blob | string, options?: AiSearchUploadItemOptions): Promise<AiSearchItemInfo>;4409 /**4410 * Upload a file and poll until processing completes.4411 * Behaves as an upsert: if an item with the same filename already exists,4412 * it is overwritten and re-indexed.4413 * @param name Filename for the uploaded item.4414 * @param content File content as a ReadableStream, Blob, or string.4415 * @param options Optional metadata and polling configuration.4416 * @returns The item info after processing completes (or timeout).4417 */4418 uploadAndPoll(name: string, content: ReadableStream | Blob | string, options?: AiSearchUploadItemOptions & {4419 /** Polling interval in milliseconds (default 1000). */4420 pollIntervalMs?: number;4421 /** Maximum time to wait in milliseconds (default 30000). */4422 timeoutMs?: number;4423 }): Promise<AiSearchItemInfo>;4424 /**4425 * Get an item by ID.4426 * @param itemId The item identifier.4427 * @returns Item service for info, download, sync, logs, and chunks operations.4428 */4429 get(itemId: string): AiSearchItem;4430 /**4431 * Delete an item from the instance.4432 * @param itemId The item identifier.4433 */4434 delete(itemId: string): Promise<void>;4435}4436/**4437 * Single job service for an AI Search instance.4438 * Provides info, logs, and cancel operations for a specific job.4439 */4440declare abstract class AiSearchJob {4441 /** Get metadata about this job. */4442 info(): Promise<AiSearchJobInfo>;4443 /** Get logs for this job. */4444 logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;4445 /**4446 * Cancel a running job.4447 * @returns The updated job info.4448 * @throws AiSearchNotFoundError if the job does not exist.4449 */4450 cancel(): Promise<AiSearchJobInfo>;4451}4452/**4453 * Jobs collection service for an AI Search instance.4454 * Provides list, create, and access to individual jobs.4455 */4456declare abstract class AiSearchJobs {4457 /** List jobs for this instance. */4458 list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;4459 /**4460 * Create a new indexing job.4461 * @param params Optional job parameters.4462 * @returns The created job info.4463 */4464 create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;4465 /**4466 * Get a job by ID.4467 * @param jobId The job identifier.4468 * @returns Job service for info, logs, and cancel operations.4469 */4470 get(jobId: string): AiSearchJob;4471}4472// ============ AI Search Binding Classes ============4473/**4474 * Instance-level AI Search service.4475 *4476 * Used as:4477 * - The return type of `AiSearchNamespace.get(name)` (namespace binding)4478 * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)4479 *4480 * Provides search, chat, update, stats, items, and jobs operations.4481 *4482 * @example4483 * ```ts4484 * // Via namespace binding4485 * const instance = env.AI_SEARCH.get("blog");4486 * const results = await instance.search({4487 * query: "How does caching work?",4488 * });4489 *4490 * // Via single instance binding4491 * const results = await env.BLOG_SEARCH.search({4492 * messages: [{ role: "user", content: "How does caching work?" }],4493 * });4494 * ```4495 */4496declare abstract class AiSearchInstance {4497 /**4498 * Search the AI Search instance for relevant chunks.4499 * @param params Search request with query or messages and optional AI search options.4500 * @returns Search response with matching chunks and search query.4501 */4502 search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;4503 /**4504 * Generate chat completions with AI Search context (streaming).4505 * @param params Chat completions request with stream: true.4506 * @returns ReadableStream of server-sent events.4507 */4508 chatCompletions(params: AiSearchChatCompletionsRequest & {4509 stream: true;4510 }): Promise<ReadableStream>;4511 /**4512 * Generate chat completions with AI Search context.4513 * @param params Chat completions request.4514 * @returns Chat completion response with choices and RAG chunks.4515 */4516 chatCompletions(params: AiSearchChatCompletionsRequest): Promise<AiSearchChatCompletionsResponse>;4517 /**4518 * Update the instance configuration.4519 * @param config Partial configuration to update.4520 * @returns Updated instance info.4521 */4522 update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;4523 /** Get metadata about this instance. */4524 info(): Promise<AiSearchInstanceInfo>;4525 /**4526 * Get instance statistics (item count, indexing status, etc.).4527 * @returns Statistics with counts per status, last activity time, and engine details.4528 */4529 stats(): Promise<AiSearchStatsResponse>;4530 /** Items collection — list, upload, and manage items in this instance. */4531 get items(): AiSearchItems;4532 /** Jobs collection — list, create, and inspect indexing jobs. */4533 get jobs(): AiSearchJobs;4534}4535/**4536 * Namespace-level AI Search service.4537 *4538 * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).4539 * Scoped to a single namespace. Provides dynamic instance access, creation, deletion,4540 * and multi-instance search/chat operations.4541 *4542 * @example4543 * ```ts4544 * // Access an instance within the namespace4545 * const blog = env.AI_SEARCH.get("blog");4546 * const results = await blog.search({ query: "How does caching work?" });4547 *4548 * // List all instances in the namespace4549 * const instances = await env.AI_SEARCH.list();4550 *4551 * // Create a new instance with built-in storage4552 * const tenant = await env.AI_SEARCH.create({ id: "tenant-123" });4553 *4554 * // Upload items into the instance4555 * await tenant.items.upload("doc.pdf", fileContent);4556 *4557 * // Search across multiple instances4558 * const multi = await env.AI_SEARCH.search({4559 * query: "caching",4560 * ai_search_options: { instance_ids: ["blog", "docs"] },4561 * });4562 *4563 * // Delete an instance4564 * await env.AI_SEARCH.delete("tenant-123");4565 * ```4566 */4567declare abstract class AiSearchNamespace {4568 /**4569 * Get an instance by name within the bound namespace.4570 * @param name Instance name.4571 * @returns Instance service for search, chat, update, stats, items, and jobs.4572 */4573 get(name: string): AiSearchInstance;4574 /**4575 * List instances in the bound namespace.4576 * @param params Optional pagination, search, and ordering parameters.4577 * @returns Array of instance metadata with pagination info.4578 */4579 list(params?: AiSearchListInstancesParams): Promise<AiSearchListResponse>;4580 /**4581 * Create a new instance within the bound namespace.4582 * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.4583 * @returns Instance service for the newly created instance.4584 *4585 * @example4586 * ```ts4587 * // Create with built-in storage (upload items manually)4588 * const instance = await env.AI_SEARCH.create({ id: "my-search" });4589 *4590 * // Create with web crawler source4591 * const instance = await env.AI_SEARCH.create({4592 * id: "docs-search",4593 * type: "web-crawler",4594 * source: "https://developers.cloudflare.com",4595 * });4596 * ```4597 */4598 create(config: AiSearchConfig): Promise<AiSearchInstance>;4599 /**4600 * Delete an instance from the bound namespace.4601 * @param name Instance name to delete.4602 */4603 delete(name: string): Promise<void>;4604 /**4605 * Search across multiple instances within the bound namespace.4606 * Fans out to the specified instance_ids and merges results.4607 * @param params Search request with required `ai_search_options.instance_ids`.4608 * @returns Search response with chunks tagged by instance_id and optional partial-failure errors.4609 */4610 search(params: AiSearchMultiSearchRequest): Promise<AiSearchMultiSearchResponse>;4611 /**4612 * Generate chat completions across multiple instances within the bound namespace (streaming).4613 * Fans out to the specified instance_ids, merges context, and generates a response.4614 * @param params Chat completions request with stream: true and required `ai_search_options.instance_ids`.4615 * @returns ReadableStream of server-sent events.4616 */4617 chatCompletions(params: AiSearchMultiChatCompletionsRequest & {4618 stream: true;4619 }): Promise<ReadableStream>;4620 /**4621 * Generate chat completions across multiple instances within the bound namespace.4622 * Fans out to the specified instance_ids, merges context, and generates a response.4623 * @param params Chat completions request with required `ai_search_options.instance_ids`.4624 * @returns Chat completion response with choices, chunks tagged by instance_id, and optional partial-failure errors.4625 */4626 chatCompletions(params: AiSearchMultiChatCompletionsRequest): Promise<AiSearchMultiChatCompletionsResponse>;4627}4628type AiImageClassificationInput = {4629 image: number[];4630};4631type AiImageClassificationOutput = {4632 score?: number;4633 label?: string;4634}[];4635declare abstract class BaseAiImageClassification {4636 inputs: AiImageClassificationInput;4637 postProcessedOutputs: AiImageClassificationOutput;4638}4639type AiImageToTextInput = {4640 image: number[];4641 prompt?: string;4642 max_tokens?: number;4643 temperature?: number;4644 top_p?: number;4645 top_k?: number;4646 seed?: number;4647 repetition_penalty?: number;4648 frequency_penalty?: number;4649 presence_penalty?: number;4650 raw?: boolean;4651 messages?: RoleScopedChatInput[];4652};4653type AiImageToTextOutput = {4654 description: string;4655};4656declare abstract class BaseAiImageToText {4657 inputs: AiImageToTextInput;4658 postProcessedOutputs: AiImageToTextOutput;4659}4660type AiImageTextToTextInput = {4661 image: string;4662 prompt?: string;4663 max_tokens?: number;4664 temperature?: number;4665 ignore_eos?: boolean;4666 top_p?: number;4667 top_k?: number;4668 seed?: number;4669 repetition_penalty?: number;4670 frequency_penalty?: number;4671 presence_penalty?: number;4672 raw?: boolean;4673 messages?: RoleScopedChatInput[];4674};4675type AiImageTextToTextOutput = {4676 description: string;4677};4678declare abstract class BaseAiImageTextToText {4679 inputs: AiImageTextToTextInput;4680 postProcessedOutputs: AiImageTextToTextOutput;4681}4682type AiMultimodalEmbeddingsInput = {4683 image: string;4684 text: string[];4685};4686type AiIMultimodalEmbeddingsOutput = {4687 data: number[][];4688 shape: number[];4689};4690declare abstract class BaseAiMultimodalEmbeddings {4691 inputs: AiImageTextToTextInput;4692 postProcessedOutputs: AiImageTextToTextOutput;4693}4694type AiObjectDetectionInput = {4695 image: number[];4696};4697type AiObjectDetectionOutput = {4698 score?: number;4699 label?: string;4700}[];4701declare abstract class BaseAiObjectDetection {4702 inputs: AiObjectDetectionInput;4703 postProcessedOutputs: AiObjectDetectionOutput;4704}4705type AiSentenceSimilarityInput = {4706 source: string;4707 sentences: string[];4708};4709type AiSentenceSimilarityOutput = number[];4710declare abstract class BaseAiSentenceSimilarity {4711 inputs: AiSentenceSimilarityInput;4712 postProcessedOutputs: AiSentenceSimilarityOutput;4713}4714type AiAutomaticSpeechRecognitionInput = {4715 audio: number[];4716};4717type AiAutomaticSpeechRecognitionOutput = {4718 text?: string;4719 words?: {4720 word: string;4721 start: number;4722 end: number;4723 }[];4724 vtt?: string;4725};4726declare abstract class BaseAiAutomaticSpeechRecognition {4727 inputs: AiAutomaticSpeechRecognitionInput;4728 postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;4729}4730type AiSummarizationInput = {4731 input_text: string;4732 max_length?: number;4733};4734type AiSummarizationOutput = {4735 summary: string;4736};4737declare abstract class BaseAiSummarization {4738 inputs: AiSummarizationInput;4739 postProcessedOutputs: AiSummarizationOutput;4740}4741type AiTextClassificationInput = {4742 text: string;4743};4744type AiTextClassificationOutput = {4745 score?: number;4746 label?: string;4747}[];4748declare abstract class BaseAiTextClassification {4749 inputs: AiTextClassificationInput;4750 postProcessedOutputs: AiTextClassificationOutput;4751}4752type AiTextEmbeddingsInput = {4753 text: string | string[];4754};4755type AiTextEmbeddingsOutput = {4756 shape: number[];4757 data: number[][];4758};4759declare abstract class BaseAiTextEmbeddings {4760 inputs: AiTextEmbeddingsInput;4761 postProcessedOutputs: AiTextEmbeddingsOutput;4762}4763type RoleScopedChatInput = {4764 role: "user" | "assistant" | "system" | "tool" | (string & NonNullable<unknown>);4765 content: string;4766 name?: string;4767};4768type AiTextGenerationToolLegacyInput = {4769 name: string;4770 description: string;4771 parameters?: {4772 type: "object" | (string & NonNullable<unknown>);4773 properties: {4774 [key: string]: {4775 type: string;4776 description?: string;4777 };4778 };4779 required: string[];4780 };4781};4782type AiTextGenerationToolInput = {4783 type: "function" | (string & NonNullable<unknown>);4784 function: {4785 name: string;4786 description: string;4787 parameters?: {4788 type: "object" | (string & NonNullable<unknown>);4789 properties: {4790 [key: string]: {4791 type: string;4792 description?: string;4793 };4794 };4795 required: string[];4796 };4797 };4798};4799type AiTextGenerationFunctionsInput = {4800 name: string;4801 code: string;4802};4803type AiTextGenerationResponseFormat = {4804 type: string;4805 json_schema?: any;4806};4807type AiTextGenerationInput = {4808 prompt?: string;4809 raw?: boolean;4810 stream?: boolean;4811 max_tokens?: number;4812 temperature?: number;4813 top_p?: number;4814 top_k?: number;4815 seed?: number;4816 repetition_penalty?: number;4817 frequency_penalty?: number;4818 presence_penalty?: number;4819 messages?: RoleScopedChatInput[];4820 response_format?: AiTextGenerationResponseFormat;4821 tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>);4822 functions?: AiTextGenerationFunctionsInput[];4823};4824type AiTextGenerationToolLegacyOutput = {4825 name: string;4826 arguments: unknown;4827};4828type AiTextGenerationToolOutput = {4829 id: string;4830 type: "function";4831 function: {4832 name: string;4833 arguments: string;4834 };4835};4836type UsageTags = {4837 prompt_tokens: number;4838 completion_tokens: number;4839 total_tokens: number;4840};4841type AiTextGenerationOutput = {4842 response?: string;4843 tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[];4844 usage?: UsageTags;4845};4846declare abstract class BaseAiTextGeneration {4847 inputs: AiTextGenerationInput;4848 postProcessedOutputs: AiTextGenerationOutput;4849}4850type AiTextToSpeechInput = {4851 prompt: string;4852 lang?: string;4853};4854type AiTextToSpeechOutput = Uint8Array | {4855 audio: string;4856};4857declare abstract class BaseAiTextToSpeech {4858 inputs: AiTextToSpeechInput;4859 postProcessedOutputs: AiTextToSpeechOutput;4860}4861type AiTextToImageInput = {4862 prompt: string;4863 negative_prompt?: string;4864 height?: number;4865 width?: number;4866 image?: number[];4867 image_b64?: string;4868 mask?: number[];4869 num_steps?: number;4870 strength?: number;4871 guidance?: number;4872 seed?: number;4873};4874type AiTextToImageOutput = ReadableStream<Uint8Array>;4875declare abstract class BaseAiTextToImage {4876 inputs: AiTextToImageInput;4877 postProcessedOutputs: AiTextToImageOutput;4878}4879type AiTranslationInput = {4880 text: string;4881 target_lang: string;4882 source_lang?: string;4883};4884type AiTranslationOutput = {4885 translated_text?: string;4886};4887declare abstract class BaseAiTranslation {4888 inputs: AiTranslationInput;4889 postProcessedOutputs: AiTranslationOutput;4890}4891/**4892 * Workers AI support for OpenAI's Chat Completions API4893 */4894type ChatCompletionContentPartText = {4895 type: "text";4896 text: string;4897};4898type ChatCompletionContentPartImage = {4899 type: "image_url";4900 image_url: {4901 url: string;4902 detail?: "auto" | "low" | "high";4903 };4904};4905type ChatCompletionContentPartInputAudio = {4906 type: "input_audio";4907 input_audio: {4908 /** Base64 encoded audio data. */4909 data: string;4910 format: "wav" | "mp3";4911 };4912};4913type ChatCompletionContentPartFile = {4914 type: "file";4915 file: {4916 /** Base64 encoded file data. */4917 file_data?: string;4918 /** The ID of an uploaded file. */4919 file_id?: string;4920 filename?: string;4921 };4922};4923type ChatCompletionContentPartRefusal = {4924 type: "refusal";4925 refusal: string;4926};4927type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage | ChatCompletionContentPartInputAudio | ChatCompletionContentPartFile;4928type FunctionDefinition = {4929 name: string;4930 description?: string;4931 parameters?: Record<string, unknown>;4932 strict?: boolean | null;4933};4934type ChatCompletionFunctionTool = {4935 type: "function";4936 function: FunctionDefinition;4937};4938type ChatCompletionCustomToolGrammarFormat = {4939 type: "grammar";4940 grammar: {4941 definition: string;4942 syntax: "lark" | "regex";4943 };4944};4945type ChatCompletionCustomToolTextFormat = {4946 type: "text";4947};4948type ChatCompletionCustomToolFormat = ChatCompletionCustomToolTextFormat | ChatCompletionCustomToolGrammarFormat;4949type ChatCompletionCustomTool = {4950 type: "custom";4951 custom: {4952 name: string;4953 description?: string;4954 format?: ChatCompletionCustomToolFormat;4955 };4956};4957type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool;4958type ChatCompletionMessageFunctionToolCall = {4959 id: string;4960 type: "function";4961 function: {4962 name: string;4963 /** JSON-encoded arguments string. */4964 arguments: string;4965 };4966};4967type ChatCompletionMessageCustomToolCall = {4968 id: string;4969 type: "custom";4970 custom: {4971 name: string;4972 input: string;4973 };4974};4975type ChatCompletionMessageToolCall = ChatCompletionMessageFunctionToolCall | ChatCompletionMessageCustomToolCall;4976type ChatCompletionToolChoiceFunction = {4977 type: "function";4978 function: {4979 name: string;4980 };4981};4982type ChatCompletionToolChoiceCustom = {4983 type: "custom";4984 custom: {4985 name: string;4986 };4987};4988type ChatCompletionToolChoiceAllowedTools = {4989 type: "allowed_tools";4990 allowed_tools: {4991 mode: "auto" | "required";4992 tools: Array<Record<string, unknown>>;4993 };4994};4995type ChatCompletionToolChoiceOption = "none" | "auto" | "required" | ChatCompletionToolChoiceFunction | ChatCompletionToolChoiceCustom | ChatCompletionToolChoiceAllowedTools;4996type DeveloperMessage = {4997 role: "developer";4998 content: string | Array<{4999 type: "text";5000 text: string;5001 }>;5002 name?: string;5003};5004type SystemMessage = {5005 role: "system";5006 content: string | Array<{5007 type: "text";5008 text: string;5009 }>;5010 name?: string;5011};5012/**5013 * Permissive merged content part used inside UserMessage arrays.5014 *5015 * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination5016 * inside nested array items does not correctly match different branches for5017 * different array elements, so the schema uses a single merged object.5018 */5019type UserMessageContentPart = {5020 type: "text" | "image_url" | "input_audio" | "file";5021 text?: string;5022 image_url?: {5023 url?: string;5024 detail?: "auto" | "low" | "high";5025 };5026 input_audio?: {5027 data?: string;5028 format?: "wav" | "mp3";5029 };5030 file?: {5031 file_data?: string;5032 file_id?: string;5033 filename?: string;5034 };5035};5036type UserMessage = {5037 role: "user";5038 content: string | Array<UserMessageContentPart>;5039 name?: string;5040};5041type AssistantMessageContentPart = {5042 type: "text" | "refusal";5043 text?: string;5044 refusal?: string;5045};5046type AssistantMessage = {5047 role: "assistant";5048 content?: string | null | Array<AssistantMessageContentPart>;5049 refusal?: string | null;5050 name?: string;5051 audio?: {5052 id: string;5053 };5054 tool_calls?: Array<ChatCompletionMessageToolCall>;5055 function_call?: {5056 name: string;5057 arguments: string;5058 };5059};5060type ToolMessage = {5061 role: "tool";5062 content: string | Array<{5063 type: "text";5064 text: string;5065 }>;5066 tool_call_id: string;5067};5068type FunctionMessage = {5069 role: "function";5070 content: string;5071 name: string;5072};5073type ChatCompletionMessageParam = DeveloperMessage | SystemMessage | UserMessage | AssistantMessage | ToolMessage | FunctionMessage;5074type ChatCompletionsResponseFormatText = {5075 type: "text";5076};5077type ChatCompletionsResponseFormatJSONObject = {5078 type: "json_object";5079};5080type ResponseFormatJSONSchema = {5081 type: "json_schema";5082 json_schema: {5083 name: string;5084 description?: string;5085 schema?: Record<string, unknown>;5086 strict?: boolean | null;5087 };5088};5089type ResponseFormat = ChatCompletionsResponseFormatText | ChatCompletionsResponseFormatJSONObject | ResponseFormatJSONSchema;5090type ChatCompletionsStreamOptions = {5091 include_usage?: boolean;5092 include_obfuscation?: boolean;5093};5094type PredictionContent = {5095 type: "content";5096 content: string | Array<{5097 type: "text";5098 text: string;5099 }>;5100};5101type AudioParams = {5102 voice: string | {5103 id: string;5104 };5105 format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16";5106};5107type WebSearchUserLocation = {5108 type: "approximate";5109 approximate: {5110 city?: string;5111 country?: string;5112 region?: string;5113 timezone?: string;5114 };5115};5116type WebSearchOptions = {5117 search_context_size?: "low" | "medium" | "high";5118 user_location?: WebSearchUserLocation;5119};5120type ChatTemplateKwargs = {5121 /** Whether to enable reasoning, enabled by default. */5122 enable_thinking?: boolean;5123 /** If false, preserves reasoning context between turns. */5124 clear_thinking?: boolean;5125};5126/** Shared optional properties used by both Prompt and Messages input branches. */5127type ChatCompletionsCommonOptions = {5128 model?: string;5129 audio?: AudioParams;5130 frequency_penalty?: number | null;5131 logit_bias?: Record<string, unknown> | null;5132 logprobs?: boolean | null;5133 top_logprobs?: number | null;5134 max_tokens?: number | null;5135 max_completion_tokens?: number | null;5136 metadata?: Record<string, unknown> | null;5137 modalities?: Array<"text" | "audio"> | null;5138 n?: number | null;5139 parallel_tool_calls?: boolean;5140 prediction?: PredictionContent;5141 presence_penalty?: number | null;5142 reasoning_effort?: "low" | "medium" | "high" | null;5143 chat_template_kwargs?: ChatTemplateKwargs;5144 response_format?: ResponseFormat;5145 seed?: number | null;5146 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;5147 stop?: string | Array<string> | null;5148 store?: boolean | null;5149 stream?: boolean | null;5150 stream_options?: ChatCompletionsStreamOptions;5151 temperature?: number | null;5152 tool_choice?: ChatCompletionToolChoiceOption;5153 tools?: Array<ChatCompletionTool>;5154 top_p?: number | null;5155 user?: string;5156 web_search_options?: WebSearchOptions;5157 function_call?: "none" | "auto" | {5158 name: string;5159 };5160 functions?: Array<FunctionDefinition>;5161};5162type PromptTokensDetails = {5163 cached_tokens?: number;5164 audio_tokens?: number;5165};5166type CompletionTokensDetails = {5167 reasoning_tokens?: number;5168 audio_tokens?: number;5169 accepted_prediction_tokens?: number;5170 rejected_prediction_tokens?: number;5171};5172type CompletionUsage = {5173 prompt_tokens: number;5174 completion_tokens: number;5175 total_tokens: number;5176 prompt_tokens_details?: PromptTokensDetails;5177 completion_tokens_details?: CompletionTokensDetails;5178};5179type ChatCompletionTopLogprob = {5180 token: string;5181 logprob: number;5182 bytes: Array<number> | null;5183};5184type ChatCompletionTokenLogprob = {5185 token: string;5186 logprob: number;5187 bytes: Array<number> | null;5188 top_logprobs: Array<ChatCompletionTopLogprob>;5189};5190type ChatCompletionAudio = {5191 id: string;5192 /** Base64 encoded audio bytes. */5193 data: string;5194 expires_at: number;5195 transcript: string;5196};5197type ChatCompletionUrlCitation = {5198 type: "url_citation";5199 url_citation: {5200 url: string;5201 title: string;5202 start_index: number;5203 end_index: number;5204 };5205};5206type ChatCompletionResponseMessage = {5207 role: "assistant";5208 content: string | null;5209 refusal: string | null;5210 annotations?: Array<ChatCompletionUrlCitation>;5211 audio?: ChatCompletionAudio;5212 tool_calls?: Array<ChatCompletionMessageToolCall>;5213 function_call?: {5214 name: string;5215 arguments: string;5216 } | null;5217};5218type ChatCompletionLogprobs = {5219 content: Array<ChatCompletionTokenLogprob> | null;5220 refusal?: Array<ChatCompletionTokenLogprob> | null;5221};5222type ChatCompletionChoice = {5223 index: number;5224 message: ChatCompletionResponseMessage;5225 finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call";5226 logprobs: ChatCompletionLogprobs | null;5227};5228type ChatCompletionsMessagesInput = {5229 messages: Array<ChatCompletionMessageParam>;5230} & ChatCompletionsCommonOptions;5231type ChatCompletionsOutput = {5232 id: string;5233 object: string;5234 created: number;5235 model: string;5236 choices: Array<ChatCompletionChoice>;5237 usage?: CompletionUsage;5238 system_fingerprint?: string | null;5239 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;5240};5241/**5242 * Workers AI support for OpenAI's Responses API5243 * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts5244 *5245 * It's a stripped down version from its source.5246 * It currently supports basic function calling, json mode and accepts images as input.5247 *5248 * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools.5249 * We plan to add those incrementally as model + platform capabilities evolve.5250 */5251type ResponsesInput = {5252 background?: boolean | null;5253 conversation?: string | ResponseConversationParam | null;5254 include?: Array<ResponseIncludable> | null;5255 input?: string | ResponseInput;5256 instructions?: string | null;5257 max_output_tokens?: number | null;5258 parallel_tool_calls?: boolean | null;5259 previous_response_id?: string | null;5260 prompt_cache_key?: string;5261 reasoning?: Reasoning | null;5262 safety_identifier?: string;5263 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;5264 stream?: boolean | null;5265 stream_options?: StreamOptions | null;5266 temperature?: number | null;5267 text?: ResponseTextConfig;5268 tool_choice?: ToolChoiceOptions | ToolChoiceFunction;5269 tools?: Array<Tool>;5270 top_p?: number | null;5271 truncation?: "auto" | "disabled" | null;5272};5273type ResponsesOutput = {5274 id?: string;5275 created_at?: number;5276 output_text?: string;5277 error?: ResponseError | null;5278 incomplete_details?: ResponseIncompleteDetails | null;5279 instructions?: string | Array<ResponseInputItem> | null;5280 object?: "response";5281 output?: Array<ResponseOutputItem>;5282 parallel_tool_calls?: boolean;5283 temperature?: number | null;5284 tool_choice?: ToolChoiceOptions | ToolChoiceFunction;5285 tools?: Array<Tool>;5286 top_p?: number | null;5287 max_output_tokens?: number | null;5288 previous_response_id?: string | null;5289 prompt?: ResponsePrompt | null;5290 reasoning?: Reasoning | null;5291 safety_identifier?: string;5292 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;5293 status?: ResponseStatus;5294 text?: ResponseTextConfig;5295 truncation?: "auto" | "disabled" | null;5296 usage?: ResponseUsage;5297};5298type EasyInputMessage = {5299 content: string | ResponseInputMessageContentList;5300 role: "user" | "assistant" | "system" | "developer";5301 type?: "message";5302};5303type ResponsesFunctionTool = {5304 name: string;5305 parameters: {5306 [key: string]: unknown;5307 } | null;5308 strict: boolean | null;5309 type: "function";5310 description?: string | null;5311};5312type ResponseIncompleteDetails = {5313 reason?: "max_output_tokens" | "content_filter";5314};5315type ResponsePrompt = {5316 id: string;5317 variables?: {5318 [key: string]: string | ResponseInputText | ResponseInputImage;5319 } | null;5320 version?: string | null;5321};5322type Reasoning = {5323 effort?: ReasoningEffort | null;5324 generate_summary?: "auto" | "concise" | "detailed" | null;5325 summary?: "auto" | "concise" | "detailed" | null;5326};5327type ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText;5328type ResponseContentReasoningText = {5329 text: string;5330 type: "reasoning_text";5331};5332type ResponseConversationParam = {5333 id: string;5334};5335type ResponseCreatedEvent = {5336 response: Response;5337 sequence_number: number;5338 type: "response.created";5339};5340type ResponseCustomToolCallOutput = {5341 call_id: string;5342 output: string | Array<ResponseInputText | ResponseInputImage>;5343 type: "custom_tool_call_output";5344 id?: string;5345};5346type ResponseError = {5347 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";5348 message: string;5349};5350type ResponseErrorEvent = {5351 code: string | null;5352 message: string;5353 param: string | null;5354 sequence_number: number;5355 type: "error";5356};5357type ResponseFailedEvent = {5358 response: Response;5359 sequence_number: number;5360 type: "response.failed";5361};5362type ResponseFormatText = {5363 type: "text";5364};5365type ResponseFormatJSONObject = {5366 type: "json_object";5367};5368type ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject;5369type ResponseFormatTextJSONSchemaConfig = {5370 name: string;5371 schema: {5372 [key: string]: unknown;5373 };5374 type: "json_schema";5375 description?: string;5376 strict?: boolean | null;5377};5378type ResponseFunctionCallArgumentsDeltaEvent = {5379 delta: string;5380 item_id: string;5381 output_index: number;5382 sequence_number: number;5383 type: "response.function_call_arguments.delta";5384};5385type ResponseFunctionCallArgumentsDoneEvent = {5386 arguments: string;5387 item_id: string;5388 name: string;5389 output_index: number;5390 sequence_number: number;5391 type: "response.function_call_arguments.done";5392};5393type ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent;5394type ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>;5395type ResponseFunctionToolCall = {5396 arguments: string;5397 call_id: string;5398 name: string;5399 type: "function_call";5400 id?: string;5401 status?: "in_progress" | "completed" | "incomplete";5402};5403interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {5404 id: string;5405}5406type ResponseFunctionToolCallOutputItem = {5407 id: string;5408 call_id: string;5409 output: string | Array<ResponseInputText | ResponseInputImage>;5410 type: "function_call_output";5411 status?: "in_progress" | "completed" | "incomplete";5412};5413type ResponseIncludable = "message.input_image.image_url" | "message.output_text.logprobs";5414type ResponseIncompleteEvent = {5415 response: Response;5416 sequence_number: number;5417 type: "response.incomplete";5418};5419type ResponseInput = Array<ResponseInputItem>;5420type ResponseInputContent = ResponseInputText | ResponseInputImage;5421type ResponseInputImage = {5422 detail: "low" | "high" | "auto";5423 type: "input_image";5424 /**5425 * Base64 encoded image5426 */5427 image_url?: string | null;5428};5429type ResponseInputImageContent = {5430 type: "input_image";5431 detail?: "low" | "high" | "auto" | null;5432 /**5433 * Base64 encoded image5434 */5435 image_url?: string | null;5436};5437type ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem;5438type ResponseInputItemFunctionCallOutput = {5439 call_id: string;5440 output: string | ResponseFunctionCallOutputItemList;5441 type: "function_call_output";5442 id?: string | null;5443 status?: "in_progress" | "completed" | "incomplete" | null;5444};5445type ResponseInputItemMessage = {5446 content: ResponseInputMessageContentList;5447 role: "user" | "system" | "developer";5448 status?: "in_progress" | "completed" | "incomplete";5449 type?: "message";5450};5451type ResponseInputMessageContentList = Array<ResponseInputContent>;5452type ResponseInputMessageItem = {5453 id: string;5454 content: ResponseInputMessageContentList;5455 role: "user" | "system" | "developer";5456 status?: "in_progress" | "completed" | "incomplete";5457 type?: "message";5458};5459type ResponseInputText = {5460 text: string;5461 type: "input_text";5462};5463type ResponseInputTextContent = {5464 text: string;5465 type: "input_text";5466};5467type ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem;5468type ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem;5469type ResponseOutputItemAddedEvent = {5470 item: ResponseOutputItem;5471 output_index: number;5472 sequence_number: number;5473 type: "response.output_item.added";5474};5475type ResponseOutputItemDoneEvent = {5476 item: ResponseOutputItem;5477 output_index: number;5478 sequence_number: number;5479 type: "response.output_item.done";5480};5481type ResponseOutputMessage = {5482 id: string;5483 content: Array<ResponseOutputText | ResponseOutputRefusal>;5484 role: "assistant";5485 status: "in_progress" | "completed" | "incomplete";5486 type: "message";5487};5488type ResponseOutputRefusal = {5489 refusal: string;5490 type: "refusal";5491};5492type ResponseOutputText = {5493 text: string;5494 type: "output_text";5495 logprobs?: Array<Logprob>;5496};5497type ResponseReasoningItem = {5498 id: string;5499 summary: Array<ResponseReasoningSummaryItem>;5500 type: "reasoning";5501 content?: Array<ResponseReasoningContentItem>;5502 encrypted_content?: string | null;5503 status?: "in_progress" | "completed" | "incomplete";5504};5505type ResponseReasoningSummaryItem = {5506 text: string;5507 type: "summary_text";5508};5509type ResponseReasoningContentItem = {5510 text: string;5511 type: "reasoning_text";5512};5513type ResponseReasoningTextDeltaEvent = {5514 content_index: number;5515 delta: string;5516 item_id: string;5517 output_index: number;5518 sequence_number: number;5519 type: "response.reasoning_text.delta";5520};5521type ResponseReasoningTextDoneEvent = {5522 content_index: number;5523 item_id: string;5524 output_index: number;5525 sequence_number: number;5526 text: string;5527 type: "response.reasoning_text.done";5528};5529type ResponseRefusalDeltaEvent = {5530 content_index: number;5531 delta: string;5532 item_id: string;5533 output_index: number;5534 sequence_number: number;5535 type: "response.refusal.delta";5536};5537type ResponseRefusalDoneEvent = {5538 content_index: number;5539 item_id: string;5540 output_index: number;5541 refusal: string;5542 sequence_number: number;5543 type: "response.refusal.done";5544};5545type ResponseStatus = "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete";5546type ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent;5547type ResponseCompletedEvent = {5548 response: Response;5549 sequence_number: number;5550 type: "response.completed";5551};5552type ResponseTextConfig = {5553 format?: ResponseFormatTextConfig;5554 verbosity?: "low" | "medium" | "high" | null;5555};5556type ResponseTextDeltaEvent = {5557 content_index: number;5558 delta: string;5559 item_id: string;5560 logprobs: Array<Logprob>;5561 output_index: number;5562 sequence_number: number;5563 type: "response.output_text.delta";5564};5565type ResponseTextDoneEvent = {5566 content_index: number;5567 item_id: string;5568 logprobs: Array<Logprob>;5569 output_index: number;5570 sequence_number: number;5571 text: string;5572 type: "response.output_text.done";5573};5574type Logprob = {5575 token: string;5576 logprob: number;5577 top_logprobs?: Array<TopLogprob>;5578};5579type TopLogprob = {5580 token?: string;5581 logprob?: number;5582};5583type ResponseUsage = {5584 input_tokens: number;5585 output_tokens: number;5586 total_tokens: number;5587};5588type Tool = ResponsesFunctionTool;5589type ToolChoiceFunction = {5590 name: string;5591 type: "function";5592};5593type ToolChoiceOptions = "none";5594type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;5595type StreamOptions = {5596 include_obfuscation?: boolean;5597};5598/** Marks keys from T that aren't in U as optional never */5599type Without<T, U> = {5600 [P in Exclude<keyof T, keyof U>]?: never;5601};5602/** Either T or U, but not both (mutually exclusive) */5603type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>);5604type Ai_Cf_Baai_Bge_Base_En_V1_5_Input = {5605 text: string | string[];5606 /**5607 * 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.5608 */5609 pooling?: "mean" | "cls";5610} | {5611 /**5612 * Batch of the embeddings requests to run using async-queue5613 */5614 requests: {5615 text: string | string[];5616 /**5617 * 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.5618 */5619 pooling?: "mean" | "cls";5620 }[];5621};5622type Ai_Cf_Baai_Bge_Base_En_V1_5_Output = {5623 shape?: number[];5624 /**5625 * Embeddings of the requested text values5626 */5627 data?: number[][];5628 /**5629 * The pooling method used in the embedding process.5630 */5631 pooling?: "mean" | "cls";5632} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse;5633interface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {5634 /**5635 * The async request id that can be used to obtain the results.5636 */5637 request_id?: string;5638}5639declare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 {5640 inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input;5641 postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output;5642}5643type Ai_Cf_Openai_Whisper_Input = string | {5644 /**5645 * An array of integers that represent the audio data constrained to 8-bit unsigned integer values5646 */5647 audio: number[];5648};5649interface Ai_Cf_Openai_Whisper_Output {5650 /**5651 * The transcription5652 */5653 text: string;5654 word_count?: number;5655 words?: {5656 word?: string;5657 /**5658 * The second this word begins in the recording5659 */5660 start?: number;5661 /**5662 * The ending second when the word completes5663 */5664 end?: number;5665 }[];5666 vtt?: string;5667}5668declare abstract class Base_Ai_Cf_Openai_Whisper {5669 inputs: Ai_Cf_Openai_Whisper_Input;5670 postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;5671}5672type Ai_Cf_Meta_M2M100_1_2B_Input = {5673 /**5674 * The text to be translated5675 */5676 text: string;5677 /**5678 * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified5679 */5680 source_lang?: string;5681 /**5682 * The language code to translate the text into (e.g., 'es' for Spanish)5683 */5684 target_lang: string;5685} | {5686 /**5687 * Batch of the embeddings requests to run using async-queue5688 */5689 requests: {5690 /**5691 * The text to be translated5692 */5693 text: string;5694 /**5695 * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified5696 */5697 source_lang?: string;5698 /**5699 * The language code to translate the text into (e.g., 'es' for Spanish)5700 */5701 target_lang: string;5702 }[];5703};5704type Ai_Cf_Meta_M2M100_1_2B_Output = {5705 /**5706 * The translated text in the target language5707 */5708 translated_text?: string;5709} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse;5710interface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {5711 /**5712 * The async request id that can be used to obtain the results.5713 */5714 request_id?: string;5715}5716declare abstract class Base_Ai_Cf_Meta_M2M100_1_2B {5717 inputs: Ai_Cf_Meta_M2M100_1_2B_Input;5718 postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output;5719}5720type Ai_Cf_Baai_Bge_Small_En_V1_5_Input = {5721 text: string | string[];5722 /**5723 * 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.5724 */5725 pooling?: "mean" | "cls";5726} | {5727 /**5728 * Batch of the embeddings requests to run using async-queue5729 */5730 requests: {5731 text: string | string[];5732 /**5733 * 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.5734 */5735 pooling?: "mean" | "cls";5736 }[];5737};5738type Ai_Cf_Baai_Bge_Small_En_V1_5_Output = {5739 shape?: number[];5740 /**5741 * Embeddings of the requested text values5742 */5743 data?: number[][];5744 /**5745 * The pooling method used in the embedding process.5746 */5747 pooling?: "mean" | "cls";5748} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse;5749interface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {5750 /**5751 * The async request id that can be used to obtain the results.5752 */5753 request_id?: string;5754}5755declare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 {5756 inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input;5757 postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output;5758}5759type Ai_Cf_Baai_Bge_Large_En_V1_5_Input = {5760 text: string | string[];5761 /**5762 * 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.5763 */5764 pooling?: "mean" | "cls";5765} | {5766 /**5767 * Batch of the embeddings requests to run using async-queue5768 */5769 requests: {5770 text: string | string[];5771 /**5772 * 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.5773 */5774 pooling?: "mean" | "cls";5775 }[];5776};5777type Ai_Cf_Baai_Bge_Large_En_V1_5_Output = {5778 shape?: number[];5779 /**5780 * Embeddings of the requested text values5781 */5782 data?: number[][];5783 /**5784 * The pooling method used in the embedding process.5785 */5786 pooling?: "mean" | "cls";5787} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse;5788interface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {5789 /**5790 * The async request id that can be used to obtain the results.5791 */5792 request_id?: string;5793}5794declare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 {5795 inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input;5796 postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output;5797}5798type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | {5799 /**5800 * The input text prompt for the model to generate a response.5801 */5802 prompt?: string;5803 /**5804 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.5805 */5806 raw?: boolean;5807 /**5808 * 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.5809 */5810 top_p?: number;5811 /**5812 * 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.5813 */5814 top_k?: number;5815 /**5816 * Random seed for reproducibility of the generation.5817 */5818 seed?: number;5819 /**5820 * Penalty for repeated tokens; higher values discourage repetition.5821 */5822 repetition_penalty?: number;5823 /**5824 * Decreases the likelihood of the model repeating the same lines verbatim.5825 */5826 frequency_penalty?: number;5827 /**5828 * Increases the likelihood of the model introducing new topics.5829 */5830 presence_penalty?: number;5831 image: number[] | (string & NonNullable<unknown>);5832 /**5833 * The maximum number of tokens to generate in the response.5834 */5835 max_tokens?: number;5836};5837interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {5838 description?: string;5839}5840declare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M {5841 inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input;5842 postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output;5843}5844type Ai_Cf_Openai_Whisper_Tiny_En_Input = string | {5845 /**5846 * An array of integers that represent the audio data constrained to 8-bit unsigned integer values5847 */5848 audio: number[];5849};5850interface Ai_Cf_Openai_Whisper_Tiny_En_Output {5851 /**5852 * The transcription5853 */5854 text: string;5855 word_count?: number;5856 words?: {5857 word?: string;5858 /**5859 * The second this word begins in the recording5860 */5861 start?: number;5862 /**5863 * The ending second when the word completes5864 */5865 end?: number;5866 }[];5867 vtt?: string;5868}5869declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {5870 inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;5871 postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;5872}5873interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {5874 audio: string | {5875 body?: object;5876 contentType?: string;5877 };5878 /**5879 * Supported tasks are 'translate' or 'transcribe'.5880 */5881 task?: string;5882 /**5883 * The language of the audio being transcribed or translated.5884 */5885 language?: string;5886 /**5887 * Preprocess the audio with a voice activity detection model.5888 */5889 vad_filter?: boolean;5890 /**5891 * A text prompt to help provide context to the model on the contents of the audio.5892 */5893 initial_prompt?: string;5894 /**5895 * The prefix appended to the beginning of the output of the transcription and can guide the transcription result.5896 */5897 prefix?: string;5898 /**5899 * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed.5900 */5901 beam_size?: number;5902 /**5903 * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops.5904 */5905 condition_on_previous_text?: boolean;5906 /**5907 * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped.5908 */5909 no_speech_threshold?: number;5910 /**5911 * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text.5912 */5913 compression_ratio_threshold?: number;5914 /**5915 * Threshold for filtering out segments with low average log probability, indicating low confidence.5916 */5917 log_prob_threshold?: number;5918 /**5919 * Optional threshold (in seconds) to skip silent periods that may cause hallucinations.5920 */5921 hallucination_silence_threshold?: number;5922}5923interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {5924 transcription_info?: {5925 /**5926 * The language of the audio being transcribed or translated.5927 */5928 language?: string;5929 /**5930 * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.5931 */5932 language_probability?: number;5933 /**5934 * The total duration of the original audio file, in seconds.5935 */5936 duration?: number;5937 /**5938 * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.5939 */5940 duration_after_vad?: number;5941 };5942 /**5943 * The complete transcription of the audio.5944 */5945 text: string;5946 /**5947 * The total number of words in the transcription.5948 */5949 word_count?: number;5950 segments?: {5951 /**5952 * The starting time of the segment within the audio, in seconds.5953 */5954 start?: number;5955 /**5956 * The ending time of the segment within the audio, in seconds.5957 */5958 end?: number;5959 /**5960 * The transcription of the segment.5961 */5962 text?: string;5963 /**5964 * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.5965 */5966 temperature?: number;5967 /**5968 * The average log probability of the predictions for the words in this segment, indicating overall confidence.5969 */5970 avg_logprob?: number;5971 /**5972 * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.5973 */5974 compression_ratio?: number;5975 /**5976 * The probability that the segment contains no speech, represented as a decimal between 0 and 1.5977 */5978 no_speech_prob?: number;5979 words?: {5980 /**5981 * The individual word transcribed from the audio.5982 */5983 word?: string;5984 /**5985 * The starting time of the word within the audio, in seconds.5986 */5987 start?: number;5988 /**5989 * The ending time of the word within the audio, in seconds.5990 */5991 end?: number;5992 }[];5993 }[];5994 /**5995 * The transcription in WebVTT format, which includes timing and text information for use in subtitles.5996 */5997 vtt?: string;5998}5999declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {6000 inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;6001 postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;6002}6003type Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | {6004 /**6005 * Batch of the embeddings requests to run using async-queue6006 */6007 requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[];6008};6009interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {6010 /**6011 * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts6012 */6013 query?: string;6014 /**6015 * List of provided contexts. Note that the index in this array is important, as the response will refer to it.6016 */6017 contexts: {6018 /**6019 * One of the provided context content6020 */6021 text?: string;6022 }[];6023 /**6024 * When provided with too long context should the model error out or truncate the context to fit?6025 */6026 truncate_inputs?: boolean;6027}6028interface Ai_Cf_Baai_Bge_M3_Input_Embedding {6029 text: string | string[];6030 /**6031 * When provided with too long context should the model error out or truncate the context to fit?6032 */6033 truncate_inputs?: boolean;6034}6035interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {6036 /**6037 * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts6038 */6039 query?: string;6040 /**6041 * List of provided contexts. Note that the index in this array is important, as the response will refer to it.6042 */6043 contexts: {6044 /**6045 * One of the provided context content6046 */6047 text?: string;6048 }[];6049 /**6050 * When provided with too long context should the model error out or truncate the context to fit?6051 */6052 truncate_inputs?: boolean;6053}6054interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {6055 text: string | string[];6056 /**6057 * When provided with too long context should the model error out or truncate the context to fit?6058 */6059 truncate_inputs?: boolean;6060}6061type 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;6062interface Ai_Cf_Baai_Bge_M3_Output_Query {6063 response?: {6064 /**6065 * Index of the context in the request6066 */6067 id?: number;6068 /**6069 * Score of the context under the index.6070 */6071 score?: number;6072 }[];6073}6074interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {6075 response?: number[][];6076 shape?: number[];6077 /**6078 * The pooling method used in the embedding process.6079 */6080 pooling?: "mean" | "cls";6081}6082interface Ai_Cf_Baai_Bge_M3_Output_Embedding {6083 shape?: number[];6084 /**6085 * Embeddings of the requested text values6086 */6087 data?: number[][];6088 /**6089 * The pooling method used in the embedding process.6090 */6091 pooling?: "mean" | "cls";6092}6093interface Ai_Cf_Baai_Bge_M3_AsyncResponse {6094 /**6095 * The async request id that can be used to obtain the results.6096 */6097 request_id?: string;6098}6099declare abstract class Base_Ai_Cf_Baai_Bge_M3 {6100 inputs: Ai_Cf_Baai_Bge_M3_Input;6101 postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;6102}6103interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {6104 /**6105 * A text description of the image you want to generate.6106 */6107 prompt: string;6108 /**6109 * The number of diffusion steps; higher values can improve quality but take longer.6110 */6111 steps?: number;6112}6113interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {6114 /**6115 * The generated image in Base64 format.6116 */6117 image?: string;6118}6119declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {6120 inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;6121 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;6122}6123type 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;6124interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {6125 /**6126 * The input text prompt for the model to generate a response.6127 */6128 prompt: string;6129 image?: number[] | (string & NonNullable<unknown>);6130 /**6131 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.6132 */6133 raw?: boolean;6134 /**6135 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6136 */6137 stream?: boolean;6138 /**6139 * The maximum number of tokens to generate in the response.6140 */6141 max_tokens?: number;6142 /**6143 * Controls the randomness of the output; higher values produce more random results.6144 */6145 temperature?: number;6146 /**6147 * 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.6148 */6149 top_p?: number;6150 /**6151 * 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.6152 */6153 top_k?: number;6154 /**6155 * Random seed for reproducibility of the generation.6156 */6157 seed?: number;6158 /**6159 * Penalty for repeated tokens; higher values discourage repetition.6160 */6161 repetition_penalty?: number;6162 /**6163 * Decreases the likelihood of the model repeating the same lines verbatim.6164 */6165 frequency_penalty?: number;6166 /**6167 * Increases the likelihood of the model introducing new topics.6168 */6169 presence_penalty?: number;6170 /**6171 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.6172 */6173 lora?: string;6174}6175interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {6176 /**6177 * An array of message objects representing the conversation history.6178 */6179 messages: {6180 /**6181 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').6182 */6183 role?: string;6184 /**6185 * The tool call id. If you don't know what to put here you can fall back to 0000000016186 */6187 tool_call_id?: string;6188 content?: string | {6189 /**6190 * Type of the content provided6191 */6192 type?: string;6193 text?: string;6194 image_url?: {6195 /**6196 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted6197 */6198 url?: string;6199 };6200 }[] | {6201 /**6202 * Type of the content provided6203 */6204 type?: string;6205 text?: string;6206 image_url?: {6207 /**6208 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted6209 */6210 url?: string;6211 };6212 };6213 }[];6214 image?: number[] | (string & NonNullable<unknown>);6215 functions?: {6216 name: string;6217 code: string;6218 }[];6219 /**6220 * A list of tools available for the assistant to use.6221 */6222 tools?: ({6223 /**6224 * The name of the tool. More descriptive the better.6225 */6226 name: string;6227 /**6228 * A brief description of what the tool does.6229 */6230 description: string;6231 /**6232 * Schema defining the parameters accepted by the tool.6233 */6234 parameters: {6235 /**6236 * The type of the parameters object (usually 'object').6237 */6238 type: string;6239 /**6240 * List of required parameter names.6241 */6242 required?: string[];6243 /**6244 * Definitions of each parameter.6245 */6246 properties: {6247 [k: string]: {6248 /**6249 * The data type of the parameter.6250 */6251 type: string;6252 /**6253 * A description of the expected parameter.6254 */6255 description: string;6256 };6257 };6258 };6259 } | {6260 /**6261 * Specifies the type of tool (e.g., 'function').6262 */6263 type: string;6264 /**6265 * Details of the function tool.6266 */6267 function: {6268 /**6269 * The name of the function.6270 */6271 name: string;6272 /**6273 * A brief description of what the function does.6274 */6275 description: string;6276 /**6277 * Schema defining the parameters accepted by the function.6278 */6279 parameters: {6280 /**6281 * The type of the parameters object (usually 'object').6282 */6283 type: string;6284 /**6285 * List of required parameter names.6286 */6287 required?: string[];6288 /**6289 * Definitions of each parameter.6290 */6291 properties: {6292 [k: string]: {6293 /**6294 * The data type of the parameter.6295 */6296 type: string;6297 /**6298 * A description of the expected parameter.6299 */6300 description: string;6301 };6302 };6303 };6304 };6305 })[];6306 /**6307 * If true, the response will be streamed back incrementally.6308 */6309 stream?: boolean;6310 /**6311 * The maximum number of tokens to generate in the response.6312 */6313 max_tokens?: number;6314 /**6315 * Controls the randomness of the output; higher values produce more random results.6316 */6317 temperature?: number;6318 /**6319 * 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.6320 */6321 top_p?: number;6322 /**6323 * 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.6324 */6325 top_k?: number;6326 /**6327 * Random seed for reproducibility of the generation.6328 */6329 seed?: number;6330 /**6331 * Penalty for repeated tokens; higher values discourage repetition.6332 */6333 repetition_penalty?: number;6334 /**6335 * Decreases the likelihood of the model repeating the same lines verbatim.6336 */6337 frequency_penalty?: number;6338 /**6339 * Increases the likelihood of the model introducing new topics.6340 */6341 presence_penalty?: number;6342}6343type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {6344 /**6345 * The generated text response from the model6346 */6347 response?: string;6348 /**6349 * An array of tool calls requests made during the response generation6350 */6351 tool_calls?: {6352 /**6353 * The arguments passed to be passed to the tool call request6354 */6355 arguments?: object;6356 /**6357 * The name of the tool to be called6358 */6359 name?: string;6360 }[];6361};6362declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {6363 inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;6364 postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;6365}6366type 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;6367interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {6368 /**6369 * The input text prompt for the model to generate a response.6370 */6371 prompt: string;6372 /**6373 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.6374 */6375 lora?: string;6376 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode;6377 /**6378 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.6379 */6380 raw?: boolean;6381 /**6382 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6383 */6384 stream?: boolean;6385 /**6386 * The maximum number of tokens to generate in the response.6387 */6388 max_tokens?: number;6389 /**6390 * Controls the randomness of the output; higher values produce more random results.6391 */6392 temperature?: number;6393 /**6394 * 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.6395 */6396 top_p?: number;6397 /**6398 * 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.6399 */6400 top_k?: number;6401 /**6402 * Random seed for reproducibility of the generation.6403 */6404 seed?: number;6405 /**6406 * Penalty for repeated tokens; higher values discourage repetition.6407 */6408 repetition_penalty?: number;6409 /**6410 * Decreases the likelihood of the model repeating the same lines verbatim.6411 */6412 frequency_penalty?: number;6413 /**6414 * Increases the likelihood of the model introducing new topics.6415 */6416 presence_penalty?: number;6417}6418interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {6419 type?: "json_object" | "json_schema";6420 json_schema?: unknown;6421}6422interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {6423 /**6424 * An array of message objects representing the conversation history.6425 */6426 messages: {6427 /**6428 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').6429 */6430 role: string;6431 content: string | {6432 /**6433 * Type of the content (text)6434 */6435 type?: string;6436 /**6437 * Text content6438 */6439 text?: string;6440 }[];6441 }[];6442 functions?: {6443 name: string;6444 code: string;6445 }[];6446 /**6447 * A list of tools available for the assistant to use.6448 */6449 tools?: ({6450 /**6451 * The name of the tool. More descriptive the better.6452 */6453 name: string;6454 /**6455 * A brief description of what the tool does.6456 */6457 description: string;6458 /**6459 * Schema defining the parameters accepted by the tool.6460 */6461 parameters: {6462 /**6463 * The type of the parameters object (usually 'object').6464 */6465 type: string;6466 /**6467 * List of required parameter names.6468 */6469 required?: string[];6470 /**6471 * Definitions of each parameter.6472 */6473 properties: {6474 [k: string]: {6475 /**6476 * The data type of the parameter.6477 */6478 type: string;6479 /**6480 * A description of the expected parameter.6481 */6482 description: string;6483 };6484 };6485 };6486 } | {6487 /**6488 * Specifies the type of tool (e.g., 'function').6489 */6490 type: string;6491 /**6492 * Details of the function tool.6493 */6494 function: {6495 /**6496 * The name of the function.6497 */6498 name: string;6499 /**6500 * A brief description of what the function does.6501 */6502 description: string;6503 /**6504 * Schema defining the parameters accepted by the function.6505 */6506 parameters: {6507 /**6508 * The type of the parameters object (usually 'object').6509 */6510 type: string;6511 /**6512 * List of required parameter names.6513 */6514 required?: string[];6515 /**6516 * Definitions of each parameter.6517 */6518 properties: {6519 [k: string]: {6520 /**6521 * The data type of the parameter.6522 */6523 type: string;6524 /**6525 * A description of the expected parameter.6526 */6527 description: string;6528 };6529 };6530 };6531 };6532 })[];6533 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1;6534 /**6535 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.6536 */6537 raw?: boolean;6538 /**6539 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6540 */6541 stream?: boolean;6542 /**6543 * The maximum number of tokens to generate in the response.6544 */6545 max_tokens?: number;6546 /**6547 * Controls the randomness of the output; higher values produce more random results.6548 */6549 temperature?: number;6550 /**6551 * 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.6552 */6553 top_p?: number;6554 /**6555 * 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.6556 */6557 top_k?: number;6558 /**6559 * Random seed for reproducibility of the generation.6560 */6561 seed?: number;6562 /**6563 * Penalty for repeated tokens; higher values discourage repetition.6564 */6565 repetition_penalty?: number;6566 /**6567 * Decreases the likelihood of the model repeating the same lines verbatim.6568 */6569 frequency_penalty?: number;6570 /**6571 * Increases the likelihood of the model introducing new topics.6572 */6573 presence_penalty?: number;6574}6575interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {6576 type?: "json_object" | "json_schema";6577 json_schema?: unknown;6578}6579interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {6580 requests?: {6581 /**6582 * 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.6583 */6584 external_reference?: string;6585 /**6586 * Prompt for the text generation model6587 */6588 prompt?: string;6589 /**6590 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6591 */6592 stream?: boolean;6593 /**6594 * The maximum number of tokens to generate in the response.6595 */6596 max_tokens?: number;6597 /**6598 * Controls the randomness of the output; higher values produce more random results.6599 */6600 temperature?: number;6601 /**6602 * 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.6603 */6604 top_p?: number;6605 /**6606 * Random seed for reproducibility of the generation.6607 */6608 seed?: number;6609 /**6610 * Penalty for repeated tokens; higher values discourage repetition.6611 */6612 repetition_penalty?: number;6613 /**6614 * Decreases the likelihood of the model repeating the same lines verbatim.6615 */6616 frequency_penalty?: number;6617 /**6618 * Increases the likelihood of the model introducing new topics.6619 */6620 presence_penalty?: number;6621 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2;6622 }[];6623}6624interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {6625 type?: "json_object" | "json_schema";6626 json_schema?: unknown;6627}6628type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = {6629 /**6630 * The generated text response from the model6631 */6632 response: string;6633 /**6634 * Usage statistics for the inference request6635 */6636 usage?: {6637 /**6638 * Total number of tokens in input6639 */6640 prompt_tokens?: number;6641 /**6642 * Total number of tokens in output6643 */6644 completion_tokens?: number;6645 /**6646 * Total number of input and output tokens6647 */6648 total_tokens?: number;6649 };6650 /**6651 * An array of tool calls requests made during the response generation6652 */6653 tool_calls?: {6654 /**6655 * The arguments passed to be passed to the tool call request6656 */6657 arguments?: object;6658 /**6659 * The name of the tool to be called6660 */6661 name?: string;6662 }[];6663} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse;6664interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {6665 /**6666 * The async request id that can be used to obtain the results.6667 */6668 request_id?: string;6669}6670declare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {6671 inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;6672 postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output;6673}6674interface Ai_Cf_Meta_Llama_Guard_3_8B_Input {6675 /**6676 * An array of message objects representing the conversation history.6677 */6678 messages: {6679 /**6680 * The role of the message sender must alternate between 'user' and 'assistant'.6681 */6682 role: "user" | "assistant";6683 /**6684 * The content of the message as a string.6685 */6686 content: string;6687 }[];6688 /**6689 * The maximum number of tokens to generate in the response.6690 */6691 max_tokens?: number;6692 /**6693 * Controls the randomness of the output; higher values produce more random results.6694 */6695 temperature?: number;6696 /**6697 * Dictate the output format of the generated response.6698 */6699 response_format?: {6700 /**6701 * Set to json_object to process and output generated text as JSON.6702 */6703 type?: string;6704 };6705}6706interface Ai_Cf_Meta_Llama_Guard_3_8B_Output {6707 response?: string | {6708 /**6709 * Whether the conversation is safe or not.6710 */6711 safe?: boolean;6712 /**6713 * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe.6714 */6715 categories?: string[];6716 };6717 /**6718 * Usage statistics for the inference request6719 */6720 usage?: {6721 /**6722 * Total number of tokens in input6723 */6724 prompt_tokens?: number;6725 /**6726 * Total number of tokens in output6727 */6728 completion_tokens?: number;6729 /**6730 * Total number of input and output tokens6731 */6732 total_tokens?: number;6733 };6734}6735declare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B {6736 inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input;6737 postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output;6738}6739interface Ai_Cf_Baai_Bge_Reranker_Base_Input {6740 /**6741 * A query you wish to perform against the provided contexts.6742 */6743 /**6744 * Number of returned results starting with the best score.6745 */6746 top_k?: number;6747 /**6748 * List of provided contexts. Note that the index in this array is important, as the response will refer to it.6749 */6750 contexts: {6751 /**6752 * One of the provided context content6753 */6754 text?: string;6755 }[];6756}6757interface Ai_Cf_Baai_Bge_Reranker_Base_Output {6758 response?: {6759 /**6760 * Index of the context in the request6761 */6762 id?: number;6763 /**6764 * Score of the context under the index.6765 */6766 score?: number;6767 }[];6768}6769declare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base {6770 inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input;6771 postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output;6772}6773type 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;6774interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {6775 /**6776 * The input text prompt for the model to generate a response.6777 */6778 prompt: string;6779 /**6780 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.6781 */6782 lora?: string;6783 response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode;6784 /**6785 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.6786 */6787 raw?: boolean;6788 /**6789 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6790 */6791 stream?: boolean;6792 /**6793 * The maximum number of tokens to generate in the response.6794 */6795 max_tokens?: number;6796 /**6797 * Controls the randomness of the output; higher values produce more random results.6798 */6799 temperature?: number;6800 /**6801 * 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.6802 */6803 top_p?: number;6804 /**6805 * 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.6806 */6807 top_k?: number;6808 /**6809 * Random seed for reproducibility of the generation.6810 */6811 seed?: number;6812 /**6813 * Penalty for repeated tokens; higher values discourage repetition.6814 */6815 repetition_penalty?: number;6816 /**6817 * Decreases the likelihood of the model repeating the same lines verbatim.6818 */6819 frequency_penalty?: number;6820 /**6821 * Increases the likelihood of the model introducing new topics.6822 */6823 presence_penalty?: number;6824}6825interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {6826 type?: "json_object" | "json_schema";6827 json_schema?: unknown;6828}6829interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {6830 /**6831 * An array of message objects representing the conversation history.6832 */6833 messages: {6834 /**6835 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').6836 */6837 role: string;6838 /**6839 * The content of the message as a string.6840 */6841 content: string;6842 }[];6843 functions?: {6844 name: string;6845 code: string;6846 }[];6847 /**6848 * A list of tools available for the assistant to use.6849 */6850 tools?: ({6851 /**6852 * The name of the tool. More descriptive the better.6853 */6854 name: string;6855 /**6856 * A brief description of what the tool does.6857 */6858 description: string;6859 /**6860 * Schema defining the parameters accepted by the tool.6861 */6862 parameters: {6863 /**6864 * The type of the parameters object (usually 'object').6865 */6866 type: string;6867 /**6868 * List of required parameter names.6869 */6870 required?: string[];6871 /**6872 * Definitions of each parameter.6873 */6874 properties: {6875 [k: string]: {6876 /**6877 * The data type of the parameter.6878 */6879 type: string;6880 /**6881 * A description of the expected parameter.6882 */6883 description: string;6884 };6885 };6886 };6887 } | {6888 /**6889 * Specifies the type of tool (e.g., 'function').6890 */6891 type: string;6892 /**6893 * Details of the function tool.6894 */6895 function: {6896 /**6897 * The name of the function.6898 */6899 name: string;6900 /**6901 * A brief description of what the function does.6902 */6903 description: string;6904 /**6905 * Schema defining the parameters accepted by the function.6906 */6907 parameters: {6908 /**6909 * The type of the parameters object (usually 'object').6910 */6911 type: string;6912 /**6913 * List of required parameter names.6914 */6915 required?: string[];6916 /**6917 * Definitions of each parameter.6918 */6919 properties: {6920 [k: string]: {6921 /**6922 * The data type of the parameter.6923 */6924 type: string;6925 /**6926 * A description of the expected parameter.6927 */6928 description: string;6929 };6930 };6931 };6932 };6933 })[];6934 response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1;6935 /**6936 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.6937 */6938 raw?: boolean;6939 /**6940 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.6941 */6942 stream?: boolean;6943 /**6944 * The maximum number of tokens to generate in the response.6945 */6946 max_tokens?: number;6947 /**6948 * Controls the randomness of the output; higher values produce more random results.6949 */6950 temperature?: number;6951 /**6952 * 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.6953 */6954 top_p?: number;6955 /**6956 * 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.6957 */6958 top_k?: number;6959 /**6960 * Random seed for reproducibility of the generation.6961 */6962 seed?: number;6963 /**6964 * Penalty for repeated tokens; higher values discourage repetition.6965 */6966 repetition_penalty?: number;6967 /**6968 * Decreases the likelihood of the model repeating the same lines verbatim.6969 */6970 frequency_penalty?: number;6971 /**6972 * Increases the likelihood of the model introducing new topics.6973 */6974 presence_penalty?: number;6975}6976interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {6977 type?: "json_object" | "json_schema";6978 json_schema?: unknown;6979}6980type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {6981 /**6982 * The generated text response from the model6983 */6984 response: string;6985 /**6986 * Usage statistics for the inference request6987 */6988 usage?: {6989 /**6990 * Total number of tokens in input6991 */6992 prompt_tokens?: number;6993 /**6994 * Total number of tokens in output6995 */6996 completion_tokens?: number;6997 /**6998 * Total number of input and output tokens6999 */7000 total_tokens?: number;7001 };7002 /**7003 * An array of tool calls requests made during the response generation7004 */7005 tool_calls?: {7006 /**7007 * The arguments passed to be passed to the tool call request7008 */7009 arguments?: object;7010 /**7011 * The name of the tool to be called7012 */7013 name?: string;7014 }[];7015};7016declare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct {7017 inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input;7018 postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output;7019}7020type Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages;7021interface Ai_Cf_Qwen_Qwq_32B_Prompt {7022 /**7023 * The input text prompt for the model to generate a response.7024 */7025 prompt: string;7026 /**7027 * JSON schema that should be fulfilled for the response.7028 */7029 guided_json?: object;7030 /**7031 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7032 */7033 raw?: boolean;7034 /**7035 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7036 */7037 stream?: boolean;7038 /**7039 * The maximum number of tokens to generate in the response.7040 */7041 max_tokens?: number;7042 /**7043 * Controls the randomness of the output; higher values produce more random results.7044 */7045 temperature?: number;7046 /**7047 * 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.7048 */7049 top_p?: number;7050 /**7051 * 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.7052 */7053 top_k?: number;7054 /**7055 * Random seed for reproducibility of the generation.7056 */7057 seed?: number;7058 /**7059 * Penalty for repeated tokens; higher values discourage repetition.7060 */7061 repetition_penalty?: number;7062 /**7063 * Decreases the likelihood of the model repeating the same lines verbatim.7064 */7065 frequency_penalty?: number;7066 /**7067 * Increases the likelihood of the model introducing new topics.7068 */7069 presence_penalty?: number;7070}7071interface Ai_Cf_Qwen_Qwq_32B_Messages {7072 /**7073 * An array of message objects representing the conversation history.7074 */7075 messages: {7076 /**7077 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').7078 */7079 role?: string;7080 /**7081 * The tool call id. If you don't know what to put here you can fall back to 0000000017082 */7083 tool_call_id?: string;7084 content?: string | {7085 /**7086 * Type of the content provided7087 */7088 type?: string;7089 text?: string;7090 image_url?: {7091 /**7092 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7093 */7094 url?: string;7095 };7096 }[] | {7097 /**7098 * Type of the content provided7099 */7100 type?: string;7101 text?: string;7102 image_url?: {7103 /**7104 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7105 */7106 url?: string;7107 };7108 };7109 }[];7110 functions?: {7111 name: string;7112 code: string;7113 }[];7114 /**7115 * A list of tools available for the assistant to use.7116 */7117 tools?: ({7118 /**7119 * The name of the tool. More descriptive the better.7120 */7121 name: string;7122 /**7123 * A brief description of what the tool does.7124 */7125 description: string;7126 /**7127 * Schema defining the parameters accepted by the tool.7128 */7129 parameters: {7130 /**7131 * The type of the parameters object (usually 'object').7132 */7133 type: string;7134 /**7135 * List of required parameter names.7136 */7137 required?: string[];7138 /**7139 * Definitions of each parameter.7140 */7141 properties: {7142 [k: string]: {7143 /**7144 * The data type of the parameter.7145 */7146 type: string;7147 /**7148 * A description of the expected parameter.7149 */7150 description: string;7151 };7152 };7153 };7154 } | {7155 /**7156 * Specifies the type of tool (e.g., 'function').7157 */7158 type: string;7159 /**7160 * Details of the function tool.7161 */7162 function: {7163 /**7164 * The name of the function.7165 */7166 name: string;7167 /**7168 * A brief description of what the function does.7169 */7170 description: string;7171 /**7172 * Schema defining the parameters accepted by the function.7173 */7174 parameters: {7175 /**7176 * The type of the parameters object (usually 'object').7177 */7178 type: string;7179 /**7180 * List of required parameter names.7181 */7182 required?: string[];7183 /**7184 * Definitions of each parameter.7185 */7186 properties: {7187 [k: string]: {7188 /**7189 * The data type of the parameter.7190 */7191 type: string;7192 /**7193 * A description of the expected parameter.7194 */7195 description: string;7196 };7197 };7198 };7199 };7200 })[];7201 /**7202 * JSON schema that should be fufilled for the response.7203 */7204 guided_json?: object;7205 /**7206 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7207 */7208 raw?: boolean;7209 /**7210 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7211 */7212 stream?: boolean;7213 /**7214 * The maximum number of tokens to generate in the response.7215 */7216 max_tokens?: number;7217 /**7218 * Controls the randomness of the output; higher values produce more random results.7219 */7220 temperature?: number;7221 /**7222 * 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.7223 */7224 top_p?: number;7225 /**7226 * 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.7227 */7228 top_k?: number;7229 /**7230 * Random seed for reproducibility of the generation.7231 */7232 seed?: number;7233 /**7234 * Penalty for repeated tokens; higher values discourage repetition.7235 */7236 repetition_penalty?: number;7237 /**7238 * Decreases the likelihood of the model repeating the same lines verbatim.7239 */7240 frequency_penalty?: number;7241 /**7242 * Increases the likelihood of the model introducing new topics.7243 */7244 presence_penalty?: number;7245}7246type Ai_Cf_Qwen_Qwq_32B_Output = {7247 /**7248 * The generated text response from the model7249 */7250 response: string;7251 /**7252 * Usage statistics for the inference request7253 */7254 usage?: {7255 /**7256 * Total number of tokens in input7257 */7258 prompt_tokens?: number;7259 /**7260 * Total number of tokens in output7261 */7262 completion_tokens?: number;7263 /**7264 * Total number of input and output tokens7265 */7266 total_tokens?: number;7267 };7268 /**7269 * An array of tool calls requests made during the response generation7270 */7271 tool_calls?: {7272 /**7273 * The arguments passed to be passed to the tool call request7274 */7275 arguments?: object;7276 /**7277 * The name of the tool to be called7278 */7279 name?: string;7280 }[];7281};7282declare abstract class Base_Ai_Cf_Qwen_Qwq_32B {7283 inputs: Ai_Cf_Qwen_Qwq_32B_Input;7284 postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output;7285}7286type 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;7287interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {7288 /**7289 * The input text prompt for the model to generate a response.7290 */7291 prompt: string;7292 /**7293 * JSON schema that should be fulfilled for the response.7294 */7295 guided_json?: object;7296 /**7297 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7298 */7299 raw?: boolean;7300 /**7301 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7302 */7303 stream?: boolean;7304 /**7305 * The maximum number of tokens to generate in the response.7306 */7307 max_tokens?: number;7308 /**7309 * Controls the randomness of the output; higher values produce more random results.7310 */7311 temperature?: number;7312 /**7313 * 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.7314 */7315 top_p?: number;7316 /**7317 * 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.7318 */7319 top_k?: number;7320 /**7321 * Random seed for reproducibility of the generation.7322 */7323 seed?: number;7324 /**7325 * Penalty for repeated tokens; higher values discourage repetition.7326 */7327 repetition_penalty?: number;7328 /**7329 * Decreases the likelihood of the model repeating the same lines verbatim.7330 */7331 frequency_penalty?: number;7332 /**7333 * Increases the likelihood of the model introducing new topics.7334 */7335 presence_penalty?: number;7336}7337interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {7338 /**7339 * An array of message objects representing the conversation history.7340 */7341 messages: {7342 /**7343 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').7344 */7345 role?: string;7346 /**7347 * 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 0000000017348 */7349 tool_call_id?: string;7350 content?: string | {7351 /**7352 * Type of the content provided7353 */7354 type?: string;7355 text?: string;7356 image_url?: {7357 /**7358 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7359 */7360 url?: string;7361 };7362 }[] | {7363 /**7364 * Type of the content provided7365 */7366 type?: string;7367 text?: string;7368 image_url?: {7369 /**7370 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7371 */7372 url?: string;7373 };7374 };7375 }[];7376 functions?: {7377 name: string;7378 code: string;7379 }[];7380 /**7381 * A list of tools available for the assistant to use.7382 */7383 tools?: ({7384 /**7385 * The name of the tool. More descriptive the better.7386 */7387 name: string;7388 /**7389 * A brief description of what the tool does.7390 */7391 description: string;7392 /**7393 * Schema defining the parameters accepted by the tool.7394 */7395 parameters: {7396 /**7397 * The type of the parameters object (usually 'object').7398 */7399 type: string;7400 /**7401 * List of required parameter names.7402 */7403 required?: string[];7404 /**7405 * Definitions of each parameter.7406 */7407 properties: {7408 [k: string]: {7409 /**7410 * The data type of the parameter.7411 */7412 type: string;7413 /**7414 * A description of the expected parameter.7415 */7416 description: string;7417 };7418 };7419 };7420 } | {7421 /**7422 * Specifies the type of tool (e.g., 'function').7423 */7424 type: string;7425 /**7426 * Details of the function tool.7427 */7428 function: {7429 /**7430 * The name of the function.7431 */7432 name: string;7433 /**7434 * A brief description of what the function does.7435 */7436 description: string;7437 /**7438 * Schema defining the parameters accepted by the function.7439 */7440 parameters: {7441 /**7442 * The type of the parameters object (usually 'object').7443 */7444 type: string;7445 /**7446 * List of required parameter names.7447 */7448 required?: string[];7449 /**7450 * Definitions of each parameter.7451 */7452 properties: {7453 [k: string]: {7454 /**7455 * The data type of the parameter.7456 */7457 type: string;7458 /**7459 * A description of the expected parameter.7460 */7461 description: string;7462 };7463 };7464 };7465 };7466 })[];7467 /**7468 * JSON schema that should be fufilled for the response.7469 */7470 guided_json?: object;7471 /**7472 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7473 */7474 raw?: boolean;7475 /**7476 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7477 */7478 stream?: boolean;7479 /**7480 * The maximum number of tokens to generate in the response.7481 */7482 max_tokens?: number;7483 /**7484 * Controls the randomness of the output; higher values produce more random results.7485 */7486 temperature?: number;7487 /**7488 * 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.7489 */7490 top_p?: number;7491 /**7492 * 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.7493 */7494 top_k?: number;7495 /**7496 * Random seed for reproducibility of the generation.7497 */7498 seed?: number;7499 /**7500 * Penalty for repeated tokens; higher values discourage repetition.7501 */7502 repetition_penalty?: number;7503 /**7504 * Decreases the likelihood of the model repeating the same lines verbatim.7505 */7506 frequency_penalty?: number;7507 /**7508 * Increases the likelihood of the model introducing new topics.7509 */7510 presence_penalty?: number;7511}7512type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {7513 /**7514 * The generated text response from the model7515 */7516 response: string;7517 /**7518 * Usage statistics for the inference request7519 */7520 usage?: {7521 /**7522 * Total number of tokens in input7523 */7524 prompt_tokens?: number;7525 /**7526 * Total number of tokens in output7527 */7528 completion_tokens?: number;7529 /**7530 * Total number of input and output tokens7531 */7532 total_tokens?: number;7533 };7534 /**7535 * An array of tool calls requests made during the response generation7536 */7537 tool_calls?: {7538 /**7539 * The arguments passed to be passed to the tool call request7540 */7541 arguments?: object;7542 /**7543 * The name of the tool to be called7544 */7545 name?: string;7546 }[];7547};7548declare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct {7549 inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input;7550 postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output;7551}7552type Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages;7553interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {7554 /**7555 * The input text prompt for the model to generate a response.7556 */7557 prompt: string;7558 /**7559 * JSON schema that should be fufilled for the response.7560 */7561 guided_json?: object;7562 /**7563 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7564 */7565 raw?: boolean;7566 /**7567 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7568 */7569 stream?: boolean;7570 /**7571 * The maximum number of tokens to generate in the response.7572 */7573 max_tokens?: number;7574 /**7575 * Controls the randomness of the output; higher values produce more random results.7576 */7577 temperature?: number;7578 /**7579 * 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.7580 */7581 top_p?: number;7582 /**7583 * 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.7584 */7585 top_k?: number;7586 /**7587 * Random seed for reproducibility of the generation.7588 */7589 seed?: number;7590 /**7591 * Penalty for repeated tokens; higher values discourage repetition.7592 */7593 repetition_penalty?: number;7594 /**7595 * Decreases the likelihood of the model repeating the same lines verbatim.7596 */7597 frequency_penalty?: number;7598 /**7599 * Increases the likelihood of the model introducing new topics.7600 */7601 presence_penalty?: number;7602}7603interface Ai_Cf_Google_Gemma_3_12B_It_Messages {7604 /**7605 * An array of message objects representing the conversation history.7606 */7607 messages: {7608 /**7609 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').7610 */7611 role?: string;7612 content?: string | {7613 /**7614 * Type of the content provided7615 */7616 type?: string;7617 text?: string;7618 image_url?: {7619 /**7620 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7621 */7622 url?: string;7623 };7624 }[];7625 }[];7626 functions?: {7627 name: string;7628 code: string;7629 }[];7630 /**7631 * A list of tools available for the assistant to use.7632 */7633 tools?: ({7634 /**7635 * The name of the tool. More descriptive the better.7636 */7637 name: string;7638 /**7639 * A brief description of what the tool does.7640 */7641 description: string;7642 /**7643 * Schema defining the parameters accepted by the tool.7644 */7645 parameters: {7646 /**7647 * The type of the parameters object (usually 'object').7648 */7649 type: string;7650 /**7651 * List of required parameter names.7652 */7653 required?: string[];7654 /**7655 * Definitions of each parameter.7656 */7657 properties: {7658 [k: string]: {7659 /**7660 * The data type of the parameter.7661 */7662 type: string;7663 /**7664 * A description of the expected parameter.7665 */7666 description: string;7667 };7668 };7669 };7670 } | {7671 /**7672 * Specifies the type of tool (e.g., 'function').7673 */7674 type: string;7675 /**7676 * Details of the function tool.7677 */7678 function: {7679 /**7680 * The name of the function.7681 */7682 name: string;7683 /**7684 * A brief description of what the function does.7685 */7686 description: string;7687 /**7688 * Schema defining the parameters accepted by the function.7689 */7690 parameters: {7691 /**7692 * The type of the parameters object (usually 'object').7693 */7694 type: string;7695 /**7696 * List of required parameter names.7697 */7698 required?: string[];7699 /**7700 * Definitions of each parameter.7701 */7702 properties: {7703 [k: string]: {7704 /**7705 * The data type of the parameter.7706 */7707 type: string;7708 /**7709 * A description of the expected parameter.7710 */7711 description: string;7712 };7713 };7714 };7715 };7716 })[];7717 /**7718 * JSON schema that should be fufilled for the response.7719 */7720 guided_json?: object;7721 /**7722 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7723 */7724 raw?: boolean;7725 /**7726 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7727 */7728 stream?: boolean;7729 /**7730 * The maximum number of tokens to generate in the response.7731 */7732 max_tokens?: number;7733 /**7734 * Controls the randomness of the output; higher values produce more random results.7735 */7736 temperature?: number;7737 /**7738 * 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.7739 */7740 top_p?: number;7741 /**7742 * 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.7743 */7744 top_k?: number;7745 /**7746 * Random seed for reproducibility of the generation.7747 */7748 seed?: number;7749 /**7750 * Penalty for repeated tokens; higher values discourage repetition.7751 */7752 repetition_penalty?: number;7753 /**7754 * Decreases the likelihood of the model repeating the same lines verbatim.7755 */7756 frequency_penalty?: number;7757 /**7758 * Increases the likelihood of the model introducing new topics.7759 */7760 presence_penalty?: number;7761}7762type Ai_Cf_Google_Gemma_3_12B_It_Output = {7763 /**7764 * The generated text response from the model7765 */7766 response: string;7767 /**7768 * Usage statistics for the inference request7769 */7770 usage?: {7771 /**7772 * Total number of tokens in input7773 */7774 prompt_tokens?: number;7775 /**7776 * Total number of tokens in output7777 */7778 completion_tokens?: number;7779 /**7780 * Total number of input and output tokens7781 */7782 total_tokens?: number;7783 };7784 /**7785 * An array of tool calls requests made during the response generation7786 */7787 tool_calls?: {7788 /**7789 * The arguments passed to be passed to the tool call request7790 */7791 arguments?: object;7792 /**7793 * The name of the tool to be called7794 */7795 name?: string;7796 }[];7797};7798declare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {7799 inputs: Ai_Cf_Google_Gemma_3_12B_It_Input;7800 postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output;7801}7802type 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;7803interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {7804 /**7805 * The input text prompt for the model to generate a response.7806 */7807 prompt: string;7808 /**7809 * JSON schema that should be fulfilled for the response.7810 */7811 guided_json?: object;7812 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;7813 /**7814 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7815 */7816 raw?: boolean;7817 /**7818 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7819 */7820 stream?: boolean;7821 /**7822 * The maximum number of tokens to generate in the response.7823 */7824 max_tokens?: number;7825 /**7826 * Controls the randomness of the output; higher values produce more random results.7827 */7828 temperature?: number;7829 /**7830 * 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.7831 */7832 top_p?: number;7833 /**7834 * 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.7835 */7836 top_k?: number;7837 /**7838 * Random seed for reproducibility of the generation.7839 */7840 seed?: number;7841 /**7842 * Penalty for repeated tokens; higher values discourage repetition.7843 */7844 repetition_penalty?: number;7845 /**7846 * Decreases the likelihood of the model repeating the same lines verbatim.7847 */7848 frequency_penalty?: number;7849 /**7850 * Increases the likelihood of the model introducing new topics.7851 */7852 presence_penalty?: number;7853}7854interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {7855 type?: "json_object" | "json_schema";7856 json_schema?: unknown;7857}7858interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {7859 /**7860 * An array of message objects representing the conversation history.7861 */7862 messages: {7863 /**7864 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').7865 */7866 role?: string;7867 /**7868 * The tool call id. If you don't know what to put here you can fall back to 0000000017869 */7870 tool_call_id?: string;7871 content?: string | {7872 /**7873 * Type of the content provided7874 */7875 type?: string;7876 text?: string;7877 image_url?: {7878 /**7879 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7880 */7881 url?: string;7882 };7883 }[] | {7884 /**7885 * Type of the content provided7886 */7887 type?: string;7888 text?: string;7889 image_url?: {7890 /**7891 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted7892 */7893 url?: string;7894 };7895 };7896 }[];7897 functions?: {7898 name: string;7899 code: string;7900 }[];7901 /**7902 * A list of tools available for the assistant to use.7903 */7904 tools?: ({7905 /**7906 * The name of the tool. More descriptive the better.7907 */7908 name: string;7909 /**7910 * A brief description of what the tool does.7911 */7912 description: string;7913 /**7914 * Schema defining the parameters accepted by the tool.7915 */7916 parameters: {7917 /**7918 * The type of the parameters object (usually 'object').7919 */7920 type: string;7921 /**7922 * List of required parameter names.7923 */7924 required?: string[];7925 /**7926 * Definitions of each parameter.7927 */7928 properties: {7929 [k: string]: {7930 /**7931 * The data type of the parameter.7932 */7933 type: string;7934 /**7935 * A description of the expected parameter.7936 */7937 description: string;7938 };7939 };7940 };7941 } | {7942 /**7943 * Specifies the type of tool (e.g., 'function').7944 */7945 type: string;7946 /**7947 * Details of the function tool.7948 */7949 function: {7950 /**7951 * The name of the function.7952 */7953 name: string;7954 /**7955 * A brief description of what the function does.7956 */7957 description: string;7958 /**7959 * Schema defining the parameters accepted by the function.7960 */7961 parameters: {7962 /**7963 * The type of the parameters object (usually 'object').7964 */7965 type: string;7966 /**7967 * List of required parameter names.7968 */7969 required?: string[];7970 /**7971 * Definitions of each parameter.7972 */7973 properties: {7974 [k: string]: {7975 /**7976 * The data type of the parameter.7977 */7978 type: string;7979 /**7980 * A description of the expected parameter.7981 */7982 description: string;7983 };7984 };7985 };7986 };7987 })[];7988 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;7989 /**7990 * JSON schema that should be fufilled for the response.7991 */7992 guided_json?: object;7993 /**7994 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.7995 */7996 raw?: boolean;7997 /**7998 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.7999 */8000 stream?: boolean;8001 /**8002 * The maximum number of tokens to generate in the response.8003 */8004 max_tokens?: number;8005 /**8006 * Controls the randomness of the output; higher values produce more random results.8007 */8008 temperature?: number;8009 /**8010 * 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.8011 */8012 top_p?: number;8013 /**8014 * 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.8015 */8016 top_k?: number;8017 /**8018 * Random seed for reproducibility of the generation.8019 */8020 seed?: number;8021 /**8022 * Penalty for repeated tokens; higher values discourage repetition.8023 */8024 repetition_penalty?: number;8025 /**8026 * Decreases the likelihood of the model repeating the same lines verbatim.8027 */8028 frequency_penalty?: number;8029 /**8030 * Increases the likelihood of the model introducing new topics.8031 */8032 presence_penalty?: number;8033}8034interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {8035 requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[];8036}8037interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {8038 /**8039 * The input text prompt for the model to generate a response.8040 */8041 prompt: string;8042 /**8043 * JSON schema that should be fulfilled for the response.8044 */8045 guided_json?: object;8046 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;8047 /**8048 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8049 */8050 raw?: boolean;8051 /**8052 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8053 */8054 stream?: boolean;8055 /**8056 * The maximum number of tokens to generate in the response.8057 */8058 max_tokens?: number;8059 /**8060 * Controls the randomness of the output; higher values produce more random results.8061 */8062 temperature?: number;8063 /**8064 * 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.8065 */8066 top_p?: number;8067 /**8068 * 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.8069 */8070 top_k?: number;8071 /**8072 * Random seed for reproducibility of the generation.8073 */8074 seed?: number;8075 /**8076 * Penalty for repeated tokens; higher values discourage repetition.8077 */8078 repetition_penalty?: number;8079 /**8080 * Decreases the likelihood of the model repeating the same lines verbatim.8081 */8082 frequency_penalty?: number;8083 /**8084 * Increases the likelihood of the model introducing new topics.8085 */8086 presence_penalty?: number;8087}8088interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {8089 /**8090 * An array of message objects representing the conversation history.8091 */8092 messages: {8093 /**8094 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').8095 */8096 role?: string;8097 /**8098 * The tool call id. If you don't know what to put here you can fall back to 0000000018099 */8100 tool_call_id?: string;8101 content?: string | {8102 /**8103 * Type of the content provided8104 */8105 type?: string;8106 text?: string;8107 image_url?: {8108 /**8109 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted8110 */8111 url?: string;8112 };8113 }[] | {8114 /**8115 * Type of the content provided8116 */8117 type?: string;8118 text?: string;8119 image_url?: {8120 /**8121 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted8122 */8123 url?: string;8124 };8125 };8126 }[];8127 functions?: {8128 name: string;8129 code: string;8130 }[];8131 /**8132 * A list of tools available for the assistant to use.8133 */8134 tools?: ({8135 /**8136 * The name of the tool. More descriptive the better.8137 */8138 name: string;8139 /**8140 * A brief description of what the tool does.8141 */8142 description: string;8143 /**8144 * Schema defining the parameters accepted by the tool.8145 */8146 parameters: {8147 /**8148 * The type of the parameters object (usually 'object').8149 */8150 type: string;8151 /**8152 * List of required parameter names.8153 */8154 required?: string[];8155 /**8156 * Definitions of each parameter.8157 */8158 properties: {8159 [k: string]: {8160 /**8161 * The data type of the parameter.8162 */8163 type: string;8164 /**8165 * A description of the expected parameter.8166 */8167 description: string;8168 };8169 };8170 };8171 } | {8172 /**8173 * Specifies the type of tool (e.g., 'function').8174 */8175 type: string;8176 /**8177 * Details of the function tool.8178 */8179 function: {8180 /**8181 * The name of the function.8182 */8183 name: string;8184 /**8185 * A brief description of what the function does.8186 */8187 description: string;8188 /**8189 * Schema defining the parameters accepted by the function.8190 */8191 parameters: {8192 /**8193 * The type of the parameters object (usually 'object').8194 */8195 type: string;8196 /**8197 * List of required parameter names.8198 */8199 required?: string[];8200 /**8201 * Definitions of each parameter.8202 */8203 properties: {8204 [k: string]: {8205 /**8206 * The data type of the parameter.8207 */8208 type: string;8209 /**8210 * A description of the expected parameter.8211 */8212 description: string;8213 };8214 };8215 };8216 };8217 })[];8218 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;8219 /**8220 * JSON schema that should be fufilled for the response.8221 */8222 guided_json?: object;8223 /**8224 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8225 */8226 raw?: boolean;8227 /**8228 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8229 */8230 stream?: boolean;8231 /**8232 * The maximum number of tokens to generate in the response.8233 */8234 max_tokens?: number;8235 /**8236 * Controls the randomness of the output; higher values produce more random results.8237 */8238 temperature?: number;8239 /**8240 * 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.8241 */8242 top_p?: number;8243 /**8244 * 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.8245 */8246 top_k?: number;8247 /**8248 * Random seed for reproducibility of the generation.8249 */8250 seed?: number;8251 /**8252 * Penalty for repeated tokens; higher values discourage repetition.8253 */8254 repetition_penalty?: number;8255 /**8256 * Decreases the likelihood of the model repeating the same lines verbatim.8257 */8258 frequency_penalty?: number;8259 /**8260 * Increases the likelihood of the model introducing new topics.8261 */8262 presence_penalty?: number;8263}8264type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {8265 /**8266 * The generated text response from the model8267 */8268 response: string;8269 /**8270 * Usage statistics for the inference request8271 */8272 usage?: {8273 /**8274 * Total number of tokens in input8275 */8276 prompt_tokens?: number;8277 /**8278 * Total number of tokens in output8279 */8280 completion_tokens?: number;8281 /**8282 * Total number of input and output tokens8283 */8284 total_tokens?: number;8285 };8286 /**8287 * An array of tool calls requests made during the response generation8288 */8289 tool_calls?: {8290 /**8291 * The tool call id.8292 */8293 id?: string;8294 /**8295 * Specifies the type of tool (e.g., 'function').8296 */8297 type?: string;8298 /**8299 * Details of the function tool.8300 */8301 function?: {8302 /**8303 * The name of the tool to be called8304 */8305 name?: string;8306 /**8307 * The arguments passed to be passed to the tool call request8308 */8309 arguments?: object;8310 };8311 }[];8312};8313declare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {8314 inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;8315 postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;8316}8317type 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;8318interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {8319 /**8320 * The input text prompt for the model to generate a response.8321 */8322 prompt: string;8323 /**8324 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.8325 */8326 lora?: string;8327 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode;8328 /**8329 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8330 */8331 raw?: boolean;8332 /**8333 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8334 */8335 stream?: boolean;8336 /**8337 * The maximum number of tokens to generate in the response.8338 */8339 max_tokens?: number;8340 /**8341 * Controls the randomness of the output; higher values produce more random results.8342 */8343 temperature?: number;8344 /**8345 * 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.8346 */8347 top_p?: number;8348 /**8349 * 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.8350 */8351 top_k?: number;8352 /**8353 * Random seed for reproducibility of the generation.8354 */8355 seed?: number;8356 /**8357 * Penalty for repeated tokens; higher values discourage repetition.8358 */8359 repetition_penalty?: number;8360 /**8361 * Decreases the likelihood of the model repeating the same lines verbatim.8362 */8363 frequency_penalty?: number;8364 /**8365 * Increases the likelihood of the model introducing new topics.8366 */8367 presence_penalty?: number;8368}8369interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {8370 type?: "json_object" | "json_schema";8371 json_schema?: unknown;8372}8373interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {8374 /**8375 * An array of message objects representing the conversation history.8376 */8377 messages: {8378 /**8379 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').8380 */8381 role: string;8382 content: string | {8383 /**8384 * Type of the content (text)8385 */8386 type?: string;8387 /**8388 * Text content8389 */8390 text?: string;8391 }[];8392 }[];8393 functions?: {8394 name: string;8395 code: string;8396 }[];8397 /**8398 * A list of tools available for the assistant to use.8399 */8400 tools?: ({8401 /**8402 * The name of the tool. More descriptive the better.8403 */8404 name: string;8405 /**8406 * A brief description of what the tool does.8407 */8408 description: string;8409 /**8410 * Schema defining the parameters accepted by the tool.8411 */8412 parameters: {8413 /**8414 * The type of the parameters object (usually 'object').8415 */8416 type: string;8417 /**8418 * List of required parameter names.8419 */8420 required?: string[];8421 /**8422 * Definitions of each parameter.8423 */8424 properties: {8425 [k: string]: {8426 /**8427 * The data type of the parameter.8428 */8429 type: string;8430 /**8431 * A description of the expected parameter.8432 */8433 description: string;8434 };8435 };8436 };8437 } | {8438 /**8439 * Specifies the type of tool (e.g., 'function').8440 */8441 type: string;8442 /**8443 * Details of the function tool.8444 */8445 function: {8446 /**8447 * The name of the function.8448 */8449 name: string;8450 /**8451 * A brief description of what the function does.8452 */8453 description: string;8454 /**8455 * Schema defining the parameters accepted by the function.8456 */8457 parameters: {8458 /**8459 * The type of the parameters object (usually 'object').8460 */8461 type: string;8462 /**8463 * List of required parameter names.8464 */8465 required?: string[];8466 /**8467 * Definitions of each parameter.8468 */8469 properties: {8470 [k: string]: {8471 /**8472 * The data type of the parameter.8473 */8474 type: string;8475 /**8476 * A description of the expected parameter.8477 */8478 description: string;8479 };8480 };8481 };8482 };8483 })[];8484 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1;8485 /**8486 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8487 */8488 raw?: boolean;8489 /**8490 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8491 */8492 stream?: boolean;8493 /**8494 * The maximum number of tokens to generate in the response.8495 */8496 max_tokens?: number;8497 /**8498 * Controls the randomness of the output; higher values produce more random results.8499 */8500 temperature?: number;8501 /**8502 * 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.8503 */8504 top_p?: number;8505 /**8506 * 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.8507 */8508 top_k?: number;8509 /**8510 * Random seed for reproducibility of the generation.8511 */8512 seed?: number;8513 /**8514 * Penalty for repeated tokens; higher values discourage repetition.8515 */8516 repetition_penalty?: number;8517 /**8518 * Decreases the likelihood of the model repeating the same lines verbatim.8519 */8520 frequency_penalty?: number;8521 /**8522 * Increases the likelihood of the model introducing new topics.8523 */8524 presence_penalty?: number;8525}8526interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {8527 type?: "json_object" | "json_schema";8528 json_schema?: unknown;8529}8530interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {8531 requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[];8532}8533interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {8534 /**8535 * The input text prompt for the model to generate a response.8536 */8537 prompt: string;8538 /**8539 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.8540 */8541 lora?: string;8542 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2;8543 /**8544 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8545 */8546 raw?: boolean;8547 /**8548 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8549 */8550 stream?: boolean;8551 /**8552 * The maximum number of tokens to generate in the response.8553 */8554 max_tokens?: number;8555 /**8556 * Controls the randomness of the output; higher values produce more random results.8557 */8558 temperature?: number;8559 /**8560 * 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.8561 */8562 top_p?: number;8563 /**8564 * 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.8565 */8566 top_k?: number;8567 /**8568 * Random seed for reproducibility of the generation.8569 */8570 seed?: number;8571 /**8572 * Penalty for repeated tokens; higher values discourage repetition.8573 */8574 repetition_penalty?: number;8575 /**8576 * Decreases the likelihood of the model repeating the same lines verbatim.8577 */8578 frequency_penalty?: number;8579 /**8580 * Increases the likelihood of the model introducing new topics.8581 */8582 presence_penalty?: number;8583}8584interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {8585 type?: "json_object" | "json_schema";8586 json_schema?: unknown;8587}8588interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {8589 /**8590 * An array of message objects representing the conversation history.8591 */8592 messages: {8593 /**8594 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').8595 */8596 role: string;8597 content: string | {8598 /**8599 * Type of the content (text)8600 */8601 type?: string;8602 /**8603 * Text content8604 */8605 text?: string;8606 }[];8607 }[];8608 functions?: {8609 name: string;8610 code: string;8611 }[];8612 /**8613 * A list of tools available for the assistant to use.8614 */8615 tools?: ({8616 /**8617 * The name of the tool. More descriptive the better.8618 */8619 name: string;8620 /**8621 * A brief description of what the tool does.8622 */8623 description: string;8624 /**8625 * Schema defining the parameters accepted by the tool.8626 */8627 parameters: {8628 /**8629 * The type of the parameters object (usually 'object').8630 */8631 type: string;8632 /**8633 * List of required parameter names.8634 */8635 required?: string[];8636 /**8637 * Definitions of each parameter.8638 */8639 properties: {8640 [k: string]: {8641 /**8642 * The data type of the parameter.8643 */8644 type: string;8645 /**8646 * A description of the expected parameter.8647 */8648 description: string;8649 };8650 };8651 };8652 } | {8653 /**8654 * Specifies the type of tool (e.g., 'function').8655 */8656 type: string;8657 /**8658 * Details of the function tool.8659 */8660 function: {8661 /**8662 * The name of the function.8663 */8664 name: string;8665 /**8666 * A brief description of what the function does.8667 */8668 description: string;8669 /**8670 * Schema defining the parameters accepted by the function.8671 */8672 parameters: {8673 /**8674 * The type of the parameters object (usually 'object').8675 */8676 type: string;8677 /**8678 * List of required parameter names.8679 */8680 required?: string[];8681 /**8682 * Definitions of each parameter.8683 */8684 properties: {8685 [k: string]: {8686 /**8687 * The data type of the parameter.8688 */8689 type: string;8690 /**8691 * A description of the expected parameter.8692 */8693 description: string;8694 };8695 };8696 };8697 };8698 })[];8699 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3;8700 /**8701 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.8702 */8703 raw?: boolean;8704 /**8705 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.8706 */8707 stream?: boolean;8708 /**8709 * The maximum number of tokens to generate in the response.8710 */8711 max_tokens?: number;8712 /**8713 * Controls the randomness of the output; higher values produce more random results.8714 */8715 temperature?: number;8716 /**8717 * 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.8718 */8719 top_p?: number;8720 /**8721 * 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.8722 */8723 top_k?: number;8724 /**8725 * Random seed for reproducibility of the generation.8726 */8727 seed?: number;8728 /**8729 * Penalty for repeated tokens; higher values discourage repetition.8730 */8731 repetition_penalty?: number;8732 /**8733 * Decreases the likelihood of the model repeating the same lines verbatim.8734 */8735 frequency_penalty?: number;8736 /**8737 * Increases the likelihood of the model introducing new topics.8738 */8739 presence_penalty?: number;8740}8741interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {8742 type?: "json_object" | "json_schema";8743 json_schema?: unknown;8744}8745type 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;8746interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {8747 /**8748 * Unique identifier for the completion8749 */8750 id?: string;8751 /**8752 * Object type identifier8753 */8754 object?: "chat.completion";8755 /**8756 * Unix timestamp of when the completion was created8757 */8758 created?: number;8759 /**8760 * Model used for the completion8761 */8762 model?: string;8763 /**8764 * List of completion choices8765 */8766 choices?: {8767 /**8768 * Index of the choice in the list8769 */8770 index?: number;8771 /**8772 * The message generated by the model8773 */8774 message?: {8775 /**8776 * Role of the message author8777 */8778 role: string;8779 /**8780 * The content of the message8781 */8782 content: string;8783 /**8784 * Internal reasoning content (if available)8785 */8786 reasoning_content?: string;8787 /**8788 * Tool calls made by the assistant8789 */8790 tool_calls?: {8791 /**8792 * Unique identifier for the tool call8793 */8794 id: string;8795 /**8796 * Type of tool call8797 */8798 type: "function";8799 function: {8800 /**8801 * Name of the function to call8802 */8803 name: string;8804 /**8805 * JSON string of arguments for the function8806 */8807 arguments: string;8808 };8809 }[];8810 };8811 /**8812 * Reason why the model stopped generating8813 */8814 finish_reason?: string;8815 /**8816 * Stop reason (may be null)8817 */8818 stop_reason?: string | null;8819 /**8820 * Log probabilities (if requested)8821 */8822 logprobs?: {} | null;8823 }[];8824 /**8825 * Usage statistics for the inference request8826 */8827 usage?: {8828 /**8829 * Total number of tokens in input8830 */8831 prompt_tokens?: number;8832 /**8833 * Total number of tokens in output8834 */8835 completion_tokens?: number;8836 /**8837 * Total number of input and output tokens8838 */8839 total_tokens?: number;8840 };8841 /**8842 * Log probabilities for the prompt (if requested)8843 */8844 prompt_logprobs?: {} | null;8845}8846interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {8847 /**8848 * Unique identifier for the completion8849 */8850 id?: string;8851 /**8852 * Object type identifier8853 */8854 object?: "text_completion";8855 /**8856 * Unix timestamp of when the completion was created8857 */8858 created?: number;8859 /**8860 * Model used for the completion8861 */8862 model?: string;8863 /**8864 * List of completion choices8865 */8866 choices?: {8867 /**8868 * Index of the choice in the list8869 */8870 index: number;8871 /**8872 * The generated text completion8873 */8874 text: string;8875 /**8876 * Reason why the model stopped generating8877 */8878 finish_reason: string;8879 /**8880 * Stop reason (may be null)8881 */8882 stop_reason?: string | null;8883 /**8884 * Log probabilities (if requested)8885 */8886 logprobs?: {} | null;8887 /**8888 * Log probabilities for the prompt (if requested)8889 */8890 prompt_logprobs?: {} | null;8891 }[];8892 /**8893 * Usage statistics for the inference request8894 */8895 usage?: {8896 /**8897 * Total number of tokens in input8898 */8899 prompt_tokens?: number;8900 /**8901 * Total number of tokens in output8902 */8903 completion_tokens?: number;8904 /**8905 * Total number of input and output tokens8906 */8907 total_tokens?: number;8908 };8909}8910interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {8911 /**8912 * The async request id that can be used to obtain the results.8913 */8914 request_id?: string;8915}8916declare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 {8917 inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input;8918 postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output;8919}8920interface Ai_Cf_Deepgram_Nova_3_Input {8921 audio: {8922 body: object;8923 contentType: string;8924 };8925 /**8926 * 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.8927 */8928 custom_topic_mode?: "extended" | "strict";8929 /**8930 * Custom topics you want the model to detect within your input audio or text if present Submit up to 1008931 */8932 custom_topic?: string;8933 /**8934 * 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 param8935 */8936 custom_intent_mode?: "extended" | "strict";8937 /**8938 * Custom intents you want the model to detect within your input audio if present8939 */8940 custom_intent?: string;8941 /**8942 * Identifies and extracts key entities from content in submitted audio8943 */8944 detect_entities?: boolean;8945 /**8946 * Identifies the dominant language spoken in submitted audio8947 */8948 detect_language?: boolean;8949 /**8950 * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 08951 */8952 diarize?: boolean;8953 /**8954 * Identify and extract key entities from content in submitted audio8955 */8956 dictation?: boolean;8957 /**8958 * Specify the expected encoding of your submitted audio8959 */8960 encoding?: "linear16" | "flac" | "mulaw" | "amr-nb" | "amr-wb" | "opus" | "speex" | "g729";8961 /**8962 * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing8963 */8964 extra?: string;8965 /**8966 * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'8967 */8968 filler_words?: boolean;8969 /**8970 * Key term prompting can boost or suppress specialized terminology and brands.8971 */8972 keyterm?: string;8973 /**8974 * Keywords can boost or suppress specialized terminology and brands.8975 */8976 keywords?: string;8977 /**8978 * 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.8979 */8980 language?: string;8981 /**8982 * Spoken measurements will be converted to their corresponding abbreviations.8983 */8984 measurements?: boolean;8985 /**8986 * 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.8987 */8988 mip_opt_out?: boolean;8989 /**8990 * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio8991 */8992 mode?: "general" | "medical" | "finance";8993 /**8994 * Transcribe each audio channel independently.8995 */8996 multichannel?: boolean;8997 /**8998 * Numerals converts numbers from written format to numerical format.8999 */9000 numerals?: boolean;9001 /**9002 * Splits audio into paragraphs to improve transcript readability.9003 */9004 paragraphs?: boolean;9005 /**9006 * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.9007 */9008 profanity_filter?: boolean;9009 /**9010 * Add punctuation and capitalization to the transcript.9011 */9012 punctuate?: boolean;9013 /**9014 * Redaction removes sensitive information from your transcripts.9015 */9016 redact?: string;9017 /**9018 * Search for terms or phrases in submitted audio and replaces them.9019 */9020 replace?: string;9021 /**9022 * Search for terms or phrases in submitted audio.9023 */9024 search?: string;9025 /**9026 * Recognizes the sentiment throughout a transcript or text.9027 */9028 sentiment?: boolean;9029 /**9030 * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.9031 */9032 smart_format?: boolean;9033 /**9034 * Detect topics throughout a transcript or text.9035 */9036 topics?: boolean;9037 /**9038 * Segments speech into meaningful semantic units.9039 */9040 utterances?: boolean;9041 /**9042 * Seconds to wait before detecting a pause between words in submitted audio.9043 */9044 utt_split?: number;9045 /**9046 * The number of channels in the submitted audio9047 */9048 channels?: number;9049 /**9050 * 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.9051 */9052 interim_results?: boolean;9053 /**9054 * 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 endpointing9055 */9056 endpointing?: string;9057 /**9058 * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.9059 */9060 vad_events?: boolean;9061 /**9062 * 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.9063 */9064 utterance_end_ms?: boolean;9065}9066interface Ai_Cf_Deepgram_Nova_3_Output {9067 results?: {9068 channels?: {9069 alternatives?: {9070 confidence?: number;9071 transcript?: string;9072 words?: {9073 confidence?: number;9074 end?: number;9075 start?: number;9076 word?: string;9077 }[];9078 }[];9079 }[];9080 summary?: {9081 result?: string;9082 short?: string;9083 };9084 sentiments?: {9085 segments?: {9086 text?: string;9087 start_word?: number;9088 end_word?: number;9089 sentiment?: string;9090 sentiment_score?: number;9091 }[];9092 average?: {9093 sentiment?: string;9094 sentiment_score?: number;9095 };9096 };9097 };9098}9099declare abstract class Base_Ai_Cf_Deepgram_Nova_3 {9100 inputs: Ai_Cf_Deepgram_Nova_3_Input;9101 postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;9102}9103interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {9104 queries?: string | string[];9105 /**9106 * Optional instruction for the task9107 */9108 instruction?: string;9109 documents?: string | string[];9110 text?: string | string[];9111}9112interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {9113 data?: number[][];9114 shape?: number[];9115}9116declare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B {9117 inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input;9118 postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output;9119}9120type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {9121 /**9122 * readable stream with audio data and content-type specified for that data9123 */9124 audio: {9125 body: object;9126 contentType: string;9127 };9128 /**9129 * type of data PCM data that's sent to the inference server as raw array9130 */9131 dtype?: "uint8" | "float32" | "float64";9132} | {9133 /**9134 * base64 encoded audio data9135 */9136 audio: string;9137 /**9138 * type of data PCM data that's sent to the inference server as raw array9139 */9140 dtype?: "uint8" | "float32" | "float64";9141};9142interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {9143 /**9144 * if true, end-of-turn was detected9145 */9146 is_complete?: boolean;9147 /**9148 * probability of the end-of-turn detection9149 */9150 probability?: number;9151}9152declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {9153 inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;9154 postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;9155}9156declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {9157 inputs: XOR<ResponsesInput, ChatCompletionsMessagesInput>;9158 postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;9159}9160declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {9161 inputs: XOR<ResponsesInput, ChatCompletionsMessagesInput>;9162 postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>;9163}9164interface Ai_Cf_Leonardo_Phoenix_1_0_Input {9165 /**9166 * A text description of the image you want to generate.9167 */9168 prompt: string;9169 /**9170 * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt9171 */9172 guidance?: number;9173 /**9174 * Random seed for reproducibility of the image generation9175 */9176 seed?: number;9177 /**9178 * The height of the generated image in pixels9179 */9180 height?: number;9181 /**9182 * The width of the generated image in pixels9183 */9184 width?: number;9185 /**9186 * The number of diffusion steps; higher values can improve quality but take longer9187 */9188 num_steps?: number;9189 /**9190 * Specify what to exclude from the generated images9191 */9192 negative_prompt?: string;9193}9194/**9195 * The generated image in JPEG format9196 */9197type Ai_Cf_Leonardo_Phoenix_1_0_Output = string;9198declare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {9199 inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;9200 postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;9201}9202interface Ai_Cf_Leonardo_Lucid_Origin_Input {9203 /**9204 * A text description of the image you want to generate.9205 */9206 prompt: string;9207 /**9208 * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt9209 */9210 guidance?: number;9211 /**9212 * Random seed for reproducibility of the image generation9213 */9214 seed?: number;9215 /**9216 * The height of the generated image in pixels9217 */9218 height?: number;9219 /**9220 * The width of the generated image in pixels9221 */9222 width?: number;9223 /**9224 * The number of diffusion steps; higher values can improve quality but take longer9225 */9226 num_steps?: number;9227 /**9228 * The number of diffusion steps; higher values can improve quality but take longer9229 */9230 steps?: number;9231}9232interface Ai_Cf_Leonardo_Lucid_Origin_Output {9233 /**9234 * The generated image in Base64 format.9235 */9236 image?: string;9237}9238declare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {9239 inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;9240 postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;9241}9242interface Ai_Cf_Deepgram_Aura_1_Input {9243 /**9244 * Speaker used to produce the audio.9245 */9246 speaker?: "angus" | "asteria" | "arcas" | "orion" | "orpheus" | "athena" | "luna" | "zeus" | "perseus" | "helios" | "hera" | "stella";9247 /**9248 * Encoding of the output audio.9249 */9250 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";9251 /**9252 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..9253 */9254 container?: "none" | "wav" | "ogg";9255 /**9256 * The text content to be converted to speech9257 */9258 text: string;9259 /**9260 * 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 configurable9261 */9262 sample_rate?: number;9263 /**9264 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.9265 */9266 bit_rate?: number;9267}9268/**9269 * The generated audio in MP3 format9270 */9271type Ai_Cf_Deepgram_Aura_1_Output = string;9272declare abstract class Base_Ai_Cf_Deepgram_Aura_1 {9273 inputs: Ai_Cf_Deepgram_Aura_1_Input;9274 postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;9275}9276interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {9277 /**9278 * Input text to translate. Can be a single string or a list of strings.9279 */9280 text: string | string[];9281 /**9282 * Target langauge to translate to9283 */9284 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";9285}9286interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {9287 /**9288 * Translated texts9289 */9290 translations: string[];9291}9292declare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B {9293 inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input;9294 postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output;9295}9296type 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;9297interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {9298 /**9299 * The input text prompt for the model to generate a response.9300 */9301 prompt: string;9302 /**9303 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.9304 */9305 lora?: string;9306 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode;9307 /**9308 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.9309 */9310 raw?: boolean;9311 /**9312 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.9313 */9314 stream?: boolean;9315 /**9316 * The maximum number of tokens to generate in the response.9317 */9318 max_tokens?: number;9319 /**9320 * Controls the randomness of the output; higher values produce more random results.9321 */9322 temperature?: number;9323 /**9324 * 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.9325 */9326 top_p?: number;9327 /**9328 * 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.9329 */9330 top_k?: number;9331 /**9332 * Random seed for reproducibility of the generation.9333 */9334 seed?: number;9335 /**9336 * Penalty for repeated tokens; higher values discourage repetition.9337 */9338 repetition_penalty?: number;9339 /**9340 * Decreases the likelihood of the model repeating the same lines verbatim.9341 */9342 frequency_penalty?: number;9343 /**9344 * Increases the likelihood of the model introducing new topics.9345 */9346 presence_penalty?: number;9347}9348interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {9349 type?: "json_object" | "json_schema";9350 json_schema?: unknown;9351}9352interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {9353 /**9354 * An array of message objects representing the conversation history.9355 */9356 messages: {9357 /**9358 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').9359 */9360 role: string;9361 content: string | {9362 /**9363 * Type of the content (text)9364 */9365 type?: string;9366 /**9367 * Text content9368 */9369 text?: string;9370 }[];9371 }[];9372 functions?: {9373 name: string;9374 code: string;9375 }[];9376 /**9377 * A list of tools available for the assistant to use.9378 */9379 tools?: ({9380 /**9381 * The name of the tool. More descriptive the better.9382 */9383 name: string;9384 /**9385 * A brief description of what the tool does.9386 */9387 description: string;9388 /**9389 * Schema defining the parameters accepted by the tool.9390 */9391 parameters: {9392 /**9393 * The type of the parameters object (usually 'object').9394 */9395 type: string;9396 /**9397 * List of required parameter names.9398 */9399 required?: string[];9400 /**9401 * Definitions of each parameter.9402 */9403 properties: {9404 [k: string]: {9405 /**9406 * The data type of the parameter.9407 */9408 type: string;9409 /**9410 * A description of the expected parameter.9411 */9412 description: string;9413 };9414 };9415 };9416 } | {9417 /**9418 * Specifies the type of tool (e.g., 'function').9419 */9420 type: string;9421 /**9422 * Details of the function tool.9423 */9424 function: {9425 /**9426 * The name of the function.9427 */9428 name: string;9429 /**9430 * A brief description of what the function does.9431 */9432 description: string;9433 /**9434 * Schema defining the parameters accepted by the function.9435 */9436 parameters: {9437 /**9438 * The type of the parameters object (usually 'object').9439 */9440 type: string;9441 /**9442 * List of required parameter names.9443 */9444 required?: string[];9445 /**9446 * Definitions of each parameter.9447 */9448 properties: {9449 [k: string]: {9450 /**9451 * The data type of the parameter.9452 */9453 type: string;9454 /**9455 * A description of the expected parameter.9456 */9457 description: string;9458 };9459 };9460 };9461 };9462 })[];9463 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1;9464 /**9465 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.9466 */9467 raw?: boolean;9468 /**9469 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.9470 */9471 stream?: boolean;9472 /**9473 * The maximum number of tokens to generate in the response.9474 */9475 max_tokens?: number;9476 /**9477 * Controls the randomness of the output; higher values produce more random results.9478 */9479 temperature?: number;9480 /**9481 * 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.9482 */9483 top_p?: number;9484 /**9485 * 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.9486 */9487 top_k?: number;9488 /**9489 * Random seed for reproducibility of the generation.9490 */9491 seed?: number;9492 /**9493 * Penalty for repeated tokens; higher values discourage repetition.9494 */9495 repetition_penalty?: number;9496 /**9497 * Decreases the likelihood of the model repeating the same lines verbatim.9498 */9499 frequency_penalty?: number;9500 /**9501 * Increases the likelihood of the model introducing new topics.9502 */9503 presence_penalty?: number;9504}9505interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {9506 type?: "json_object" | "json_schema";9507 json_schema?: unknown;9508}9509interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {9510 requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[];9511}9512interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {9513 /**9514 * The input text prompt for the model to generate a response.9515 */9516 prompt: string;9517 /**9518 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.9519 */9520 lora?: string;9521 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2;9522 /**9523 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.9524 */9525 raw?: boolean;9526 /**9527 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.9528 */9529 stream?: boolean;9530 /**9531 * The maximum number of tokens to generate in the response.9532 */9533 max_tokens?: number;9534 /**9535 * Controls the randomness of the output; higher values produce more random results.9536 */9537 temperature?: number;9538 /**9539 * 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.9540 */9541 top_p?: number;9542 /**9543 * 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.9544 */9545 top_k?: number;9546 /**9547 * Random seed for reproducibility of the generation.9548 */9549 seed?: number;9550 /**9551 * Penalty for repeated tokens; higher values discourage repetition.9552 */9553 repetition_penalty?: number;9554 /**9555 * Decreases the likelihood of the model repeating the same lines verbatim.9556 */9557 frequency_penalty?: number;9558 /**9559 * Increases the likelihood of the model introducing new topics.9560 */9561 presence_penalty?: number;9562}9563interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {9564 type?: "json_object" | "json_schema";9565 json_schema?: unknown;9566}9567interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {9568 /**9569 * An array of message objects representing the conversation history.9570 */9571 messages: {9572 /**9573 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').9574 */9575 role: string;9576 content: string | {9577 /**9578 * Type of the content (text)9579 */9580 type?: string;9581 /**9582 * Text content9583 */9584 text?: string;9585 }[];9586 }[];9587 functions?: {9588 name: string;9589 code: string;9590 }[];9591 /**9592 * A list of tools available for the assistant to use.9593 */9594 tools?: ({9595 /**9596 * The name of the tool. More descriptive the better.9597 */9598 name: string;9599 /**9600 * A brief description of what the tool does.9601 */9602 description: string;9603 /**9604 * Schema defining the parameters accepted by the tool.9605 */9606 parameters: {9607 /**9608 * The type of the parameters object (usually 'object').9609 */9610 type: string;9611 /**9612 * List of required parameter names.9613 */9614 required?: string[];9615 /**9616 * Definitions of each parameter.9617 */9618 properties: {9619 [k: string]: {9620 /**9621 * The data type of the parameter.9622 */9623 type: string;9624 /**9625 * A description of the expected parameter.9626 */9627 description: string;9628 };9629 };9630 };9631 } | {9632 /**9633 * Specifies the type of tool (e.g., 'function').9634 */9635 type: string;9636 /**9637 * Details of the function tool.9638 */9639 function: {9640 /**9641 * The name of the function.9642 */9643 name: string;9644 /**9645 * A brief description of what the function does.9646 */9647 description: string;9648 /**9649 * Schema defining the parameters accepted by the function.9650 */9651 parameters: {9652 /**9653 * The type of the parameters object (usually 'object').9654 */9655 type: string;9656 /**9657 * List of required parameter names.9658 */9659 required?: string[];9660 /**9661 * Definitions of each parameter.9662 */9663 properties: {9664 [k: string]: {9665 /**9666 * The data type of the parameter.9667 */9668 type: string;9669 /**9670 * A description of the expected parameter.9671 */9672 description: string;9673 };9674 };9675 };9676 };9677 })[];9678 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3;9679 /**9680 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.9681 */9682 raw?: boolean;9683 /**9684 * If true, the response will be streamed back incrementally using SSE, Server Sent Events.9685 */9686 stream?: boolean;9687 /**9688 * The maximum number of tokens to generate in the response.9689 */9690 max_tokens?: number;9691 /**9692 * Controls the randomness of the output; higher values produce more random results.9693 */9694 temperature?: number;9695 /**9696 * 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.9697 */9698 top_p?: number;9699 /**9700 * 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.9701 */9702 top_k?: number;9703 /**9704 * Random seed for reproducibility of the generation.9705 */9706 seed?: number;9707 /**9708 * Penalty for repeated tokens; higher values discourage repetition.9709 */9710 repetition_penalty?: number;9711 /**9712 * Decreases the likelihood of the model repeating the same lines verbatim.9713 */9714 frequency_penalty?: number;9715 /**9716 * Increases the likelihood of the model introducing new topics.9717 */9718 presence_penalty?: number;9719}9720interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {9721 type?: "json_object" | "json_schema";9722 json_schema?: unknown;9723}9724type 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;9725interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response {9726 /**9727 * Unique identifier for the completion9728 */9729 id?: string;9730 /**9731 * Object type identifier9732 */9733 object?: "chat.completion";9734 /**9735 * Unix timestamp of when the completion was created9736 */9737 created?: number;9738 /**9739 * Model used for the completion9740 */9741 model?: string;9742 /**9743 * List of completion choices9744 */9745 choices?: {9746 /**9747 * Index of the choice in the list9748 */9749 index?: number;9750 /**9751 * The message generated by the model9752 */9753 message?: {9754 /**9755 * Role of the message author9756 */9757 role: string;9758 /**9759 * The content of the message9760 */9761 content: string;9762 /**9763 * Internal reasoning content (if available)9764 */9765 reasoning_content?: string;9766 /**9767 * Tool calls made by the assistant9768 */9769 tool_calls?: {9770 /**9771 * Unique identifier for the tool call9772 */9773 id: string;9774 /**9775 * Type of tool call9776 */9777 type: "function";9778 function: {9779 /**9780 * Name of the function to call9781 */9782 name: string;9783 /**9784 * JSON string of arguments for the function9785 */9786 arguments: string;9787 };9788 }[];9789 };9790 /**9791 * Reason why the model stopped generating9792 */9793 finish_reason?: string;9794 /**9795 * Stop reason (may be null)9796 */9797 stop_reason?: string | null;9798 /**9799 * Log probabilities (if requested)9800 */9801 logprobs?: {} | null;9802 }[];9803 /**9804 * Usage statistics for the inference request9805 */9806 usage?: {9807 /**9808 * Total number of tokens in input9809 */9810 prompt_tokens?: number;9811 /**9812 * Total number of tokens in output9813 */9814 completion_tokens?: number;9815 /**9816 * Total number of input and output tokens9817 */9818 total_tokens?: number;9819 };9820 /**9821 * Log probabilities for the prompt (if requested)9822 */9823 prompt_logprobs?: {} | null;9824}9825interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response {9826 /**9827 * Unique identifier for the completion9828 */9829 id?: string;9830 /**9831 * Object type identifier9832 */9833 object?: "text_completion";9834 /**9835 * Unix timestamp of when the completion was created9836 */9837 created?: number;9838 /**9839 * Model used for the completion9840 */9841 model?: string;9842 /**9843 * List of completion choices9844 */9845 choices?: {9846 /**9847 * Index of the choice in the list9848 */9849 index: number;9850 /**9851 * The generated text completion9852 */9853 text: string;9854 /**9855 * Reason why the model stopped generating9856 */9857 finish_reason: string;9858 /**9859 * Stop reason (may be null)9860 */9861 stop_reason?: string | null;9862 /**9863 * Log probabilities (if requested)9864 */9865 logprobs?: {} | null;9866 /**9867 * Log probabilities for the prompt (if requested)9868 */9869 prompt_logprobs?: {} | null;9870 }[];9871 /**9872 * Usage statistics for the inference request9873 */9874 usage?: {9875 /**9876 * Total number of tokens in input9877 */9878 prompt_tokens?: number;9879 /**9880 * Total number of tokens in output9881 */9882 completion_tokens?: number;9883 /**9884 * Total number of input and output tokens9885 */9886 total_tokens?: number;9887 };9888}9889interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {9890 /**9891 * The async request id that can be used to obtain the results.9892 */9893 request_id?: string;9894}9895declare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It {9896 inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input;9897 postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output;9898}9899interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {9900 /**9901 * Input text to embed. Can be a single string or a list of strings.9902 */9903 text: string | string[];9904}9905interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {9906 /**9907 * Embedding vectors, where each vector is a list of floats.9908 */9909 data: number[][];9910 /**9911 * Shape of the embedding data as [number_of_embeddings, embedding_dimension].9912 *9913 * @minItems 29914 * @maxItems 29915 */9916 shape: [9917 number,9918 number9919 ];9920}9921declare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B {9922 inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input;9923 postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output;9924}9925interface Ai_Cf_Deepgram_Flux_Input {9926 /**9927 * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM.9928 */9929 encoding: "linear16";9930 /**9931 * Sample rate of the audio stream in Hz.9932 */9933 sample_rate: string;9934 /**9935 * 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.9936 */9937 eager_eot_threshold?: string;9938 /**9939 * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.9940 */9941 eot_threshold?: string;9942 /**9943 * A turn will be finished when this much time has passed after speech, regardless of EOT confidence.9944 */9945 eot_timeout_ms?: string;9946 /**9947 * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.9948 */9949 keyterm?: string;9950 /**9951 * 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-mip9952 */9953 mip_opt_out?: "true" | "false";9954 /**9955 * Label your requests for the purpose of identification during usage reporting9956 */9957 tag?: string;9958}9959/**9960 * Output will be returned as websocket messages.9961 */9962interface Ai_Cf_Deepgram_Flux_Output {9963 /**9964 * The unique identifier of the request (uuid)9965 */9966 request_id?: string;9967 /**9968 * Starts at 0 and increments for each message the server sends to the client.9969 */9970 sequence_id?: number;9971 /**9972 * The type of event being reported.9973 */9974 event?: "Update" | "StartOfTurn" | "EagerEndOfTurn" | "TurnResumed" | "EndOfTurn";9975 /**9976 * The index of the current turn9977 */9978 turn_index?: number;9979 /**9980 * Start time in seconds of the audio range that was transcribed9981 */9982 audio_window_start?: number;9983 /**9984 * End time in seconds of the audio range that was transcribed9985 */9986 audio_window_end?: number;9987 /**9988 * Text that was said over the course of the current turn9989 */9990 transcript?: string;9991 /**9992 * The words in the transcript9993 */9994 words?: {9995 /**9996 * The individual punctuated, properly-cased word from the transcript9997 */9998 word: string;9999 /**10000 * Confidence that this word was transcribed correctly10001 */10002 confidence: number;10003 }[];10004 /**10005 * Confidence that no more speech is coming in this turn10006 */10007 end_of_turn_confidence?: number;10008}10009declare abstract class Base_Ai_Cf_Deepgram_Flux {10010 inputs: Ai_Cf_Deepgram_Flux_Input;10011 postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output;10012}10013interface Ai_Cf_Deepgram_Aura_2_En_Input {10014 /**10015 * Speaker used to produce the audio.10016 */10017 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";10018 /**10019 * Encoding of the output audio.10020 */10021 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";10022 /**10023 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..10024 */10025 container?: "none" | "wav" | "ogg";10026 /**10027 * The text content to be converted to speech10028 */10029 text: string;10030 /**10031 * 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 configurable10032 */10033 sample_rate?: number;10034 /**10035 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.10036 */10037 bit_rate?: number;10038}10039/**10040 * The generated audio in MP3 format10041 */10042type Ai_Cf_Deepgram_Aura_2_En_Output = string;10043declare abstract class Base_Ai_Cf_Deepgram_Aura_2_En {10044 inputs: Ai_Cf_Deepgram_Aura_2_En_Input;10045 postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output;10046}10047interface Ai_Cf_Deepgram_Aura_2_Es_Input {10048 /**10049 * Speaker used to produce the audio.10050 */10051 speaker?: "sirio" | "nestor" | "carina" | "celeste" | "alvaro" | "diana" | "aquila" | "selena" | "estrella" | "javier";10052 /**10053 * Encoding of the output audio.10054 */10055 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";10056 /**10057 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..10058 */10059 container?: "none" | "wav" | "ogg";10060 /**10061 * The text content to be converted to speech10062 */10063 text: string;10064 /**10065 * 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 configurable10066 */10067 sample_rate?: number;10068 /**10069 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.10070 */10071 bit_rate?: number;10072}10073/**10074 * The generated audio in MP3 format10075 */10076type Ai_Cf_Deepgram_Aura_2_Es_Output = string;10077declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {10078 inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;10079 postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;10080}10081interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input {10082 multipart: {10083 body?: object;10084 contentType?: string;10085 };10086}10087interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output {10088 /**10089 * Generated image as Base64 string.10090 */10091 image?: string;10092}10093declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev {10094 inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input;10095 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output;10096}10097interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input {10098 multipart: {10099 body?: object;10100 contentType?: string;10101 };10102}10103interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output {10104 /**10105 * Generated image as Base64 string.10106 */10107 image?: string;10108}10109declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B {10110 inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input;10111 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output;10112}10113interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input {10114 multipart: {10115 body?: object;10116 contentType?: string;10117 };10118}10119interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output {10120 /**10121 * Generated image as Base64 string.10122 */10123 image?: string;10124}10125declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B {10126 inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input;10127 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output;10128}10129declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash {10130 inputs: ChatCompletionsInput;10131 postProcessedOutputs: ChatCompletionsOutput;10132}10133declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 {10134 inputs: ChatCompletionsInput;10135 postProcessedOutputs: ChatCompletionsOutput;10136}10137declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_6 {10138 inputs: ChatCompletionsInput;10139 postProcessedOutputs: ChatCompletionsOutput;10140}10141declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B {10142 inputs: ChatCompletionsInput;10143 postProcessedOutputs: ChatCompletionsOutput;10144}10145declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT {10146 inputs: ChatCompletionsInput;10147 postProcessedOutputs: ChatCompletionsOutput;10148}10149interface AiModels {10150 "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;10151 "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;10152 "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;10153 "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage;10154 "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;10155 "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;10156 "@cf/myshell-ai/melotts": BaseAiTextToSpeech;10157 "@cf/google/embeddinggemma-300m": BaseAiTextEmbeddings;10158 "@cf/microsoft/resnet-50": BaseAiImageClassification;10159 "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;10160 "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;10161 "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;10162 "@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;10163 "@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;10164 "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;10165 "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;10166 "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;10167 "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;10168 "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;10169 "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;10170 "@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;10171 "@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;10172 "@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;10173 "@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;10174 "@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;10175 "@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;10176 "@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;10177 "@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;10178 "@cf/microsoft/phi-2": BaseAiTextGeneration;10179 "@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;10180 "@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;10181 "@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;10182 "@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;10183 "@hf/google/gemma-7b-it": BaseAiTextGeneration;10184 "@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;10185 "@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;10186 "@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;10187 "@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;10188 "@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;10189 "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;10190 "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;10191 "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;10192 "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;10193 "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;10194 "@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;10195 "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b": BaseAiTextGeneration;10196 "@cf/ibm-granite/granite-4.0-h-micro": BaseAiTextGeneration;10197 "@cf/facebook/bart-large-cnn": BaseAiSummarization;10198 "@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;10199 "@cf/baai/bge-base-en-v1.5": Base_Ai_Cf_Baai_Bge_Base_En_V1_5;10200 "@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;10201 "@cf/meta/m2m100-1.2b": Base_Ai_Cf_Meta_M2M100_1_2B;10202 "@cf/baai/bge-small-en-v1.5": Base_Ai_Cf_Baai_Bge_Small_En_V1_5;10203 "@cf/baai/bge-large-en-v1.5": Base_Ai_Cf_Baai_Bge_Large_En_V1_5;10204 "@cf/unum/uform-gen2-qwen-500m": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M;10205 "@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;10206 "@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;10207 "@cf/baai/bge-m3": Base_Ai_Cf_Baai_Bge_M3;10208 "@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;10209 "@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;10210 "@cf/meta/llama-3.3-70b-instruct-fp8-fast": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast;10211 "@cf/meta/llama-guard-3-8b": Base_Ai_Cf_Meta_Llama_Guard_3_8B;10212 "@cf/baai/bge-reranker-base": Base_Ai_Cf_Baai_Bge_Reranker_Base;10213 "@cf/qwen/qwen2.5-coder-32b-instruct": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct;10214 "@cf/qwen/qwq-32b": Base_Ai_Cf_Qwen_Qwq_32B;10215 "@cf/mistralai/mistral-small-3.1-24b-instruct": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;10216 "@cf/google/gemma-3-12b-it": Base_Ai_Cf_Google_Gemma_3_12B_It;10217 "@cf/meta/llama-4-scout-17b-16e-instruct": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;10218 "@cf/qwen/qwen3-30b-a3b-fp8": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8;10219 "@cf/deepgram/nova-3": Base_Ai_Cf_Deepgram_Nova_3;10220 "@cf/qwen/qwen3-embedding-0.6b": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B;10221 "@cf/pipecat-ai/smart-turn-v2": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;10222 "@cf/openai/gpt-oss-120b": Base_Ai_Cf_Openai_Gpt_Oss_120B;10223 "@cf/openai/gpt-oss-20b": Base_Ai_Cf_Openai_Gpt_Oss_20B;10224 "@cf/leonardo/phoenix-1.0": Base_Ai_Cf_Leonardo_Phoenix_1_0;10225 "@cf/leonardo/lucid-origin": Base_Ai_Cf_Leonardo_Lucid_Origin;10226 "@cf/deepgram/aura-1": Base_Ai_Cf_Deepgram_Aura_1;10227 "@cf/ai4bharat/indictrans2-en-indic-1B": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B;10228 "@cf/aisingapore/gemma-sea-lion-v4-27b-it": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It;10229 "@cf/pfnet/plamo-embedding-1b": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B;10230 "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;10231 "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;10232 "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;10233 "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev;10234 "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B;10235 "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B;10236 "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash;10237 "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5;10238 "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6;10239 "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B;10240 "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT;10241}10242type AiOptions = {10243 /**10244 * Send requests as an asynchronous batch job, only works for supported models10245 * https://developers.cloudflare.com/workers-ai/features/batch-api10246 */10247 queueRequest?: boolean;10248 /**10249 * Establish websocket connections, only works for supported models10250 */10251 websocket?: boolean;10252 /**10253 * Tag your requests to group and view them in Cloudflare dashboard.10254 *10255 * Rules:10256 * Tags must only contain letters, numbers, and the symbols: : - . / @10257 * Each tag can have maximum 50 characters.10258 * Maximum 5 tags are allowed each request.10259 * Duplicate tags will removed.10260 */10261 tags?: string[];10262 gateway?: GatewayOptions;10263 returnRawResponse?: boolean;10264 prefix?: string;10265 extraHeaders?: object;10266 signal?: AbortSignal;10267};10268type AiModelsSearchParams = {10269 author?: string;10270 hide_experimental?: boolean;10271 page?: number;10272 per_page?: number;10273 search?: string;10274 source?: number;10275 task?: string;10276};10277type AiModelsSearchObject = {10278 id: string;10279 source: number;10280 name: string;10281 description: string;10282 task: {10283 id: string;10284 name: string;10285 description: string;10286 };10287 tags: string[];10288 properties: {10289 property_id: string;10290 value: string;10291 }[];10292};10293type ChatCompletionsBase = ChatCompletionsMessagesInput;10294type ChatCompletionsInput = ChatCompletionsMessagesInput;10295interface InferenceUpstreamError extends Error {10296}10297interface AiInternalError extends Error {10298}10299type AiModelListType = Record<string, any>;10300type AiAsyncBatchResponse = {10301 request_id: string;10302};10303declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {10304 aiGatewayLogId: string | null;10305 gateway(gatewayId: string): AiGateway;10306 /**10307 * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.10308 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10309 */10310 aiSearch(): AiSearchNamespace;10311 /**10312 * @deprecated AutoRAG has been replaced by AI Search.10313 * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.10314 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10315 *10316 * @param autoragId Instance ID10317 */10318 autorag(autoragId: string): AutoRAG;10319 // Batch request10320 run<Name extends keyof AiModelList>(model: Name, inputs: {10321 requests: AiModelList[Name]['inputs'][];10322 }, options: AiOptions & {10323 queueRequest: true;10324 }): Promise<AiAsyncBatchResponse>;10325 // Raw response10326 run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options: AiOptions & {10327 returnRawResponse: true;10328 }): Promise<Response>;10329 // WebSocket10330 run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options: AiOptions & {10331 websocket: true;10332 }): Promise<Response>;10333 // Streaming10334 run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'] & {10335 stream: true;10336 }, options?: AiOptions): Promise<ReadableStream>;10337 // Normal (default) - known model10338 run<Name extends keyof AiModelList>(model: Name, inputs: AiModelList[Name]['inputs'], options?: AiOptions): Promise<AiModelList[Name]['postProcessedOutputs']>;10339 // Unknown model (fallback).10340 //10341 // The `Exclude<..., keyof AiModelList>` constraint forces TypeScript to10342 // route any model name that is a literal key of `AiModelList` to one of10343 // the known-model overloads above (so input/output mismatches surface as10344 // type errors rather than silently falling back to `Record<string, unknown>`).10345 // Names that aren't in `AiModelList` — e.g. third-party gateway models10346 // like `"google/nano-banana"` — still hit this overload.10347 run<Model extends string>(model: Model extends keyof AiModelList ? never : Model, inputs: Record<string, unknown>, options?: AiOptions): Promise<Record<string, unknown>>;10348 models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;10349 toMarkdown(): ToMarkdownService;10350 toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;10351 toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;10352}10353type GatewayRetries = {10354 maxAttempts?: 1 | 2 | 3 | 4 | 5;10355 retryDelayMs?: number;10356 backoff?: 'constant' | 'linear' | 'exponential';10357};10358type GatewayOptions = {10359 id: string;10360 cacheKey?: string;10361 cacheTtl?: number;10362 skipCache?: boolean;10363 metadata?: Record<string, number | string | boolean | null | bigint>;10364 collectLog?: boolean;10365 eventId?: string;10366 requestTimeoutMs?: number;10367 retries?: GatewayRetries;10368};10369type UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {10370 /**10371 ** @deprecated10372 */10373 id?: string;10374};10375type AiGatewayPatchLog = {10376 score?: number | null;10377 feedback?: -1 | 1 | null;10378 metadata?: Record<string, number | string | boolean | null | bigint> | null;10379};10380type AiGatewayLog = {10381 id: string;10382 provider: string;10383 model: string;10384 model_type?: string;10385 path: string;10386 duration: number;10387 request_type?: string;10388 request_content_type?: string;10389 status_code: number;10390 response_content_type?: string;10391 success: boolean;10392 cached: boolean;10393 tokens_in?: number;10394 tokens_out?: number;10395 metadata?: Record<string, number | string | boolean | null | bigint>;10396 step?: number;10397 cost?: number;10398 custom_cost?: boolean;10399 request_size: number;10400 request_head?: string;10401 request_head_complete: boolean;10402 response_size: number;10403 response_head?: string;10404 response_head_complete: boolean;10405 created_at: Date;10406};10407type 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';10408type AIGatewayHeaders = {10409 'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string;10410 'cf-aig-custom-cost': {10411 per_token_in?: number;10412 per_token_out?: number;10413 } | {10414 total_cost?: number;10415 } | string;10416 'cf-aig-cache-ttl': number | string;10417 'cf-aig-skip-cache': boolean | string;10418 'cf-aig-cache-key': string;10419 'cf-aig-event-id': string;10420 'cf-aig-request-timeout': number | string;10421 'cf-aig-max-attempts': number | string;10422 'cf-aig-retry-delay': number | string;10423 'cf-aig-backoff': string;10424 'cf-aig-collect-log': boolean | string;10425 Authorization: string;10426 'Content-Type': string;10427 [key: string]: string | number | boolean | object;10428};10429type AIGatewayUniversalRequest = {10430 provider: AIGatewayProviders | string; // eslint-disable-line10431 endpoint: string;10432 headers: Partial<AIGatewayHeaders>;10433 query: unknown;10434};10435interface AiGatewayInternalError extends Error {10436}10437interface AiGatewayLogNotFound extends Error {10438}10439declare abstract class AiGateway {10440 patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;10441 getLog(logId: string): Promise<AiGatewayLog>;10442 run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: {10443 gateway?: UniversalGatewayOptions;10444 extraHeaders?: object;10445 signal?: AbortSignal;10446 }): Promise<Response>;10447 getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line10448}10449// Copyright (c) 2022-2025 Cloudflare, Inc.10450// Licensed under the Apache 2.0 license found in the LICENSE file or at:10451// https://opensource.org/licenses/Apache-2.010452/**10453 * Artifacts — Git-compatible file storage on Cloudflare Workers.10454 *10455 * Provides programmatic access to create, manage, and fork repositories,10456 * and to issue and revoke scoped access tokens.10457 */10458/** Information about a repository. */10459interface ArtifactsRepoInfo {10460 /** Unique repository ID. */10461 id: string;10462 /** Repository name. */10463 name: string;10464 /** Repository description, or null if not set. */10465 description: string | null;10466 /** Default branch name (e.g. "main"). */10467 defaultBranch: string;10468 /** ISO 8601 creation timestamp. */10469 createdAt: string;10470 /** ISO 8601 last-updated timestamp. */10471 updatedAt: string;10472 /** ISO 8601 timestamp of the last push, or null if never pushed. */10473 lastPushAt: string | null;10474 /** Fork source (e.g. "github:owner/repo", "artifacts:namespace/repo"), or null if not a fork. */10475 source: string | null;10476 /** Whether the repository is read-only. */10477 readOnly: boolean;10478 /** HTTPS git remote URL. */10479 remote: string;10480}10481/** Result of creating a repository — includes the initial access token. */10482interface ArtifactsCreateRepoResult {10483 /** Unique repository ID. */10484 id: string;10485 /** Repository name. */10486 name: string;10487 /** Repository description, or null if not set. */10488 description: string | null;10489 /** Default branch name. */10490 defaultBranch: string;10491 /** HTTPS git remote URL. */10492 remote: string;10493 /** Plaintext access token (only returned at creation time). */10494 token: string;10495 /** ISO 8601 token expiry timestamp. */10496 tokenExpiresAt: string;10497}10498/** Paginated list of repositories. */10499interface ArtifactsRepoListResult {10500 /** Repositories in this page (without the `remote` field). */10501 repos: Omit<ArtifactsRepoInfo, 'remote'>[];10502 /** Total number of repositories in the namespace. */10503 total: number;10504 /** Cursor for the next page, if there are more results. */10505 cursor?: string;10506}10507/** Result of creating an access token. */10508interface ArtifactsCreateTokenResult {10509 /** Unique token ID. */10510 id: string;10511 /** Plaintext token (only returned at creation time). */10512 plaintext: string;10513 /** Token scope: "read" or "write". */10514 scope: 'read' | 'write';10515 /** ISO 8601 token expiry timestamp. */10516 expiresAt: string;10517}10518/** Token metadata (no plaintext). */10519interface ArtifactsTokenInfo {10520 /** Unique token ID. */10521 id: string;10522 /** Token scope: "read" or "write". */10523 scope: 'read' | 'write';10524 /** Token state: "active", "expired", or "revoked". */10525 state: 'active' | 'expired' | 'revoked';10526 /** ISO 8601 creation timestamp. */10527 createdAt: string;10528 /** ISO 8601 expiry timestamp. */10529 expiresAt: string;10530}10531/** Paginated list of tokens for a repository. */10532interface ArtifactsTokenListResult {10533 /** Tokens in this page. */10534 tokens: ArtifactsTokenInfo[];10535 /** Total number of tokens for the repository. */10536 total: number;10537}10538/**10539 * Handle for a single repository. Returned by Artifacts.get().10540 *10541 * Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs.10542 */10543interface ArtifactsRepo extends ArtifactsRepoInfo {10544 /**10545 * Create an access token for this repo.10546 * @param scope Token scope: "write" (default) or "read".10547 * @param ttl Time-to-live in seconds (default 86400, min 60, max 31536000).10548 * @throws {ArtifactsError} with code `INVALID_TTL` if ttl is out of range.10549 */10550 createToken(scope?: 'write' | 'read', ttl?: number): Promise<ArtifactsCreateTokenResult>;10551 /** List tokens for this repo (metadata only, no plaintext). */10552 listTokens(): Promise<ArtifactsTokenListResult>;10553 /**10554 * Revoke a token by plaintext or ID.10555 * @param tokenOrId Plaintext token or token ID.10556 * @returns true if revoked, false if not found.10557 * @throws {ArtifactsError} with code `INVALID_INPUT` if tokenOrId is empty.10558 */10559 revokeToken(tokenOrId: string): Promise<boolean>;10560 // ── Fork ──10561 /**10562 * Fork this repo to a new repo.10563 * @param name Target repository name.10564 * @param opts Optional: description, readOnly flag, defaultBranchOnly (default true).10565 * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.10566 * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists.10567 * @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if a fork is already running.10568 */10569 fork(name: string, opts?: {10570 description?: string;10571 readOnly?: boolean;10572 defaultBranchOnly?: boolean;10573 }): Promise<ArtifactsCreateRepoResult>;10574}10575// ── Error types ──────────────────────────────────────────────────────────────10576/**10577 * Error codes returned by Artifacts binding operations.10578 *10579 * Each code maps to a numeric code available on `ArtifactsError.numericCode`.10580 */10581type 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';10582/**10583 * Error thrown by Artifacts binding operations.10584 *10585 * Uses a string `.code` discriminator following the Cloudflare platform10586 * convention (StreamError, ImagesError, etc.). The `.numericCode` matches10587 * the REST API `errors[].code` values.10588 */10589interface ArtifactsError extends Error {10590 readonly name: 'ArtifactsError';10591 /** String error code for programmatic matching. */10592 readonly code: ArtifactsErrorCode;10593 /** Numeric error code matching the REST API. */10594 readonly numericCode: number;10595}10596// ── Binding ──────────────────────────────────────────────────────────────────10597/**10598 * Artifacts binding — namespace-level operations.10599 *10600 * Methods may throw `ArtifactsError` with code `INTERNAL_ERROR` if an unexpected service error occurs.10601 */10602interface Artifacts {10603 /**10604 * Create a new repository with an initial access token.10605 * @param name Repository name (alphanumeric, dots, hyphens, underscores).10606 * @param opts Optional: readOnly flag, description, default branch name.10607 * @returns Repo metadata with initial token.10608 * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.10609 * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the repo already exists.10610 */10611 create(name: string, opts?: {10612 readOnly?: boolean;10613 description?: string;10614 setDefaultBranch?: string;10615 }): Promise<ArtifactsCreateRepoResult>;10616 /**10617 * Get a handle to an existing repository.10618 * @param name Repository name.10619 * @returns Repo handle.10620 * @throws {ArtifactsError} with code `NOT_FOUND` if the repo does not exist.10621 * @throws {ArtifactsError} with code `IMPORT_IN_PROGRESS` if the repo is still importing.10622 * @throws {ArtifactsError} with code `FORK_IN_PROGRESS` if the repo is still forking.10623 */10624 get(name: string): Promise<ArtifactsRepo>;10625 /**10626 * Import a repository from an external git remote.10627 * @param params Source URL and optional branch/depth, plus target name and options.10628 * @returns Repo metadata with initial token.10629 * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if the target name is invalid.10630 * @throws {ArtifactsError} with code `INVALID_INPUT` if the source URL is not valid HTTPS.10631 * @throws {ArtifactsError} with code `INVALID_URL` if the source URL does not point to a git repository.10632 * @throws {ArtifactsError} with code `REMOTE_AUTH_REQUIRED` if the remote requires authentication.10633 * @throws {ArtifactsError} with code `NOT_FOUND` if the remote repository does not exist.10634 * @throws {ArtifactsError} with code `UPSTREAM_UNAVAILABLE` if the remote cannot be reached.10635 * @throws {ArtifactsError} with code `MEMORY_LIMIT` if the import exceeds service memory limits.10636 * @throws {ArtifactsError} with code `ALREADY_EXISTS` if the target repo already exists.10637 */10638 import(params: {10639 source: {10640 url: string;10641 branch?: string;10642 depth?: number;10643 };10644 target: {10645 name: string;10646 opts?: {10647 description?: string;10648 readOnly?: boolean;10649 };10650 };10651 }): Promise<ArtifactsCreateRepoResult>;10652 /**10653 * List repositories with cursor-based pagination.10654 * @param opts Optional: limit (1–200, default 50), cursor for next page.10655 */10656 list(opts?: {10657 limit?: number;10658 cursor?: string;10659 }): Promise<ArtifactsRepoListResult>;10660 /**10661 * Delete a repository and all associated tokens.10662 * @param name Repository name.10663 * @returns true if deleted, false if not found.10664 * @throws {ArtifactsError} with code `INVALID_REPO_NAME` if name is invalid.10665 */10666 delete(name: string): Promise<boolean>;10667}10668/**10669 * @deprecated Use the standalone AI Search Workers binding instead.10670 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10671 */10672interface AutoRAGInternalError extends Error {10673}10674/**10675 * @deprecated Use the standalone AI Search Workers binding instead.10676 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10677 */10678interface AutoRAGNotFoundError extends Error {10679}10680/**10681 * @deprecated Use the standalone AI Search Workers binding instead.10682 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10683 */10684interface AutoRAGUnauthorizedError extends Error {10685}10686/**10687 * @deprecated Use the standalone AI Search Workers binding instead.10688 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10689 */10690interface AutoRAGNameNotSetError extends Error {10691}10692type ComparisonFilter = {10693 key: string;10694 type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';10695 value: string | number | boolean;10696};10697type CompoundFilter = {10698 type: 'and' | 'or';10699 filters: ComparisonFilter[];10700};10701/**10702 * @deprecated Use the standalone AI Search Workers binding instead.10703 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10704 */10705type AutoRagSearchRequest = {10706 query: string;10707 filters?: CompoundFilter | ComparisonFilter;10708 max_num_results?: number;10709 ranking_options?: {10710 ranker?: string;10711 score_threshold?: number;10712 };10713 reranking?: {10714 enabled?: boolean;10715 model?: string;10716 };10717 rewrite_query?: boolean;10718};10719/**10720 * @deprecated Use the standalone AI Search Workers binding instead.10721 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10722 */10723type AutoRagAiSearchRequest = AutoRagSearchRequest & {10724 stream?: boolean;10725 system_prompt?: string;10726};10727/**10728 * @deprecated Use the standalone AI Search Workers binding instead.10729 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10730 */10731type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {10732 stream: true;10733};10734/**10735 * @deprecated Use the standalone AI Search Workers binding instead.10736 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10737 */10738type AutoRagSearchResponse = {10739 object: 'vector_store.search_results.page';10740 search_query: string;10741 data: {10742 file_id: string;10743 filename: string;10744 score: number;10745 attributes: Record<string, string | number | boolean | null>;10746 content: {10747 type: 'text';10748 text: string;10749 }[];10750 }[];10751 has_more: boolean;10752 next_page: string | null;10753};10754/**10755 * @deprecated Use the standalone AI Search Workers binding instead.10756 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10757 */10758type AutoRagListResponse = {10759 id: string;10760 enable: boolean;10761 type: string;10762 source: string;10763 vectorize_name: string;10764 paused: boolean;10765 status: string;10766}[];10767/**10768 * @deprecated Use the standalone AI Search Workers binding instead.10769 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10770 */10771type AutoRagAiSearchResponse = AutoRagSearchResponse & {10772 response: string;10773};10774/**10775 * @deprecated Use the standalone AI Search Workers binding instead.10776 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10777 */10778declare abstract class AutoRAG {10779 /**10780 * @deprecated Use the standalone AI Search Workers binding instead.10781 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10782 */10783 list(): Promise<AutoRagListResponse>;10784 /**10785 * @deprecated Use the standalone AI Search Workers binding instead.10786 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10787 */10788 search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;10789 /**10790 * @deprecated Use the standalone AI Search Workers binding instead.10791 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10792 */10793 aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;10794 /**10795 * @deprecated Use the standalone AI Search Workers binding instead.10796 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10797 */10798 aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;10799 /**10800 * @deprecated Use the standalone AI Search Workers binding instead.10801 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/10802 */10803 aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;10804}10805type BrowserRunLifecycleEvent = 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';10806type BrowserRunResourceType = 'document' | 'stylesheet' | 'image' | 'media' | 'font' | 'script' | 'texttrack' | 'xhr' | 'fetch' | 'prefetch' | 'eventsource' | 'websocket' | 'manifest' | 'signedexchange' | 'ping' | 'cspviolationreport' | 'preflight' | 'other';10807/** Options fields shared by all quick actions. */10808interface BrowserRunBaseOptions {10809 /** Adds `<script>` tags into the page with the desired URL or content.10810 * @see https://pptr.dev/api/puppeteer.frameaddscripttagoptions10811 */10812 addScriptTag?: Array<{10813 content?: string;10814 url?: string;10815 type?: string;10816 id?: string;10817 }>;10818 /** Adds `<link rel="stylesheet">` or `<style>` tags into the page.10819 * @see https://pptr.dev/api/puppeteer.frameaddstyletagoptions10820 */10821 addStyleTag?: Array<{10822 content?: string;10823 url?: string;10824 }>;10825 /** Provide credentials for HTTP authentication. @see https://pptr.dev/api/puppeteer.credentials */10826 authenticate?: {10827 username: string;10828 password: string;10829 };10830 /** Set cookies before navigating. @see https://pptr.dev/api/puppeteer.cookieparam */10831 cookies?: Array<{10832 name: string;10833 value: string;10834 url?: string;10835 domain?: string;10836 path?: string;10837 secure?: boolean;10838 httpOnly?: boolean;10839 sameSite?: 'Strict' | 'Lax' | 'None';10840 expires?: number;10841 priority?: 'Low' | 'Medium' | 'High';10842 sameParty?: boolean;10843 sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';10844 sourcePort?: number;10845 partitionKey?: string;10846 }>;10847 /** Emulate a specific CSS media type (e.g. `"screen"`, `"print"`). */10848 emulateMediaType?: string;10849 /** Navigation options. @see https://pptr.dev/api/puppeteer.gotooptions */10850 gotoOptions?: {10851 /** Navigation timeout in milliseconds (max 60 000). @default 30000 */10852 timeout?: number;10853 /** When to consider navigation complete. @default "domcontentloaded" */10854 waitUntil?: BrowserRunLifecycleEvent | BrowserRunLifecycleEvent[];10855 referer?: string;10856 referrerPolicy?: string;10857 };10858 /** Block requests matching these regex patterns. Mutually exclusive with `allowRequestPattern`. */10859 rejectRequestPattern?: string[];10860 /** Only allow requests matching these regex patterns. Mutually exclusive with `rejectRequestPattern`. */10861 allowRequestPattern?: string[];10862 /** Block requests of these resource types. Mutually exclusive with `allowResourceTypes`. */10863 rejectResourceTypes?: BrowserRunResourceType[];10864 /** Only allow requests of these resource types. Mutually exclusive with `rejectResourceTypes`. */10865 allowResourceTypes?: BrowserRunResourceType[];10866 /** Additional HTTP headers sent with every request. */10867 setExtraHTTPHeaders?: Record<string, string>;10868 /** Whether JavaScript is enabled on the page. */10869 setJavaScriptEnabled?: boolean;10870 /** Override the default user agent string.10871 * @default "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"10872 * */10873 userAgent?: string;10874 /** Set the browser viewport size.10875 * @see https://pptr.dev/api/puppeteer.viewport10876 * @default {width:1920,height:1080}10877 * */10878 viewport?: {10879 width: number;10880 height: number;10881 deviceScaleFactor?: number;10882 isMobile?: boolean;10883 isLandscape?: boolean;10884 hasTouch?: boolean;10885 };10886 /** Wait for a CSS selector to appear in the page before proceeding.10887 * @see https://pptr.dev/api/puppeteer.waitforselectoroptions10888 */10889 waitForSelector?: {10890 selector: string;10891 hidden?: true;10892 visible?: true;10893 /** Timeout in milliseconds. Max 120000 */10894 timeout?: number;10895 };10896 /** Wait for a fixed delay in milliseconds before proceeding. Max 120000 */10897 waitForTimeout?: number;10898 /** When true, continue on best-effort when awaited events fail or timeout. */10899 bestAttempt?: boolean;10900 /** Maximum duration in milliseconds for the browser action after page load. Max 120000 */10901 actionTimeout?: number;10902 /** Cache time to live in seconds (0-86400). Set to 0 to disable.10903 * @default 510904 */10905 cacheTTL?: number;10906}10907/** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/10908type BrowserRunCommonOptions = (BrowserRunBaseOptions & {10909 /** URL to navigate to, e.g. `"https://example.com"`. */10910 url: string;10911}) | (BrowserRunBaseOptions & {10912 /** Set the HTML content of the page directly. */10913 html: string;10914});10915type BrowserRunPuppeteerScreenshotOptions = {10916 /** @default "png" */10917 type?: 'png' | 'jpeg' | 'webp';10918 /** @default "binary" */10919 encoding?: 'binary' | 'base64';10920 quality?: number;10921 fullPage?: boolean;10922 clip?: {10923 x: number;10924 y: number;10925 width: number;10926 height: number;10927 scale?: number;10928 };10929 omitBackground?: boolean;10930 optimizeForSpeed?: boolean;10931 captureBeyondViewport?: boolean;10932 fromSurface?: boolean;10933};10934type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {10935 /** CSS selector of the element to screenshot. */10936 selector?: string;10937 /** When true, scroll the entire page before taking the screenshot. */10938 scrollPage?: boolean;10939 /** @see https://pptr.dev/api/puppeteer.screenshotoptions */10940 screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;10941};10942type BrowserRunPDFOptions = BrowserRunCommonOptions & {10943 /** @see https://pptr.dev/api/puppeteer.pdfoptions */10944 pdfOptions?: {10945 /** @default 1 */10946 scale?: number;10947 /** @default false */10948 displayHeaderFooter?: boolean;10949 headerTemplate?: string;10950 footerTemplate?: string;10951 /** @default false */10952 printBackground?: boolean;10953 /** @default false */10954 landscape?: boolean;10955 pageRanges?: string;10956 /** @default "letter" */10957 format?: 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6';10958 width?: string | number;10959 height?: string | number;10960 /** @default false */10961 preferCSSPageSize?: boolean;10962 margin?: {10963 top?: string | number;10964 right?: string | number;10965 bottom?: string | number;10966 left?: string | number;10967 };10968 /** @default false */10969 omitBackground?: boolean;10970 /** @default true */10971 tagged?: boolean;10972 /** @default false */10973 outline?: boolean;10974 /** @default 30000 */10975 timeout?: number;10976 };10977};10978type BrowserRunScrapeOptions = BrowserRunCommonOptions & {10979 /** CSS selectors to scrape. At least one element is required. */10980 elements: Array<{10981 selector: string;10982 }>;10983};10984type BrowserRunLinksOptions = BrowserRunCommonOptions & {10985 /** When true, only return links that are visible on the page. @default false */10986 visibleLinksOnly?: boolean;10987 /** When true, exclude links pointing to external domains. @default false */10988 excludeExternalLinks?: boolean;10989};10990type BrowserRunSnapshotFormat = 'content' | 'screenshot' | 'markdown' | 'accessibilityTree';10991type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {10992 /** Which representations of the page to return. At least two distinct formats10993 * are required; request a single format from its dedicated action instead.10994 * @default ["content","screenshot"]10995 */10996 formats?: BrowserRunSnapshotFormat[];10997 /** @see https://pptr.dev/api/puppeteer.screenshotoptions */10998 screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;10999};11000/** Options for the `accessibilityTree` quick action. */11001type BrowserRunAccessibilityTreeOptions = BrowserRunCommonOptions & {11002 /** When true, prune nodes that carry no semantic meaning, such as generic11003 * containers. Defaults to true, or to false when `root` is set so that the11004 * requested subtree is returned as-is.11005 */11006 interestingOnly?: boolean;11007 /** CSS selector limiting the tree to the matching element's subtree.11008 * A selector that matches nothing yields `accessibilityTree: null` with11009 * HTTP 200; a malformed selector is an error.11010 */11011 root?: string;11012};11013interface BrowserRunJsonBaseOptions {11014 /** Custom AI models to try in order. Max 3. Falls back to next on error. */11015 custom_ai?: Array<{11016 /** Model ID in `<provider>/<model_name>` format, e.g. `"workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast"`. */11017 model: string;11018 /** Bearer token. Not needed for workers-ai models. */11019 authorization?: string;11020 }>;11021}11022/**11023 * Options for the `json` quick action.11024 * At least one of `prompt` or `response_format` must be provided.11025 */11026type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions & ({11027 /** Natural-language prompt describing what data to extract. */11028 prompt: string;11029 /** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */11030 response_format?: AiTextGenerationResponseFormat;11031} | {11032 /** Natural-language prompt describing what data to extract. */11033 prompt?: string;11034 /** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */11035 response_format: AiTextGenerationResponseFormat;11036});11037type BrowserRunContentOptions = BrowserRunCommonOptions;11038type BrowserRunMarkdownOptions = BrowserRunCommonOptions;11039type BrowserRunResponseMeta = {11040 /** HTTP status code of the rendered page */11041 status: number;11042 /** Page title */11043 title: string;11044};11045/**11046 * A node in the page's accessibility tree, as exposed to assistive technology.11047 * `role` is the only field always present; the rest are populated when the11048 * underlying element defines them.11049 * @see https://pptr.dev/api/puppeteer.serializedaxnode11050 */11051interface BrowserRunSerializedAXNode {11052 /** The ARIA role, e.g. `"button"`, `"heading"`, `"RootWebArea"`. */11053 role: string;11054 /** The `aria-autocomplete` value. */11055 autocomplete?: string;11056 /** Checked state of a checkbox, radio, or menu item. */11057 checked?: boolean | 'mixed';11058 /** Accessible description, typically from `aria-describedby` or `title`. */11059 description?: string;11060 disabled?: boolean;11061 expanded?: boolean;11062 /** Whether the element currently holds keyboard focus. */11063 focused?: boolean;11064 /** The kind of popup the element triggers, e.g. `"menu"`, `"dialog"`. */11065 haspopup?: string;11066 /** The `aria-invalid` value. */11067 invalid?: string;11068 /** Keyboard shortcuts bound to the element, from `aria-keyshortcuts`. */11069 keyshortcuts?: string;11070 /** Hierarchical level, e.g. the heading level of an `<h2>`. */11071 level?: number;11072 /** Whether the element is a modal dialog. */11073 modal?: boolean;11074 /** Whether a text input accepts multiple lines. */11075 multiline?: boolean;11076 /** Whether more than one option can be selected. */11077 multiselectable?: boolean;11078 /** Accessible name, e.g. a button's label or an image's alt text. */11079 name?: string;11080 orientation?: string;11081 /** Pressed state of a toggle button. */11082 pressed?: boolean | 'mixed';11083 readonly?: boolean;11084 required?: boolean;11085 /** Author-supplied role description, from `aria-roledescription`. */11086 roledescription?: string;11087 selected?: boolean;11088 /** Current value of an input or range element. */11089 value?: string | number;11090 valuemax?: number;11091 valuemin?: number;11092 /** Human-readable form of `value`, from `aria-valuetext`. */11093 valuetext?: string;11094 /** Child nodes. Absent for leaf nodes. */11095 children?: BrowserRunSerializedAXNode[];11096}11097/** Success response for `content` action. */11098type BrowserRunContentSuccessResponse = {11099 success: true;11100 /** Extracted HTML content */11101 result: string;11102 meta: BrowserRunResponseMeta;11103};11104/** Success response for `links` action. */11105type BrowserRunLinksSuccessResponse = {11106 success: true;11107 /** Extracted links */11108 result: string[];11109};11110/** Success response for `scrape` action. */11111type BrowserRunScrapeSuccessResponse = {11112 success: true;11113 result: Array<{11114 /** The CSS selector used to find elements. */11115 selector: string;11116 /** Array of elements matching the selector. */11117 results: Array<{11118 /** Outer HTML of the element. */11119 html: string;11120 /** Text content of the element. */11121 text: string;11122 /** Width of the element in pixels. */11123 width: number;11124 /** Height of the element in pixels. */11125 height: number;11126 /** Top position of the element relative to the viewport in pixels. */11127 top: number;11128 /** Left position of the element relative to the viewport in pixels. */11129 left: number;11130 /** Array of HTML attributes on the element. */11131 attributes: Array<{11132 /** Attribute name. */11133 name: string;11134 /** Attribute value. */11135 value: string;11136 }>;11137 }>;11138 }>;11139};11140/** Success response for `snapshot` action. Each field is present only when the11141 * corresponding entry was requested in `formats`.11142 */11143type BrowserRunSnapshotSuccessResponse = {11144 success: true;11145 result: {11146 /** HTML content of the page. */11147 content?: string;11148 /** Base64-encoded screenshot image. */11149 screenshot?: string;11150 /** Markdown content. Prefixed with YAML frontmatter (e.g. `title`) when the11151 * page provides that metadata.11152 */11153 markdown?: string;11154 /** Root of the page's accessibility tree. */11155 accessibilityTree?: BrowserRunSerializedAXNode;11156 };11157 meta: BrowserRunResponseMeta;11158};11159/** Success response for `accessibilityTree` action. */11160type BrowserRunAccessibilityTreeSuccessResponse = {11161 success: true;11162 result: {11163 /** Root of the accessibility tree, or `null` when `root` matched no element. */11164 accessibilityTree: BrowserRunSerializedAXNode | null;11165 };11166 meta: BrowserRunResponseMeta;11167};11168/** Success response for `json` action. */11169type BrowserRunJsonSuccessResponse = {11170 success: true;11171 /** JSON data extracted from the page using an AI model */11172 result: Record<string, unknown>;11173};11174/** Success response for `markdown` action. */11175type BrowserRunMarkdownSuccessResponse = {11176 success: true;11177 /** Extracted markdown content */11178 result: string;11179};11180/** Error response for BrowserRun actions. */11181type BrowserRunErrorResponse = {11182 success: false;11183 errors: {11184 message: string;11185 code?: number;11186 detail?: string;11187 path?: string;11188 }[];11189};11190/** Error response for BrowserRun `json` action. */11191type BrowserRunJsonErrorResponse = BrowserRunErrorResponse & {11192 /** Raw AI response text for debugging */11193 rawAiResponse?: string;11194};11195/**11196 * Browser Run API binding for automating headless browsers.11197 * @see https://developers.cloudflare.com/browser-run/11198 */11199declare abstract class BrowserRun {11200 /**11201 * Send a raw HTTP request to the Browser Run API.11202 * Used by libraries like `@cloudflare/puppeteer` to acquire and connect to a browser instance.11203 * @see https://developers.cloudflare.com/browser-run/11204 */11205 fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;11206 /**11207 * Take a screenshot of a web page.11208 * @param action - Must be `'screenshot'`.11209 * @param options - Screenshot options including viewport, selectors, and image format.11210 * @returns A `Response` containing one of:11211 *11212 * **Success (HTTP 200):**11213 * - Binary image data with `Content-Type: image/png`, `image/jpeg`, or `image/webp` (when `encoding: 'binary'`, the default)11214 * - Data URI string with `Content-Type: text/plain` (when `encoding: 'base64'`)11215 *11216 * **Error:**11217 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11218 *11219 * **Headers:**11220 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11221 */11222 quickAction(action: 'screenshot', options: BrowserRunScreenshotOptions): Promise<Response>;11223 /**11224 * Generate a PDF of a web page.11225 * @param action - Must be `'pdf'`.11226 * @param options - PDF generation options including page size, margins, and headers/footers.11227 * @returns A `Response` containing one of:11228 *11229 * **Success (HTTP 200):**11230 * - Binary PDF data with `Content-Type: application/pdf`11231 *11232 * **Error:**11233 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11234 *11235 * **Headers:**11236 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11237 */11238 quickAction(action: 'pdf', options: BrowserRunPDFOptions): Promise<Response>;11239 /**11240 * Get the HTML content of a web page.11241 * @param action - Must be `'content'`.11242 * @param options - Navigation and page interaction options.11243 * @returns A `Response` containing one of:11244 *11245 * **Success (HTTP 200):**11246 * - `BrowserRunContentSuccessResponse` JSON with `Content-Type: application/json`11247 *11248 * **Error:**11249 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11250 *11251 * **Headers:**11252 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11253 */11254 quickAction(action: 'content', options: BrowserRunContentOptions): Promise<Response>;11255 /**11256 * Scrape elements from a web page by CSS selector.11257 * @param action - Must be `'scrape'`.11258 * @param options - Scrape options with CSS selectors for elements to extract.11259 * @returns A `Response` containing one of:11260 *11261 * **Success (HTTP 200):**11262 * - `BrowserRunScrapeSuccessResponse` JSON with `Content-Type: application/json`11263 *11264 * **Error:**11265 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11266 *11267 * **Headers:**11268 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11269 */11270 quickAction(action: 'scrape', options: BrowserRunScrapeOptions): Promise<Response>;11271 /**11272 * Extract all links from a web page.11273 * @param action - Must be `'links'`.11274 * @param options - Options to filter visible or internal links only.11275 * @returns A `Response` containing one of:11276 *11277 * **Success (HTTP 200):**11278 * - `BrowserRunLinksSuccessResponse` JSON with `Content-Type: application/json`11279 *11280 * **Error:**11281 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11282 *11283 * **Headers:**11284 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11285 */11286 quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;11287 /**11288 * Get several representations of a web page in one request.11289 * @param action - Must be `'snapshot'`.11290 * @param options - Snapshot options including the `formats` to return and11291 * screenshot settings (encoding is always base64).11292 * @returns A `Response` containing one of:11293 *11294 * **Success (HTTP 200):**11295 * - `BrowserRunSnapshotSuccessResponse` JSON with `Content-Type: application/json`11296 *11297 * **Error:**11298 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11299 *11300 * **Headers:**11301 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11302 */11303 quickAction(action: 'snapshot', options: BrowserRunSnapshotOptions): Promise<Response>;11304 /**11305 * Extract structured JSON data from a web page using AI.11306 * @param action - Must be `'json'`.11307 * @param options - JSON extraction options with prompt or response_format schema.11308 * @returns A `Response` containing one of:11309 *11310 * **Success (HTTP 200):**11311 * - `BrowserRunJsonSuccessResponse` JSON with `Content-Type: application/json`11312 *11313 * **Error:**11314 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11315 * - HTTP 422 with code `2012` for HTML-to-markdown conversion failures11316 * - HTTP 422/500 for AI extraction failures (may include `rawAiResponse` field)11317 *11318 * **Headers:**11319 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11320 */11321 quickAction(action: 'json', options: BrowserRunJsonOptions): Promise<Response>;11322 /**11323 * Convert a web page to Markdown.11324 * @param action - Must be `'markdown'`.11325 * @param options - Navigation and page interaction options.11326 * @returns A `Response` containing one of:11327 *11328 * **Success (HTTP 200):**11329 * - `BrowserRunMarkdownSuccessResponse` JSON with `Content-Type: application/json`11330 *11331 * **Error:**11332 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11333 * - HTTP 422 with code `2012` for HTML-to-markdown conversion failures11334 *11335 * **Headers:**11336 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11337 */11338 quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;11339 /**11340 * Get the accessibility tree of a web page.11341 * @param action - Must be `'accessibilityTree'`.11342 * @param options - Options to scope the tree to a subtree and to control11343 * whether semantically uninteresting nodes are pruned.11344 * @returns A `Response` containing one of:11345 *11346 * **Success (HTTP 200):**11347 * - `BrowserRunAccessibilityTreeSuccessResponse` JSON with `Content-Type: application/json`11348 * - `result.accessibilityTree` is `null` when `root` matched no element11349 *11350 * **Error:**11351 * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)11352 * - HTTP 422 for a malformed `root` selector11353 * - HTTP 500 with code `2017` or `2018` when the tree could not be built11354 *11355 * **Headers:**11356 * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)11357 */11358 quickAction(action: 'accessibilityTree', options: BrowserRunAccessibilityTreeOptions): Promise<Response>;11359}11360/**11361 * In addition to the properties you can set in the RequestInit dict11362 * that you pass as an argument to the Request constructor, you can11363 * set certain properties of a `cf` object to control how Cloudflare11364 * features are applied to that new Request.11365 *11366 * Note: Currently, these properties cannot be tested in the11367 * playground.11368 */11369interface RequestInitCfProperties extends Record<string, unknown> {11370 cacheEverything?: boolean;11371 /**11372 * A request's cache key is what determines if two requests are11373 * "the same" for caching purposes. If a request has the same cache key11374 * as some previous request, then we can serve the same cached response for11375 * both. (e.g. 'some-key')11376 *11377 * Only available for Enterprise customers.11378 */11379 cacheKey?: string;11380 /**11381 * This allows you to append additional Cache-Tag response headers11382 * to the origin response without modifications to the origin server.11383 * This will allow for greater control over the Purge by Cache Tag feature11384 * utilizing changes only in the Workers process.11385 *11386 * Only available for Enterprise customers.11387 */11388 cacheTags?: string[];11389 /**11390 * Force response to be cached for a given number of seconds. (e.g. 300)11391 */11392 cacheTtl?: number;11393 /**11394 * Force response to be cached for a given number of seconds based on the Origin status code.11395 * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })11396 */11397 cacheTtlByStatus?: Record<string, number>;11398 /** Controls how responses with a `Vary` header are cached for this request. */11399 vary?: RequestInitCfPropertiesVary;11400 /**11401 * Explicit Cache-Control header value to set on the response stored in cache.11402 * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').11403 *11404 * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`),11405 * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError.11406 *11407 * Can be used together with `cacheTtlByStatus`.11408 */11409 cacheControl?: string;11410 /**11411 * Whether the response should be eligible for Cache Reserve storage.11412 */11413 cacheReserveEligible?: boolean;11414 /**11415 * Whether to respect strong ETags (as opposed to weak ETags) from the origin.11416 */11417 respectStrongEtag?: boolean;11418 /**11419 * Whether to strip ETag headers from the origin response before caching.11420 */11421 stripEtags?: boolean;11422 /**11423 * Whether to strip Last-Modified headers from the origin response before caching.11424 */11425 stripLastModified?: boolean;11426 /**11427 * Whether to enable Cache Deception Armor, which protects against web cache11428 * deception attacks by verifying the Content-Type matches the URL extension.11429 */11430 cacheDeceptionArmor?: boolean;11431 /**11432 * Minimum file size in bytes for a response to be eligible for Cache Reserve storage.11433 */11434 cacheReserveMinimumFileSize?: number;11435 scrapeShield?: boolean;11436 apps?: boolean;11437 /**11438 * Controls whether an outbound gRPC-web subrequest from this Worker is11439 * converted to gRPC at the Cloudflare edge.11440 *11441 * - `"passthrough"`: forward the subrequest unchanged as gRPC-web (default).11442 * - `"convert"`: convert the gRPC-web subrequest to gRPC at the edge.11443 *11444 * Provides per-request control over the same edge conversion behavior11445 * gated by the `auto_grpc_convert` compatibility flag.11446 */11447 grpcWeb?: "passthrough" | "convert";11448 image?: RequestInitCfPropertiesImage;11449 minify?: RequestInitCfPropertiesImageMinify;11450 mirage?: boolean;11451 polish?: "lossy" | "lossless" | "off";11452 r2?: RequestInitCfPropertiesR2;11453 /**11454 * Redirects the request to an alternate origin server. You can use this,11455 * for example, to implement load balancing across several origins.11456 * (e.g.us-east.example.com)11457 *11458 * Note - For security reasons, the hostname set in resolveOverride must11459 * be proxied on the same Cloudflare zone of the incoming request.11460 * Otherwise, the setting is ignored. CNAME hosts are allowed, so to11461 * resolve to a host under a different domain or a DNS only domain first11462 * declare a CNAME record within your own zone’s DNS mapping to the11463 * external hostname, set proxy on Cloudflare, then set resolveOverride11464 * to point to that CNAME record.11465 */11466 resolveOverride?: string;11467}11468/**11469 * Controls how Workers Standard Vary handles a request header listed by an11470 * origin `Vary` response header:11471 *11472 * - `"normalize"`: normalize the request header value before it is used in the11473 * cache variance key.11474 * - `"passthrough"`: use the raw request header value in the cache variance11475 * key.11476 * - `"bypass"`: bypass cache when the header appears in the origin `Vary`11477 * response header.11478 */11479type RequestInitCfPropertiesVaryAction = "normalize" | "passthrough" | "bypass";11480/** Configuration for Workers Standard Vary support. */11481interface RequestInitCfPropertiesVary {11482 /** The fallback action for varied request headers not listed in `headers`. */11483 default: RequestInitCfPropertiesVaryHeader;11484 /**11485 * Lowercase request header names and their Vary configuration.11486 *11487 * The `accept` header can include `media_types`, the `accept-language`11488 * header can include `languages`, and other headers support only `action`.11489 */11490 headers?: RequestInitCfPropertiesVaryHeaders;11491}11492/** Common Vary behavior for a single request header. */11493interface RequestInitCfPropertiesVaryHeader {11494 /** How this request header contributes to cache variance. */11495 action: RequestInitCfPropertiesVaryAction;11496}11497/** Vary behavior for the `accept` request header. */11498interface RequestInitCfPropertiesVaryAcceptHeader extends RequestInitCfPropertiesVaryHeader {11499 /**11500 * Media types to keep when normalizing the `Accept` request header.11501 *11502 * Named `media_types` to match the serialized `cf.vary` configuration.11503 */11504 media_types?: string[];11505}11506/** Vary behavior for the `accept-language` request header. */11507interface RequestInitCfPropertiesVaryAcceptLanguageHeader extends RequestInitCfPropertiesVaryHeader {11508 /**11509 * Language tags to keep when normalizing the `Accept-Language` request11510 * header.11511 */11512 languages?: string[];11513}11514/**11515 * Lowercase request header names and their Vary behavior.11516 *11517 * The index signature allows arbitrary custom request headers beyond the11518 * well-known `accept` and `accept-language` specializations.11519 */11520interface RequestInitCfPropertiesVaryHeaders {11521 accept?: RequestInitCfPropertiesVaryAcceptHeader;11522 "accept-language"?: RequestInitCfPropertiesVaryAcceptLanguageHeader;11523 [header: string]: RequestInitCfPropertiesVaryHeader | RequestInitCfPropertiesVaryAcceptHeader | RequestInitCfPropertiesVaryAcceptLanguageHeader | undefined;11524}11525interface BasicImageTransformations {11526 /**11527 * Maximum width in image pixels. The value must be an integer.11528 */11529 width?: number;11530 /**11531 * Maximum height in image pixels. The value must be an integer.11532 */11533 height?: number;11534 /**11535 * When cropping with fit: "cover", this defines the side or point that should11536 * be left uncropped. The value is either a string11537 * "left", "right", "top", "bottom", "auto", or "center" (the default),11538 * or an object {x, y} containing focal point coordinates in the original11539 * image expressed as fractions ranging from 0.0 (top or left) to 1.011540 * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will11541 * crop bottom or left and right sides as necessary, but won’t crop anything11542 * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to11543 * preserve as much as possible around a point at 20% of the height of the11544 * source image.11545 */11546 gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates;11547 /**11548 * Specifies how closely the image is cropped toward detected faces when combined11549 * with the gravity=face option. Accepts a valid range between 0.0 (includes as much11550 * of the background as possible) and 1.0 (crops the image as closely to the face as11551 * possible). The default is 0.11552 */11553 zoom?: number;11554 /**11555 * Resizing mode as a string. It affects interpretation of width and height11556 * options:11557 * - scale-down: Similar to contain, but the image is never enlarged. If11558 * the image is larger than given width or height, it will be resized.11559 * Otherwise its original size will be kept.11560 * - scale-up: Similar to contain, but the image is never shrunk. If the11561 * image is smaller than the given width or height, it will be resized.11562 * Otherwise its original size will be kept.11563 * - contain: Resizes to maximum size that fits within the given width and11564 * height. If only a single dimension is given (e.g. only width), the11565 * image will be shrunk or enlarged to exactly match that dimension.11566 * Aspect ratio is always preserved.11567 * - cover: Resizes (shrinks or enlarges) to fill the entire area of width11568 * and height. If the image has an aspect ratio different from the ratio11569 * of width and height, it will be cropped to fit.11570 * - crop: The image will be shrunk and cropped to fit within the area11571 * specified by width and height. The image will not be enlarged. For images11572 * smaller than the given dimensions it's the same as scale-down. For11573 * images larger than the given dimensions, it's the same as cover.11574 * See also trim.11575 * - pad: Resizes to the maximum size that fits within the given width and11576 * height, and then fills the remaining area with a background color11577 * (white by default). Use of this mode is not recommended, as the same11578 * effect can be more efficiently achieved with the contain mode and the11579 * CSS object-fit: contain property.11580 * - squeeze: Stretches and deforms to the width and height given, even if it11581 * breaks aspect ratio11582 */11583 fit?: "scale-down" | "scale-up" | "contain" | "cover" | "crop" | "pad" | "squeeze";11584 /**11585 * Allows you to trim your image. Takes dpr into account and is performed before11586 * resizing or rotation.11587 *11588 * It can be used as:11589 * - left, top, right, bottom - it will specify the number of pixels to cut11590 * off each side11591 * - width, height - the width/height you'd like to end up with - can be used11592 * in combination with the properties above11593 * - border - this will automatically trim the surroundings of an image based on11594 * it's color. It consists of three properties:11595 * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)11596 * - tolerance: difference from color to treat as color11597 * - keep: the number of pixels of border to keep11598 */11599 trim?: "border" | {11600 top?: number;11601 bottom?: number;11602 left?: number;11603 right?: number;11604 width?: number;11605 height?: number;11606 border?: boolean | {11607 color?: string;11608 tolerance?: number;11609 keep?: number;11610 };11611 };11612 /**11613 * Background color to add underneath the image. Applies only to images with11614 * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),11615 * hsl(…), etc.)11616 */11617 background?: string;11618 /**11619 * Flips the images horizontally, vertically, or both. Flipping is applied before11620 * rotation, so if you apply flip=h,rotate=90 then the image will be flipped11621 * horizontally, then rotated by 90 degrees.11622 */11623 flip?: 'h' | 'v' | 'hv';11624 /**11625 * Number of degrees (90, 180, 270) to rotate the image by. width and height11626 * options refer to axes after rotation.11627 */11628 rotate?: 0 | 90 | 180 | 270 | 360;11629 /**11630 * Strength of sharpening filter to apply to the image. Floating-point11631 * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a11632 * recommended value for downscaled images.11633 */11634 sharpen?: number;11635 /**11636 * Radius of a blur filter (approximate gaussian). Maximum supported radius11637 * is 250.11638 */11639 blur?: number;11640 /**11641 * Increase contrast by a factor. A value of 1.0 equals no change, a value of11642 * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is11643 * ignored.11644 */11645 contrast?: number;11646 /**11647 * Increase brightness by a factor. A value of 1.0 equals no change, a value11648 * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.11649 * 0 is ignored.11650 */11651 brightness?: number;11652 /**11653 * Increase exposure by a factor. A value of 1.0 equals no change, a value of11654 * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.11655 */11656 gamma?: number;11657 /**11658 * Increase contrast by a factor. A value of 1.0 equals no change, a value of11659 * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is11660 * ignored.11661 */11662 saturation?: number;11663 /**11664 * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it11665 * easier to specify higher-DPI sizes in <img srcset>.11666 */11667 dpr?: number;11668 /**11669 * Adds a border around the image. The border is added after resizing. Border11670 * width takes dpr into account, and can be specified either using a single11671 * width property, or individually for each side.11672 */11673 border?: {11674 color: string;11675 width: number;11676 } | {11677 color: string;11678 top: number;11679 right: number;11680 bottom: number;11681 left: number;11682 };11683 /**11684 * Image segmentation using artificial intelligence models. Sets pixels not11685 * within selected segment area to transparent e.g "foreground" sets every11686 * background pixel as transparent.11687 */11688 segment?: "foreground";11689 /**11690 * Controls the algorithm used when an image needs to be enlarged. This11691 * parameter works with any fit mode that upscales, such as `contain`,11692 * `cover`, and `scale-up`. It has no effect when `fit=scale-down` or when11693 * the target dimensions are smaller than the source.11694 * - interpolate: Uses bicubic interpolation, which may reduce image quality.11695 * This is the default behavior when `upscale` is not specified.11696 * - generate: Uses AI upscaling to produce sharper, more detailed results11697 * when enlarging images.11698 */11699 upscale?: "interpolate" | "generate";11700}11701interface BasicImageTransformationsGravityCoordinates {11702 x?: number;11703 y?: number;11704 mode?: 'remainder' | 'box-center';11705}11706interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {11707 /**11708 * Absolute URL of the image file to use for the drawing. It can be any of11709 * the supported file formats. For drawing of watermarks or non-rectangular11710 * overlays we recommend using PNG or WebP images.11711 */11712 url: string;11713 /**11714 * Floating-point number between 0 (transparent) and 1 (opaque).11715 * For example, opacity: 0.5 makes overlay semitransparent.11716 */11717 opacity?: number;11718 /**11719 * - If set to true, the overlay image will be tiled to cover the entire11720 * area. This is useful for stock-photo-like watermarks.11721 * - If set to "x", the overlay image will be tiled horizontally only11722 * (form a line).11723 * - If set to "y", the overlay image will be tiled vertically only11724 * (form a line).11725 */11726 repeat?: true | "x" | "y";11727 /**11728 * How to combine the foreground and backdrop pixels to create the result11729 */11730 composite?:11731 /** Foreground drawn on top of backdrop (default) */11732 'over'11733 /** Foreground shown only where backdrop is opaque */11734 | 'in'11735 /** Foreground drawn on top, but clipped to the backdrop's shape */11736 | 'atop'11737 /** Foreground shown only where backdrop is transparent */11738 | 'out'11739 /** Foreground and backdrop visible only where the other is not */11740 | 'xor'11741 /** Foreground and backdrop channels added (brightening) */11742 | 'lighter';11743 /**11744 * Position of the overlay image relative to a given edge. Each property is11745 * an offset in pixels. 0 aligns exactly to the edge. For example, left: 1011746 * positions left side of the overlay 10 pixels from the left edge of the11747 * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom11748 * of the background image.11749 *11750 * Setting both left & right, or both top & bottom is an error.11751 *11752 * If no position is specified, the image will be centered.11753 */11754 top?: number;11755 left?: number;11756 bottom?: number;11757 right?: number;11758}11759interface RequestInitCfPropertiesImage extends BasicImageTransformations {11760 /**11761 * Quality setting from 1-100 (useful values are in 60-90 range). Lower values11762 * make images look worse, but load faster. The default is 85. It applies only11763 * to JPEG and WebP images. It doesn’t have any effect on PNG.11764 */11765 quality?: number | "low" | "medium-low" | "medium-high" | "high";11766 /**11767 * Output format to generate. It can be:11768 * - avif: generate images in AVIF format.11769 * - webp: generate images in Google WebP format. Set quality to 100 to get11770 * the WebP-lossless format.11771 * - json: instead of generating an image, outputs information about the11772 * image, in JSON format. The JSON object will contain image size11773 * (before and after resizing), source image’s MIME type, file size, etc.11774 * - jpeg: generate images in JPEG format.11775 * - png: generate images in PNG format.11776 */11777 format?: "avif" | "webp" | "json" | "jpeg" | "png" | "baseline-jpeg" | "png-force" | "svg";11778 /**11779 * Whether to preserve animation frames from input files. Default is true.11780 * Setting it to false reduces animations to still images. This setting is11781 * recommended when enlarging images or processing arbitrary user content,11782 * because large GIF animations can weigh tens or even hundreds of megabytes.11783 * It is also useful to set anim:false when using format:"json" to get the11784 * response quicker without the number of frames.11785 */11786 anim?: boolean;11787 /**11788 * What EXIF data should be preserved in the output image. Note that EXIF11789 * rotation and embedded color profiles are always applied ("baked in" into11790 * the image), and aren't affected by this option. Note that if the Polish11791 * feature is enabled, all metadata may have been removed already and this11792 * option may have no effect.11793 * - keep: Preserve most of EXIF metadata, including GPS location if there's11794 * any.11795 * - copyright: Only keep the copyright tag, and discard everything else.11796 * This is the default behavior for JPEG files.11797 * - none: Discard all invisible EXIF metadata. Currently WebP and PNG11798 * output formats always discard metadata.11799 */11800 metadata?: "keep" | "copyright" | "none";11801 /**11802 * Overlays are drawn in the order they appear in the array (last array11803 * entry is the topmost layer).11804 */11805 draw?: RequestInitCfPropertiesImageDraw[];11806 /**11807 * Fetching image from authenticated origin. Setting this property will11808 * pass authentication headers (Authorization, Cookie, etc.) through to11809 * the origin.11810 */11811 "origin-auth"?: "share-publicly";11812 /**11813 * Slightly reduces latency on a cache miss by selecting a11814 * quickest-to-compress file format, at a cost of increased file size and11815 * lower image quality. It will usually override the format option and choose11816 * JPEG over WebP or AVIF. We do not recommend using this option, except in11817 * unusual circumstances like resizing uncacheable dynamically-generated11818 * images.11819 */11820 compression?: "fast";11821}11822interface RequestInitCfPropertiesImageMinify {11823 javascript?: boolean;11824 css?: boolean;11825 html?: boolean;11826}11827interface RequestInitCfPropertiesR2 {11828 /**11829 * Colo id of bucket that an object is stored in11830 */11831 bucketColoId?: number;11832}11833/**11834 * Request metadata provided by Cloudflare's edge.11835 */11836type IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield;11837interface IncomingRequestCfPropertiesBase extends Record<string, unknown> {11838 /**11839 * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.11840 *11841 * @example 39574711842 */11843 asn?: number;11844 /**11845 * The organization which owns the ASN of the incoming request.11846 *11847 * @example "Google Cloud"11848 */11849 asOrganization?: string;11850 /**11851 * The original value of the `Accept-Encoding` header if Cloudflare modified it.11852 *11853 * @example "gzip, deflate, br"11854 */11855 clientAcceptEncoding?: string;11856 /**11857 * The number of milliseconds it took for the request to reach your worker.11858 *11859 * @example 2211860 */11861 clientTcpRtt?: number;11862 /**11863 * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)11864 * airport code of the data center that the request hit.11865 *11866 * @example "DFW"11867 */11868 colo: string;11869 /**11870 * Represents the upstream's response to a11871 * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)11872 * from cloudflare.11873 *11874 * For workers with no upstream, this will always be `1`.11875 *11876 * @example 311877 */11878 edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;11879 /**11880 * The HTTP Protocol the request used.11881 *11882 * @example "HTTP/2"11883 */11884 httpProtocol: string;11885 /**11886 * The browser-requested prioritization information in the request object.11887 *11888 * If no information was set, defaults to the empty string `""`11889 *11890 * @example "weight=192;exclusive=0;group=3;group-weight=127"11891 * @default ""11892 */11893 requestPriority: string;11894 /**11895 * The TLS version of the connection to Cloudflare.11896 * In requests served over plaintext (without TLS), this property is the empty string `""`.11897 *11898 * @example "TLSv1.3"11899 */11900 tlsVersion: string;11901 /**11902 * The cipher for the connection to Cloudflare.11903 * In requests served over plaintext (without TLS), this property is the empty string `""`.11904 *11905 * @example "AEAD-AES128-GCM-SHA256"11906 */11907 tlsCipher: string;11908 /**11909 * 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.11910 *11911 * If the incoming request was served over plaintext (without TLS) this field is undefined.11912 */11913 tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;11914}11915interface IncomingRequestCfPropertiesBotManagementBase {11916 /**11917 * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,11918 * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).11919 *11920 * @example 5411921 */11922 score: number;11923 /**11924 * A boolean value that is true if the request comes from a good bot, like Google or Bing.11925 * 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).11926 */11927 verifiedBot: boolean;11928 /**11929 * A boolean value that is true if the request originates from a11930 * Cloudflare-verified proxy service.11931 */11932 corporateProxy: boolean;11933 /**11934 * 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.11935 */11936 staticResource: boolean;11937 /**11938 * 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).11939 */11940 detectionIds: number[];11941}11942interface IncomingRequestCfPropertiesBotManagement {11943 /**11944 * Results of Cloudflare's Bot Management analysis11945 */11946 botManagement: IncomingRequestCfPropertiesBotManagementBase;11947 /**11948 * Duplicate of `botManagement.score`.11949 *11950 * @deprecated11951 */11952 clientTrustScore: number;11953}11954interface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement {11955 /**11956 * Results of Cloudflare's Bot Management analysis11957 */11958 botManagement: IncomingRequestCfPropertiesBotManagementBase & {11959 /**11960 * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients11961 * across different destination IPs, Ports, and X509 certificates.11962 */11963 ja3Hash: string;11964 };11965}11966interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {11967 /**11968 * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).11969 *11970 * This field is only present if you have Cloudflare for SaaS enabled on your account11971 * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).11972 */11973 hostMetadata?: HostMetadata;11974}11975interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {11976 /**11977 * Information about the client certificate presented to Cloudflare.11978 *11979 * This is populated when the incoming request is served over TLS using11980 * either Cloudflare Access or API Shield (mTLS)11981 * and the presented SSL certificate has a valid11982 * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)11983 * (i.e., not `null` or `""`).11984 *11985 * Otherwise, a set of placeholder values are used.11986 *11987 * The property `certPresented` will be set to `"1"` when11988 * the object is populated (i.e. the above conditions were met).11989 */11990 tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;11991}11992/**11993 * Metadata about the request's TLS handshake11994 */11995interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {11996 /**11997 * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal11998 *11999 * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"12000 */12001 clientHandshake: string;12002 /**12003 * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal12004 *12005 * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d"12006 */12007 serverHandshake: string;12008 /**12009 * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal12010 *12011 * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"12012 */12013 clientFinished: string;12014 /**12015 * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal12016 *12017 * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b"12018 */12019 serverFinished: string;12020}12021/**12022 * Geographic data about the request's origin.12023 */12024interface IncomingRequestCfPropertiesGeographicInformation {12025 /**12026 * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.12027 *12028 * 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.12029 *12030 * If Cloudflare is unable to determine where the request originated this property is omitted.12031 *12032 * The country code `"T1"` is used for requests originating on TOR.12033 *12034 * @example "GB"12035 */12036 country?: Iso3166Alpha2Code | "T1";12037 /**12038 * If present, this property indicates that the request originated in the EU12039 *12040 * @example "1"12041 */12042 isEUCountry?: "1";12043 /**12044 * A two-letter code indicating the continent the request originated from.12045 *12046 * @example "AN"12047 */12048 continent?: ContinentCode;12049 /**12050 * The city the request originated from12051 *12052 * @example "Austin"12053 */12054 city?: string;12055 /**12056 * Postal code of the incoming request12057 *12058 * @example "78701"12059 */12060 postalCode?: string;12061 /**12062 * Latitude of the incoming request12063 *12064 * @example "30.27130"12065 */12066 latitude?: string;12067 /**12068 * Longitude of the incoming request12069 *12070 * @example "-97.74260"12071 */12072 longitude?: string;12073 /**12074 * Timezone of the incoming request12075 *12076 * @example "America/Chicago"12077 */12078 timezone?: string;12079 /**12080 * If known, the ISO 3166-2 name for the first level region associated with12081 * the IP address of the incoming request12082 *12083 * @example "Texas"12084 */12085 region?: string;12086 /**12087 * If known, the ISO 3166-2 code for the first-level region associated with12088 * the IP address of the incoming request12089 *12090 * @example "TX"12091 */12092 regionCode?: string;12093 /**12094 * Metro code (DMA) of the incoming request12095 *12096 * @example "635"12097 */12098 metroCode?: string;12099}12100/** Data about the incoming request's TLS certificate */12101interface IncomingRequestCfPropertiesTLSClientAuth {12102 /** Always `"1"`, indicating that the certificate was presented */12103 certPresented: "1";12104 /**12105 * Result of certificate verification.12106 *12107 * @example "FAILED:self signed certificate"12108 */12109 certVerified: Exclude<CertVerificationStatus, "NONE">;12110 /** The presented certificate's revokation status.12111 *12112 * - A value of `"1"` indicates the certificate has been revoked12113 * - A value of `"0"` indicates the certificate has not been revoked12114 */12115 certRevoked: "1" | "0";12116 /**12117 * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)12118 *12119 * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"12120 */12121 certIssuerDN: string;12122 /**12123 * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)12124 *12125 * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"12126 */12127 certSubjectDN: string;12128 /**12129 * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)12130 *12131 * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"12132 */12133 certIssuerDNRFC2253: string;12134 /**12135 * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)12136 *12137 * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare"12138 */12139 certSubjectDNRFC2253: string;12140 /** The certificate issuer's distinguished name (legacy policies) */12141 certIssuerDNLegacy: string;12142 /** The certificate subject's distinguished name (legacy policies) */12143 certSubjectDNLegacy: string;12144 /**12145 * The certificate's serial number12146 *12147 * @example "00936EACBE07F201DF"12148 */12149 certSerial: string;12150 /**12151 * The certificate issuer's serial number12152 *12153 * @example "2489002934BDFEA34"12154 */12155 certIssuerSerial: string;12156 /**12157 * The certificate's Subject Key Identifier12158 *12159 * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"12160 */12161 certSKI: string;12162 /**12163 * The certificate issuer's Subject Key Identifier12164 *12165 * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4"12166 */12167 certIssuerSKI: string;12168 /**12169 * The certificate's SHA-1 fingerprint12170 *12171 * @example "6b9109f323999e52259cda7373ff0b4d26bd232e"12172 */12173 certFingerprintSHA1: string;12174 /**12175 * The certificate's SHA-256 fingerprint12176 *12177 * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea"12178 */12179 certFingerprintSHA256: string;12180 /**12181 * The effective starting date of the certificate12182 *12183 * @example "Dec 22 19:39:00 2018 GMT"12184 */12185 certNotBefore: string;12186 /**12187 * The effective expiration date of the certificate12188 *12189 * @example "Dec 22 19:39:00 2018 GMT"12190 */12191 certNotAfter: string;12192 /**12193 * The client leaf certificate in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)12194 * format (`:base64-DER:`). Empty if no client certificate was presented or if12195 * the leaf certificate exceeded 10 KB (see {@link certRFC9440TooLarge}).12196 *12197 * Suitable for forwarding to an origin via the `Client-Cert` HTTP header.12198 */12199 certRFC9440: string;12200 /**12201 * `true` if the leaf certificate exceeded 10 KB and was omitted from12202 * {@link certRFC9440}.12203 */12204 certRFC9440TooLarge: boolean;12205 /**12206 * The intermediate certificate chain in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)12207 * format as a comma-separated list. Empty if no intermediates were sent or12208 * if the chain exceeded 16 KB (see {@link certChainRFC9440TooLarge}).12209 *12210 * Suitable for forwarding to an origin via the `Client-Cert-Chain` HTTP header.12211 */12212 certChainRFC9440: string;12213 /**12214 * `true` if the intermediate chain exceeded 16 KB and was omitted from12215 * {@link certChainRFC9440}.12216 */12217 certChainRFC9440TooLarge: boolean;12218}12219/** Placeholder values for TLS Client Authorization */12220interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {12221 certPresented: "0";12222 certVerified: "NONE";12223 certRevoked: "0";12224 certIssuerDN: "";12225 certSubjectDN: "";12226 certIssuerDNRFC2253: "";12227 certSubjectDNRFC2253: "";12228 certIssuerDNLegacy: "";12229 certSubjectDNLegacy: "";12230 certSerial: "";12231 certIssuerSerial: "";12232 certSKI: "";12233 certIssuerSKI: "";12234 certFingerprintSHA1: "";12235 certFingerprintSHA256: "";12236 certNotBefore: "";12237 certNotAfter: "";12238 certRFC9440: "";12239 certRFC9440TooLarge: false;12240 certChainRFC9440: "";12241 certChainRFC9440TooLarge: false;12242}12243/** Possible outcomes of TLS verification */12244declare type CertVerificationStatus =12245/** Authentication succeeded */12246"SUCCESS"12247/** No certificate was presented */12248 | "NONE"12249/** Failed because the certificate was self-signed */12250 | "FAILED:self signed certificate"12251/** Failed because the certificate failed a trust chain check */12252 | "FAILED:unable to verify the first certificate"12253/** Failed because the certificate not yet valid */12254 | "FAILED:certificate is not yet valid"12255/** Failed because the certificate is expired */12256 | "FAILED:certificate has expired"12257/** Failed for another unspecified reason */12258 | "FAILED";12259/**12260 * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.12261 */12262declare 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 */12263/** ISO 3166-1 Alpha-2 codes */12264declare 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";12265/** The 2-letter continent codes Cloudflare uses */12266declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";12267type CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties;12268interface D1Meta {12269 duration: number;12270 size_after: number;12271 rows_read: number;12272 rows_written: number;12273 last_row_id: number;12274 changed_db: boolean;12275 changes: number;12276 /**12277 * The region of the database instance that executed the query.12278 */12279 served_by_region?: string;12280 /**12281 * The three letters airport code of the colo that executed the query.12282 */12283 served_by_colo?: string;12284 /**12285 * True if-and-only-if the database instance that executed the query was the primary.12286 */12287 served_by_primary?: boolean;12288 timings?: {12289 /**12290 * The duration of the SQL query execution by the database instance. It doesn't include any network time.12291 */12292 sql_duration_ms: number;12293 };12294 /**12295 * Number of total attempts to execute the query, due to automatic retries.12296 * Note: All other fields in the response like `timings` only apply to the last attempt.12297 */12298 total_attempts?: number;12299}12300interface D1Response {12301 success: true;12302 meta: D1Meta & Record<string, unknown>;12303 error?: never;12304}12305type D1Result<T = unknown> = D1Response & {12306 results: T[];12307};12308interface D1ExecResult {12309 count: number;12310 duration: number;12311}12312type D1SessionConstraint =12313// Indicates that the first query should go to the primary, and the rest queries12314// using the same D1DatabaseSession will go to any replica that is consistent with12315// the bookmark maintained by the session (returned by the first query).12316'first-primary'12317// Indicates that the first query can go anywhere (primary or replica), and the rest queries12318// using the same D1DatabaseSession will go to any replica that is consistent with12319// the bookmark maintained by the session (returned by the first query).12320 | 'first-unconstrained';12321type D1SessionBookmark = string;12322declare abstract class D1Database {12323 prepare(query: string): D1PreparedStatement;12324 batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;12325 exec(query: string): Promise<D1ExecResult>;12326 /**12327 * Creates a new D1 Session anchored at the given constraint or the bookmark.12328 * All queries executed using the created session will have sequential consistency,12329 * meaning that all writes done through the session will be visible in subsequent reads.12330 *12331 * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.12332 */12333 withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession;12334 /**12335 * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.12336 */12337 dump(): Promise<ArrayBuffer>;12338}12339declare abstract class D1DatabaseSession {12340 prepare(query: string): D1PreparedStatement;12341 batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;12342 /**12343 * @returns The latest session bookmark across all executed queries on the session.12344 * If no query has been executed yet, `null` is returned.12345 */12346 getBookmark(): D1SessionBookmark | null;12347}12348declare abstract class D1PreparedStatement {12349 bind(...values: unknown[]): D1PreparedStatement;12350 first<T = unknown>(colName: string): Promise<T | null>;12351 first<T = Record<string, unknown>>(): Promise<T | null>;12352 run<T = Record<string, unknown>>(): Promise<D1Result<T>>;12353 all<T = Record<string, unknown>>(): Promise<D1Result<T>>;12354 raw<T = unknown[]>(options: {12355 columnNames: true;12356 }): Promise<[12357 string[],12358 ...T[]12359 ]>;12360 raw<T = unknown[]>(options?: {12361 columnNames?: false;12362 }): Promise<T[]>;12363}12364// `Disposable` was added to TypeScript's standard lib types in version 5.2.12365// To support older TypeScript versions, define an empty `Disposable` interface.12366// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,12367// but this will ensure type checking on older versions still passes.12368// TypeScript's interface merging will ensure our empty interface is effectively12369// ignored when `Disposable` is included in the standard lib.12370interface Disposable {12371}12372/**12373 * The returned data after sending an email12374 */12375interface EmailSendResult {12376 /**12377 * The Email Message ID12378 */12379 messageId: string;12380}12381/**12382 * An email message that can be sent from a Worker.12383 */12384interface EmailMessage {12385 /**12386 * Envelope From attribute of the email message.12387 */12388 readonly from: string;12389 /**12390 * Envelope To attribute of the email message.12391 */12392 readonly to: string;12393}12394/**12395 * An email message that is sent to a consumer Worker and can be rejected/forwarded.12396 */12397interface ForwardableEmailMessage extends EmailMessage {12398 /**12399 * Stream of the email message content.12400 */12401 readonly raw: ReadableStream<Uint8Array>;12402 /**12403 * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).12404 */12405 readonly headers: Headers;12406 /**12407 * Size of the email message content.12408 */12409 readonly rawSize: number;12410 /**12411 * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.12412 * @param reason The reject reason.12413 * @returns void12414 */12415 setReject(reason: string): void;12416 /**12417 * Forward this email message to a verified destination address of the account.12418 * @param rcptTo Verified destination address.12419 * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).12420 * @returns A promise that resolves when the email message is forwarded.12421 */12422 forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;12423 /**12424 * Reply to the sender of this email message with a new EmailMessage object.12425 * @param message The reply message.12426 * @returns A promise that resolves when the email message is replied.12427 */12428 reply(message: EmailMessage): Promise<EmailSendResult>;12429 /**12430 * Reply to the sender of this email message with a message built from the given12431 * fields. Threading headers (In-Reply-To/References) are set automatically.12432 * @param builder The reply message contents.12433 * @returns A promise that resolves when the email message is replied.12434 */12435 reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;12436}12437/** A file attachment for an email message */12438type EmailAttachment = {12439 disposition: 'inline';12440 contentId: string;12441 filename: string;12442 type: string;12443 content: string | ArrayBuffer | ArrayBufferView;12444} | {12445 disposition: 'attachment';12446 contentId?: undefined;12447 filename: string;12448 type: string;12449 content: string | ArrayBuffer | ArrayBufferView;12450};12451/** An Email Address */12452interface EmailAddress {12453 name: string;12454 email: string;12455}12456/**12457 * Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or12458 * `bcc` must be provided.12459 */12460type EmailDestinations = {12461 to?: string | EmailAddress | (string | EmailAddress)[];12462 cc?: string | EmailAddress | (string | EmailAddress)[];12463 bcc?: string | EmailAddress | (string | EmailAddress)[];12464} & ({12465 to: string | EmailAddress | (string | EmailAddress)[];12466} | {12467 cc: string | EmailAddress | (string | EmailAddress)[];12468} | {12469 bcc: string | EmailAddress | (string | EmailAddress)[];12470});12471/**12472 * Fields shared by all composed emails (no recipients). Used directly by12473 * `ForwardableEmailMessage.reply()`, which always replies to the original12474 * sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.12475 */12476interface EmailReplyMessageBuilder {12477 from: string | EmailAddress;12478 subject: string;12479 replyTo?: string | EmailAddress;12480 headers?: Record<string, string>;12481 text?: string;12482 html?: string;12483 attachments?: EmailAttachment[];12484}12485/**12486 * Fields for composing an email without constructing raw MIME, for12487 * `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.12488 */12489type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;12490/**12491 * A binding that allows a Worker to send email messages.12492 */12493interface SendEmail {12494 send(message: EmailMessage): Promise<EmailSendResult>;12495 send(builder: EmailMessageBuilder): Promise<EmailSendResult>;12496}12497declare abstract class EmailEvent extends ExtendableEvent {12498 readonly message: ForwardableEmailMessage;12499}12500declare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;12501declare module "cloudflare:email" {12502 let _EmailMessage: {12503 prototype: EmailMessage;12504 new (from: string, to: string, raw: ReadableStream | string): EmailMessage;12505 };12506 export { _EmailMessage as EmailMessage };12507}12508/**12509 * Evaluation context for targeting rules.12510 * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.12511 */12512type FlagshipEvaluationContext = Record<string, string | number | boolean>;12513interface FlagshipEvaluationDetails<T> {12514 flagKey: string;12515 value: T;12516 variant?: string | undefined;12517 reason?: string | undefined;12518 errorCode?: string | undefined;12519 errorMessage?: string | undefined;12520}12521interface FlagshipEvaluationError extends Error {12522}12523/**12524 * Feature flags binding for evaluating feature flags from a Cloudflare Workers script.12525 *12526 * @example12527 * ```typescript12528 * // Get a boolean flag value with a default12529 * const enabled = await env.FLAGS.getBooleanValue('my-feature', false);12530 *12531 * // Get a flag value with evaluation context for targeting12532 * const variant = await env.FLAGS.getStringValue('experiment', 'control', {12533 * userId: 'user-123',12534 * country: 'US',12535 * });12536 *12537 * // Get full evaluation details including variant and reason12538 * const details = await env.FLAGS.getBooleanDetails('my-feature', false);12539 * console.log(details.variant, details.reason);12540 * ```12541 */12542declare abstract class Flagship {12543 /**12544 * Get a flag value without type checking.12545 * @param flagKey The key of the flag to evaluate.12546 * @param defaultValue Optional default value returned when evaluation fails.12547 * @param context Optional evaluation context for targeting rules.12548 */12549 get(flagKey: string, defaultValue?: unknown, context?: FlagshipEvaluationContext): Promise<unknown>;12550 /**12551 * Get a boolean flag value.12552 * @param flagKey The key of the flag to evaluate.12553 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12554 * @param context Optional evaluation context for targeting rules.12555 */12556 getBooleanValue(flagKey: string, defaultValue: boolean, context?: FlagshipEvaluationContext): Promise<boolean>;12557 /**12558 * Get a string flag value.12559 * @param flagKey The key of the flag to evaluate.12560 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12561 * @param context Optional evaluation context for targeting rules.12562 */12563 getStringValue(flagKey: string, defaultValue: string, context?: FlagshipEvaluationContext): Promise<string>;12564 /**12565 * Get a number flag value.12566 * @param flagKey The key of the flag to evaluate.12567 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12568 * @param context Optional evaluation context for targeting rules.12569 */12570 getNumberValue(flagKey: string, defaultValue: number, context?: FlagshipEvaluationContext): Promise<number>;12571 /**12572 * Get an object flag value.12573 * @param flagKey The key of the flag to evaluate.12574 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12575 * @param context Optional evaluation context for targeting rules.12576 */12577 getObjectValue<T extends object>(flagKey: string, defaultValue: T, context?: FlagshipEvaluationContext): Promise<T>;12578 /**12579 * Get a boolean flag value with full evaluation details.12580 * @param flagKey The key of the flag to evaluate.12581 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12582 * @param context Optional evaluation context for targeting rules.12583 */12584 getBooleanDetails(flagKey: string, defaultValue: boolean, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<boolean>>;12585 /**12586 * Get a string flag value with full evaluation details.12587 * @param flagKey The key of the flag to evaluate.12588 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12589 * @param context Optional evaluation context for targeting rules.12590 */12591 getStringDetails(flagKey: string, defaultValue: string, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<string>>;12592 /**12593 * Get a number flag value with full evaluation details.12594 * @param flagKey The key of the flag to evaluate.12595 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12596 * @param context Optional evaluation context for targeting rules.12597 */12598 getNumberDetails(flagKey: string, defaultValue: number, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<number>>;12599 /**12600 * Get an object flag value with full evaluation details.12601 * @param flagKey The key of the flag to evaluate.12602 * @param defaultValue Default value returned when evaluation fails or the flag type does not match.12603 * @param context Optional evaluation context for targeting rules.12604 */12605 getObjectDetails<T extends object>(flagKey: string, defaultValue: T, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<T>>;12606}12607/**12608 * Hello World binding to serve as an explanatory example. DO NOT USE12609 */12610interface HelloWorldBinding {12611 /**12612 * Retrieve the current stored value12613 */12614 get(): Promise<{12615 value: string;12616 ms?: number;12617 }>;12618 /**12619 * Set a new stored value12620 */12621 set(value: string): Promise<void>;12622}12623interface Hyperdrive {12624 /**12625 * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.12626 *12627 * Calling this method returns an identical socket to if you call12628 * `connect("host:port")` using the `host` and `port` fields from this object.12629 * Pick whichever approach works better with your preferred DB client library.12630 *12631 * Note that this socket is not yet authenticated -- it's expected that your12632 * code (or preferably, the client library of your choice) will authenticate12633 * using the information in this class's readonly fields.12634 */12635 connect(): Socket;12636 /**12637 * A valid DB connection string that can be passed straight into the typical12638 * client library/driver/ORM. This will typically be the easiest way to use12639 * Hyperdrive.12640 */12641 readonly connectionString: string;12642 /*12643 * A randomly generated hostname that is only valid within the context of the12644 * currently running Worker which, when passed into `connect()` function from12645 * the "cloudflare:sockets" module, will connect to the Hyperdrive instance12646 * for your database.12647 */12648 readonly host: string;12649 /*12650 * A synthetic IPv4 address (in the reserved 240.0.0.0/4 range) that, like the12651 * host field, is only valid within the context of the currently running12652 * Worker and, when passed into the `connect()` function from the12653 * "cloudflare:sockets" module, will connect to the Hyperdrive instance for12654 * your database. This is provided for database drivers that require the host12655 * to be an IP literal rather than a hostname.12656 */12657 readonly ip: string;12658 /*12659 * The port that must be paired the the host field when connecting.12660 */12661 readonly port: number;12662 /*12663 * The username to use when authenticating to your database via Hyperdrive.12664 * Unlike the host and password, this will be the same every time12665 */12666 readonly user: string;12667 /*12668 * The randomly generated password to use when authenticating to your12669 * database via Hyperdrive. Like the host field, this password is only valid12670 * within the context of the currently running Worker instance from which12671 * it's read.12672 */12673 readonly password: string;12674 /*12675 * The name of the database to connect to.12676 */12677 readonly database: string;12678}12679// Copyright (c) 2024 Cloudflare, Inc.12680// Licensed under the Apache 2.0 license found in the LICENSE file or at:12681// https://opensource.org/licenses/Apache-2.012682type ImageInfoResponse = {12683 format: 'image/svg+xml';12684} | {12685 format: string;12686 fileSize: number;12687 width: number;12688 height: number;12689};12690/**12691 * Parameters for rasterizing text into an image.12692 */12693type TextRasterize = {12694 /** The text content to render */12695 content: string;12696 /** rasterization options for the text **/12697 options: TextOptions;12698};12699type TextOptions = {12700 /** Font configuration */12701 font: {12702 /** URL to a font file in TrueType (.ttf), OpenType (.otf), WOFF (.woff), or WOFF2 (.woff2) format */12703 url: string;12704 };12705 /** Font size in points (pt) */12706 size?: number;12707 /** Text color in CSS format: hex (#RRGGBB or #RRGGBBAA), rgb(r,g,b), rgba(r,g,b,a), or named colors */12708 color?: string;12709};12710type ImageSource = ReadableStream<Uint8Array> | TextRasterize;12711type ImageTransform = {12712 width?: number;12713 height?: number;12714 background?: string;12715 blur?: number;12716 border?: {12717 color?: string;12718 width?: number;12719 } | {12720 top?: number;12721 bottom?: number;12722 left?: number;12723 right?: number;12724 };12725 brightness?: number;12726 contrast?: number;12727 fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop';12728 flip?: 'h' | 'v' | 'hv';12729 gamma?: number;12730 segment?: 'foreground';12731 gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {12732 x?: number;12733 y?: number;12734 mode: 'remainder' | 'box-center';12735 };12736 rotate?: 0 | 90 | 180 | 270;12737 saturation?: number;12738 sharpen?: number;12739 trim?: 'border' | {12740 top?: number;12741 bottom?: number;12742 left?: number;12743 right?: number;12744 width?: number;12745 height?: number;12746 border?: boolean | {12747 color?: string;12748 tolerance?: number;12749 keep?: number;12750 };12751 };12752};12753type ImageDrawOptions = {12754 opacity?: number;12755 repeat?: boolean | string;12756 composite?: ImageCompositeMode;12757 top?: number;12758 left?: number;12759 bottom?: number;12760 right?: number;12761};12762type ImageCompositeMode =12763/** Foreground drawn on top of backdrop (default) */12764'over'12765/** Foreground shown only where backdrop is opaque */12766 | 'in'12767/** Foreground drawn on top, but clipped to the backdrop's shape */12768 | 'atop'12769/** Foreground shown only where backdrop is transparent */12770 | 'out'12771/** Foreground and backdrop visible only where the other is not */12772 | 'xor'12773/** Foreground and backdrop channels added (brightening) */12774 | 'lighter';12775type ImageInputOptions = {12776 encoding?: 'base64';12777};12778type ImageOutputOptions = {12779 format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba';12780 quality?: number;12781 background?: string;12782 anim?: boolean;12783};12784interface ImageMetadata {12785 id: string;12786 filename?: string;12787 uploaded?: string;12788 requireSignedURLs: boolean;12789 meta?: Record<string, unknown>;12790 variants: string[];12791 draft?: boolean;12792 creator?: string;12793}12794interface ImageUploadOptions {12795 id?: string;12796 filename?: string;12797 requireSignedURLs?: boolean;12798 metadata?: Record<string, unknown>;12799 creator?: string;12800 /**12801 * If 'base64', the input data will be decoded from base64 before processing12802 */12803 encoding?: 'base64';12804}12805interface ImageUpdateOptions {12806 requireSignedURLs?: boolean;12807 metadata?: Record<string, unknown>;12808 creator?: string;12809}12810type ImageMetadataFilterOperators = {12811 eq?: string | number | boolean;12812 in?: string[] | number[];12813 gt?: number;12814 gte?: number;12815 lt?: number;12816 lte?: number;12817};12818type ImageMetadataFilterValue = string | number | boolean | ImageMetadataFilterOperators;12819interface ImageListFilter {12820 metadata?: Record<string, ImageMetadataFilterValue>;12821}12822interface ImageListOptions {12823 limit?: number;12824 cursor?: string;12825 sortOrder?: 'asc' | 'desc';12826 creator?: string;12827 filter?: ImageListFilter;12828}12829interface ImageSignedUrlOptions {12830 variant: string;12831 expiresIn?: number;12832 keyName?: string;12833}12834interface ImageDirectUploadOptions {12835 id?: string;12836 requireSignedURLs?: boolean;12837 metadata?: Record<string, unknown>;12838 creator?: string;12839 expiresIn?: number;12840}12841interface ImageDirectUploadResult {12842 id: string;12843 uploadURL: string;12844}12845interface ImageList {12846 images: ImageMetadata[];12847 cursor?: string;12848 listComplete: boolean;12849}12850interface ImageHandle {12851 /**12852 * Get metadata for a hosted image12853 * @returns Image metadata, or null if not found12854 */12855 details(): Promise<ImageMetadata | null>;12856 /**12857 * Get the raw image data for a hosted image12858 * @returns ReadableStream of image bytes, or null if not found12859 */12860 bytes(): Promise<ReadableStream<Uint8Array> | null>;12861 /**12862 * Generate a signed delivery URL for this hosted image.12863 * @param options Signing configuration12864 * @returns A signed image delivery URL12865 * @throws {@link ImagesError} if signing fails12866 */12867 signedUrl(options: ImageSignedUrlOptions): Promise<string>;12868 /**12869 * Update hosted image metadata12870 * @param options Properties to update12871 * @returns Updated image metadata12872 * @throws {@link ImagesError} if update fails12873 */12874 update(options: ImageUpdateOptions): Promise<ImageMetadata>;12875 /**12876 * Delete a hosted image12877 * @returns True if deleted, false if not found12878 */12879 delete(): Promise<boolean>;12880}12881interface HostedImagesBinding {12882 /**12883 * Get a handle for a hosted image12884 * @param imageId The ID of the image (UUID or custom ID)12885 * @returns A handle for per-image operations12886 */12887 image(imageId: string): ImageHandle;12888 /**12889 * Upload a new hosted image12890 * @param image The image file to upload12891 * @param options Upload configuration12892 * @returns Metadata for the uploaded image12893 * @throws {@link ImagesError} if upload fails12894 */12895 upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;12896 /**12897 * List hosted images with pagination12898 * @param options List configuration12899 * @returns List of images with pagination info12900 * @throws {@link ImagesError} if list fails12901 */12902 list(options?: ImageListOptions): Promise<ImageList>;12903 /**12904 * Create a Direct Creator Upload link, letting an end user upload an12905 * image straight to Cloudflare without exposing an API token12906 * @param options Upload link configuration12907 * @returns The new image ID and the upload URL to hand to the end user12908 * @throws {@link ImagesError} if creation fails12909 */12910 createDirectUpload(options?: ImageDirectUploadOptions): Promise<ImageDirectUploadResult>;12911}12912interface ImagesBinding {12913 /**12914 * Get image metadata (type, width and height)12915 * @throws {@link ImagesError} with code 9412 if input is not an image12916 * @param stream The image bytes12917 */12918 info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>;12919 /**12920 * Begin applying a series of transformations to an image12921 * @param stream The image bytes12922 * @returns A transform handle12923 */12924 input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;12925 /**12926 * Begin applying a series of transformations to text12927 * @param content string to be rendered12928 * @param options font, optional color and size to use in rendering text12929 * @returns A transform handle12930 */12931 text(content: string, options: TextOptions): ImageTransformer;12932 /**12933 * Access hosted images CRUD operations12934 */12935 readonly hosted: HostedImagesBinding;12936}12937interface ImageTransformer {12938 /**12939 * Apply transform next, returning a transform handle.12940 * You can then apply more transformations, draw, or retrieve the output.12941 * @param transform12942 */12943 transform(transform: ImageTransform): ImageTransformer;12944 /**12945 * Draw an image on this transformer, returning a transform handle.12946 * You can then apply more transformations, draw, or retrieve the output.12947 * @param image The image (or transformer that will give the image) to draw12948 * @param options The options configuring how to draw the image12949 */12950 draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer;12951 /**12952 * Retrieve the image that results from applying the transforms to the12953 * provided input12954 * @param options Options that apply to the output e.g. output format12955 */12956 output(options: ImageOutputOptions): Promise<ImageTransformationResult>;12957}12958type ImageTransformationOutputOptions = {12959 encoding?: 'base64';12960};12961type ImageTransformationResponseOptions = {12962 headers?: HeadersInit;12963};12964interface ImageTransformationResult {12965 /**12966 * The image as a response, ready to store in cache or return to users12967 * @param options Options that apply to the returned response, e.g. additional headers12968 */12969 response(options?: ImageTransformationResponseOptions): Response;12970 /**12971 * The content type of the returned image12972 */12973 contentType(): string;12974 /**12975 * The bytes of the response12976 */12977 image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>;12978}12979interface ImagesError extends Error {12980 readonly code: number;12981 readonly message: string;12982 readonly stack?: string;12983}12984/**12985 * Media binding for transforming media streams.12986 * Provides the entry point for media transformation operations.12987 */12988interface MediaBinding {12989 /**12990 * Creates a media transformer from an input stream.12991 * @param media - The input media bytes12992 * @returns A MediaTransformer instance for applying transformations12993 */12994 input(media: ReadableStream<Uint8Array>): MediaTransformer;12995}12996/**12997 * Media transformer for applying transformation operations to media content.12998 * Handles sizing, fitting, and other input transformation parameters.12999 */13000interface MediaTransformer {13001 /**13002 * Applies transformation options to the media content.13003 * @param transform - Configuration for how the media should be transformed13004 * @returns A generator for producing the transformed media output13005 */13006 transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;13007 /**13008 * Generates the final media output with specified options.13009 * @param output - Configuration for the output format and parameters13010 * @returns The final transformation result containing the transformed media13011 */13012 output(output?: MediaTransformationOutputOptions): MediaTransformationResult;13013}13014/**13015 * Generator for producing media transformation results.13016 * Configures the output format and parameters for the transformed media.13017 */13018interface MediaTransformationGenerator {13019 /**13020 * Generates the final media output with specified options.13021 * @param output - Configuration for the output format and parameters13022 * @returns The final transformation result containing the transformed media13023 */13024 output(output?: MediaTransformationOutputOptions): MediaTransformationResult;13025}13026/**13027 * Result of a media transformation operation.13028 * Provides multiple ways to access the transformed media content.13029 */13030interface MediaTransformationResult {13031 /**13032 * Returns the transformed media as a readable stream of bytes.13033 * @returns A promise containing a readable stream with the transformed media13034 */13035 media(): Promise<ReadableStream<Uint8Array>>;13036 /**13037 * Returns the transformed media as an HTTP response object.13038 * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users13039 */13040 response(): Promise<Response>;13041 /**13042 * Returns the MIME type of the transformed media.13043 * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')13044 */13045 contentType(): Promise<string>;13046}13047/**13048 * Configuration options for transforming media input.13049 * Controls how the media should be resized and fitted.13050 */13051type MediaTransformationInputOptions = {13052 /** How the media should be resized to fit the specified dimensions */13053 fit?: 'contain' | 'cover' | 'scale-down';13054 /** Target width in pixels */13055 width?: number;13056 /** Target height in pixels */13057 height?: number;13058};13059/**13060 * Configuration options for Media Transformations output.13061 * Controls the format, timing, and type of the generated output.13062 */13063type MediaTransformationOutputOptions = {13064 /**13065 * Output mode determining the type of media to generate13066 */13067 mode?: 'video' | 'spritesheet' | 'frame' | 'audio';13068 /** Whether to include audio in the output */13069 audio?: boolean;13070 /**13071 * Starting timestamp for frame extraction or start time for clips. (e.g. '2s').13072 */13073 time?: string;13074 /**13075 * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').13076 */13077 duration?: string;13078 /**13079 * Number of frames in the spritesheet.13080 */13081 imageCount?: number;13082 /**13083 * Output format for the generated media.13084 */13085 format?: 'jpg' | 'png' | 'm4a';13086};13087/**13088 * Error object for media transformation operations.13089 * Extends the standard Error interface with additional media-specific information.13090 */13091interface MediaError extends Error {13092 readonly code: number;13093 readonly message: string;13094 readonly stack?: string;13095}13096declare module 'cloudflare:node' {13097 interface NodeStyleServer {13098 listen(...args: unknown[]): this;13099 address(): {13100 port?: number | null | undefined;13101 };13102 }13103 export function httpServerHandler(port: number): ExportedHandler;13104 export function httpServerHandler(options: {13105 port: number;13106 }): ExportedHandler;13107 export function httpServerHandler(server: NodeStyleServer): ExportedHandler;13108}13109type Params<P extends string = any> = Record<P, string | string[]>;13110type EventContext<Env, P extends string, Data> = {13111 request: Request<unknown, IncomingRequestCfProperties<unknown>>;13112 functionPath: string;13113 waitUntil: (promise: Promise<any>) => void;13114 passThroughOnException: () => void;13115 next: (input?: Request | string, init?: RequestInit) => Promise<Response>;13116 env: Env & {13117 ASSETS: {13118 fetch: typeof fetch;13119 };13120 };13121 params: Params<P>;13122 data: Data;13123};13124type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;13125type EventPluginContext<Env, P extends string, Data, PluginArgs> = {13126 request: Request<unknown, IncomingRequestCfProperties<unknown>>;13127 functionPath: string;13128 waitUntil: (promise: Promise<any>) => void;13129 passThroughOnException: () => void;13130 next: (input?: Request | string, init?: RequestInit) => Promise<Response>;13131 env: Env & {13132 ASSETS: {13133 fetch: typeof fetch;13134 };13135 };13136 params: Params<P>;13137 data: Data;13138 pluginArgs: PluginArgs;13139};13140type 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>;13141declare module "assets:*" {13142 export const onRequest: PagesFunction;13143}13144// Copyright (c) 2022-2023 Cloudflare, Inc.13145// Licensed under the Apache 2.0 license found in the LICENSE file or at:13146// https://opensource.org/licenses/Apache-2.013147declare module "cloudflare:pipelines" {13148 export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> {13149 protected env: Env;13150 protected ctx: ExecutionContext;13151 constructor(ctx: ExecutionContext, env: Env);13152 /**13153 * run receives an array of PipelineRecord which can be13154 * transformed and returned to the pipeline13155 * @param records Incoming records from the pipeline to be transformed13156 * @param metadata Information about the specific pipeline calling the transformation entrypoint13157 * @returns A promise containing the transformed PipelineRecord array13158 */13159 public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;13160 }13161 export type PipelineRecord = Record<string, unknown>;13162 export type PipelineBatchMetadata = {13163 pipelineId: string;13164 pipelineName: string;13165 };13166 export interface Pipeline<T extends PipelineRecord = PipelineRecord> {13167 /**13168 * The Pipeline interface represents the type of a binding to a Pipeline13169 *13170 * @param records The records to send to the pipeline13171 */13172 send(records: T[]): Promise<void>;13173 }13174}13175// PubSubMessage represents an incoming PubSub message.13176// The message includes metadata about the broker, the client, and the payload13177// itself.13178// https://developers.cloudflare.com/pub-sub/13179interface PubSubMessage {13180 // Message ID13181 readonly mid: number;13182 // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT13183 readonly broker: string;13184 // The MQTT topic the message was sent on.13185 readonly topic: string;13186 // The client ID of the client that published this message.13187 readonly clientId: string;13188 // The unique identifier (JWT ID) used by the client to authenticate, if token13189 // auth was used.13190 readonly jti?: string;13191 // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker13192 // received the message from the client.13193 readonly receivedAt: number;13194 // An (optional) string with the MIME type of the payload, if set by the13195 // client.13196 readonly contentType: string;13197 // Set to 1 when the payload is a UTF-8 string13198 // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc390106313199 readonly payloadFormatIndicator: number;13200 // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.13201 // You can use payloadFormatIndicator to inspect this before decoding.13202 payload: string | Uint8Array;13203}13204// JsonWebKey extended by kid parameter13205interface JsonWebKeyWithKid extends JsonWebKey {13206 // Key Identifier of the JWK13207 readonly kid: string;13208}13209interface RateLimitOptions {13210 key: string;13211}13212interface RateLimitOutcome {13213 success: boolean;13214}13215interface RateLimit {13216 /**13217 * Rate limit a request based on the provided options.13218 * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/13219 * @returns A promise that resolves with the outcome of the rate limit.13220 */13221 limit(options: RateLimitOptions): Promise<RateLimitOutcome>;13222}13223// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need13224// to referenced by `Fetcher`. This is included in the "importable" version of the types which13225// strips all `module` blocks.13226declare namespace Rpc {13227 // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.13228 // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.13229 // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to13230 // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)13231 export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND';13232 export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND';13233 export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND';13234 export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND';13235 export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND';13236 export interface RpcTargetBranded {13237 [__RPC_TARGET_BRAND]: never;13238 }13239 export interface WorkerEntrypointBranded {13240 [__WORKER_ENTRYPOINT_BRAND]: never;13241 }13242 export interface DurableObjectBranded {13243 [__DURABLE_OBJECT_BRAND]: never;13244 }13245 export interface WorkflowEntrypointBranded {13246 [__WORKFLOW_ENTRYPOINT_BRAND]: never;13247 }13248 export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded;13249 // Types that can be used through `Stub`s13250 export type Stubable = RpcTargetBranded | ((...args: any[]) => any);13251 // Types that can be passed over RPC13252 // The reason for using a generic type here is to build a serializable subset of structured13253 // cloneable composite types. This allows types defined with the "interface" keyword to pass the13254 // serializable check as well. Otherwise, only types defined with the "type" keyword would pass.13255 type Serializable<T> =13256 // Structured cloneables13257 BaseType13258 // Structured cloneable composites13259 | 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> | {13260 [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;13261 }13262 // Special types13263 | Stub<Stubable>13264 // Serialized as stubs, see `Stubify`13265 | Stubable;13266 // Base type for all RPC stubs, including common memory management methods.13267 // `T` is used as a marker type for unwrapping `Stub`s later.13268 interface StubBase<T extends Stubable> extends Disposable {13269 [__RPC_STUB_BRAND]: T;13270 dup(): this;13271 }13272 export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;13273 // This represents all the types that can be sent as-is over an RPC boundary13274 type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;13275 // Recursively rewrite all `Stubable` types with `Stub`s13276 // prettier-ignore13277 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 {13278 [key: string | number]: any;13279 } ? {13280 [K in keyof T]: Stubify<T[K]>;13281 } : T;13282 // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.13283 // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:13284 // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.13285 // prettier-ignore13286 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 {13287 [key: string | number]: unknown;13288 } ? {13289 [K in keyof T]: Unstubify<T[K]>;13290 } : T;13291 type UnstubifyAll<A extends any[]> = {13292 [I in keyof A]: Unstubify<A[I]>;13293 };13294 // Utility type for adding `Provider`/`Disposable`s to `object` types only.13295 // Note `unknown & T` is equivalent to `T`.13296 type MaybeProvider<T> = T extends object ? Provider<T> : unknown;13297 type MaybeDisposable<T> = T extends object ? Disposable : unknown;13298 // Type for method return or property on an RPC interface.13299 // - Stubable types are replaced by stubs.13300 // - Serializable types are passed by value, with stubable types replaced by stubs13301 // and a top-level `Disposer`.13302 // Everything else can't be passed over PRC.13303 // Technically, we use custom thenables here, but they quack like `Promise`s.13304 // Intersecting with `(Maybe)Provider` allows pipelining.13305 // prettier-ignore13306 type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never;13307 // Type for method or property on an RPC interface.13308 // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.13309 // Unwrapping `Stub`s allows calling with `Stubable` arguments.13310 // For properties, rewrite types to be `Result`s.13311 // In each case, unwrap `Promise`s.13312 type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>;13313 // Type for the callable part of an `Provider` if `T` is callable.13314 // This is intersected with methods/properties.13315 type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown;13316 // Base type for all other types providing RPC-like interfaces.13317 // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.13318 // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.13319 export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{13320 [K in keyof T]: MethodOrProperty<T[K]>;13321 }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>;13322}13323declare namespace Cloudflare {13324 // Type of `env`.13325 //13326 // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript13327 // will merge all declarations.13328 //13329 // You can use `wrangler types` to generate the `Env` type automatically.13330 interface Env {13331 }13332 // Project-specific parameters used to inform types.13333 //13334 // This interface is, again, intended to be declared in project-specific files, and then that13335 // declaration will be merged with this one.13336 //13337 // A project should have a declaration like this:13338 //13339 // interface GlobalProps {13340 // // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type13341 // // of `ctx.exports`.13342 // mainModule: typeof import("my-main-module");13343 //13344 // // Declares which of the main module's exports are configured with durable storage, and13345 // // thus should behave as Durable Object namsepace bindings.13346 // durableNamespaces: "MyDurableObject" | "AnotherDurableObject";13347 // }13348 //13349 // You can use `wrangler types` to generate `GlobalProps` automatically.13350 interface GlobalProps {13351 }13352 // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not13353 // present.13354 type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default;13355 // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the13356 // `mainModule` property.13357 type MainModule = GlobalProp<"mainModule", {}>;13358 // The type of ctx.exports, which contains loopback bindings for all top-level exports.13359 type Exports = {13360 [K in keyof MainModule]: LoopbackForExport<MainModule[K]>13361 // If the export is listed in `durableNamespaces`, then it is also a13362 // DurableObjectNamespace.13363 & (K extends GlobalProp<"durableNamespaces", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {});13364 };13365}13366declare namespace CloudflareWorkersModule {13367 export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;13368 export const RpcStub: {13369 new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;13370 };13371 export abstract class RpcTarget implements Rpc.RpcTargetBranded {13372 [Rpc.__RPC_TARGET_BRAND]: never;13373 }13374 // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC13375 export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded {13376 [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;13377 protected ctx: ExecutionContext<Props>;13378 protected env: Env;13379 constructor(ctx: ExecutionContext, env: Env);13380 email?(message: ForwardableEmailMessage): void | Promise<void>;13381 fetch?(request: Request): Response | Promise<Response>;13382 connect?(socket: Socket): void | Promise<void>;13383 queue?(batch: MessageBatch): void | Promise<void>;13384 scheduled?(controller: ScheduledController): void | Promise<void>;13385 tail?(events: TraceItem[]): void | Promise<void>;13386 tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;13387 test?(controller: TestController): void | Promise<void>;13388 trace?(traces: TraceItem[]): void | Promise<void>;13389 }13390 export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {13391 [Rpc.__DURABLE_OBJECT_BRAND]: never;13392 protected ctx: DurableObjectState<Props>;13393 protected env: Env;13394 constructor(ctx: DurableObjectState, env: Env);13395 alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;13396 fetch?(request: Request): Response | Promise<Response>;13397 connect?(socket: Socket): void | Promise<void>;13398 webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;13399 webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;13400 webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;13401 }13402 export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';13403 export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;13404 export type WorkflowDelayDuration = WorkflowSleepDuration;13405 export type WorkflowDynamicDelayContext = {13406 ctx: WorkflowStepContext<WorkflowDelayFunction>;13407 error: Error;13408 };13409 export type WorkflowDelayFunction = (input: WorkflowDynamicDelayContext) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;13410 export type WorkflowTimeoutDuration = WorkflowSleepDuration;13411 export type WorkflowRetentionDuration = WorkflowSleepDuration;13412 export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';13413 export type WorkflowStepSensitivity = 'output';13414 export type WorkflowStepConfig = {13415 retries?: {13416 limit: number;13417 delay: WorkflowDelayDuration | number | WorkflowDelayFunction;13418 backoff?: WorkflowBackoff;13419 };13420 timeout?: WorkflowTimeoutDuration | number;13421 sensitive?: WorkflowStepSensitivity;13422 };13423 // Internal discriminators used only for `WorkflowStep.do` overload13424 // resolution. They mirror `WorkflowStepConfig` but pin `retries.delay` to a13425 // single kind so the callback context can be narrowed based on the shape of13426 // the config argument (rather than on an inferred type parameter, which is13427 // lost when the caller supplies an explicit return-type argument). Not13428 // exported: they must not widen the public type surface.13429 type WorkflowStepConfigWithStaticDelay = Omit<WorkflowStepConfig, 'retries'> & {13430 retries?: {13431 limit: number;13432 delay: WorkflowDelayDuration | number;13433 backoff?: WorkflowBackoff;13434 };13435 };13436 type WorkflowStepConfigWithDelayFunction = Omit<WorkflowStepConfig, 'retries'> & {13437 retries: {13438 limit: number;13439 delay: WorkflowDelayFunction;13440 backoff?: WorkflowBackoff;13441 };13442 };13443 export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;13444 export type WorkflowCronSchedule = {13445 /** Cron expression that triggered this event. */13446 cron: string;13447 /** Timestamp of the scheduled trigger, in milliseconds since the Unix epoch. */13448 scheduledTime: number;13449 };13450 export type WorkflowEvent<T> = {13451 payload: Readonly<T>;13452 timestamp: Date;13453 instanceId: string;13454 workflowName: string;13455 schedule?: WorkflowCronSchedule;13456 };13457 export type WorkflowStepEvent<T> = {13458 payload: Readonly<T>;13459 timestamp: Date;13460 type: string;13461 sensitive?: WorkflowStepSensitivity;13462 };13463 export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {13464 step: {13465 name: string;13466 count: number;13467 };13468 attempt: number;13469 config: {13470 retries?: {13471 limit: number;13472 backoff?: WorkflowBackoff;13473 } & (Delay extends WorkflowDelayFunction ? {} : {13474 delay: WorkflowDelayDuration | number;13475 });13476 timeout?: WorkflowTimeoutDuration | number;13477 sensitive?: WorkflowStepSensitivity;13478 };13479 };13480 // The rollback handler receives the step context, so it mirrors the same13481 // delay discriminant as the step callback: when the step was configured with13482 // a dynamic delay function the resolved `config.retries.delay` is omitted,13483 // otherwise it is present. `Delay` is threaded from the `WorkflowStep.do`13484 // overload that matched the step config.13485 export type WorkflowRollbackContext<T = unknown, Delay = WorkflowDelayDuration | number> = {13486 ctx: WorkflowStepContext<Delay>;13487 error: Error;13488 output: T | undefined;13489 /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */13490 stepName: string;13491 };13492 export type WorkflowRollbackHandler<T = unknown, Delay = WorkflowDelayDuration | number> = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;13493 export type WorkflowStepRollbackOptions<T = unknown, Delay = WorkflowDelayDuration | number> = {13494 rollback: WorkflowRollbackHandler<T, Delay>;13495 rollbackConfig?: WorkflowStepRollbackConfig;13496 };13497 export abstract class WorkflowStep {13498 do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;13499 // The config overloads discriminate on the shape of `config.retries.delay`13500 // so the callback context reflects whether the resolved delay is present13501 // (static delay) or omitted (dynamic delay function). Each has a single13502 // type parameter, so an explicit return-type argument (`do<T>(...)`) still13503 // resolves here. ORDERING IS LOAD-BEARING: the broad `WorkflowStepConfig`13504 // fallback MUST remain last, otherwise it shadows the discriminating13505 // overloads and narrowing is silently lost.13506 do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>): Promise<T>;13507 do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext<WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayDuration | number>): Promise<T>;13508 do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;13509 sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;13510 sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;13511 waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {13512 type: string;13513 timeout?: WorkflowTimeoutDuration | number;13514 }): Promise<WorkflowStepEvent<T>>;13515 }13516 export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown';13517 export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded {13518 [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;13519 protected ctx: ExecutionContext;13520 protected env: Env;13521 constructor(ctx: ExecutionContext, env: Env);13522 run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;13523 }13524 export function waitUntil(promise: Promise<unknown>): void;13525 export function withEnv(newEnv: unknown, fn: () => unknown): unknown;13526 export function withExports(newExports: unknown, fn: () => unknown): unknown;13527 export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown;13528 export const env: Cloudflare.Env;13529 export const exports: Cloudflare.Exports;13530 export const cache: CacheContext;13531 export const tracing: Tracing;13532}13533declare module 'cloudflare:workers' {13534 export = CloudflareWorkersModule;13535}13536interface SecretsStoreSecret {13537 /**13538 * Get a secret from the Secrets Store, returning a string of the secret value13539 * if it exists, or throws an error if it does not exist13540 */13541 get(): Promise<string>;13542}13543declare module "cloudflare:sockets" {13544 function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;13545 export { _connect as connect };13546}13547/**13548 * Binding entrypoint for Cloudflare Stream.13549 *13550 * Usage:13551 * - Binding-level operations:13552 * `await env.STREAM.videos.upload`13553 * `await env.STREAM.videos.createDirectUpload`13554 * `await env.STREAM.videos.*`13555 * `await env.STREAM.watermarks.*`13556 * - Per-video operations:13557 * `await env.STREAM.video(id).downloads.*`13558 * `await env.STREAM.video(id).captions.*`13559 *13560 * Example usage:13561 * ```ts13562 * await env.STREAM.video(id).downloads.generate();13563 *13564 * const video = env.STREAM.video(id)13565 * const captions = video.captions.list();13566 * const videoDetails = video.details()13567 * ```13568 */13569interface StreamBinding {13570 /**13571 * Returns a handle scoped to a single video for per-video operations.13572 * @param id The unique identifier for the video.13573 * @returns A handle for per-video operations.13574 */13575 video(id: string): StreamVideoHandle;13576 /**13577 * Uploads a new video from a provided URL.13578 * @param url The URL to upload from.13579 * @param params Optional upload parameters.13580 * @returns The uploaded video details.13581 * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid13582 * @throws {QuotaReachedError} if the account storage capacity is exceeded13583 * @throws {MaxFileSizeError} if the file size is too large13584 * @throws {RateLimitedError} if the server received too many requests13585 * @throws {AlreadyUploadedError} if a video was already uploaded to this URL13586 * @throws {InternalError} if an unexpected error occurs13587 */13588 upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;13589 /**13590 * Creates a direct upload that allows video uploads without an API key.13591 * @param params Parameters for the direct upload13592 * @returns The direct upload details.13593 * @throws {BadRequestError} if the parameters are invalid13594 * @throws {RateLimitedError} if the server received too many requests13595 * @throws {InternalError} if an unexpected error occurs13596 */13597 createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;13598 videos: StreamVideos;13599 watermarks: StreamWatermarks;13600}13601/**13602 * Handle for operations scoped to a single Stream video.13603 */13604interface StreamVideoHandle {13605 /**13606 * The unique identifier for the video.13607 */13608 id: string;13609 /**13610 * Get a full videos details13611 * @returns The full video details.13612 * @throws {NotFoundError} if the video is not found13613 * @throws {InternalError} if an unexpected error occurs13614 */13615 details(): Promise<StreamVideo>;13616 /**13617 * Update details for a single video.13618 * @param params The fields to update for the video.13619 * @returns The updated video details.13620 * @throws {NotFoundError} if the video is not found13621 * @throws {BadRequestError} if the parameters are invalid13622 * @throws {InternalError} if an unexpected error occurs13623 */13624 update(params: StreamUpdateVideoParams): Promise<StreamVideo>;13625 /**13626 * Deletes a video and its copies from Cloudflare Stream.13627 * @returns A promise that resolves when deletion completes.13628 * @throws {NotFoundError} if the video is not found13629 * @throws {InternalError} if an unexpected error occurs13630 */13631 delete(): Promise<void>;13632 /**13633 * Creates a signed URL token for a video.13634 * @returns The signed token that was created.13635 * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed13636 */13637 generateToken(): Promise<string>;13638 downloads: StreamScopedDownloads;13639 captions: StreamScopedCaptions;13640}13641interface StreamVideo {13642 /**13643 * The unique identifier for the video.13644 */13645 id: string;13646 /**13647 * A user-defined identifier for the media creator.13648 */13649 creator: string | null;13650 /**13651 * The thumbnail URL for the video.13652 */13653 thumbnail: string;13654 /**13655 * The thumbnail timestamp percentage.13656 */13657 thumbnailTimestampPct: number;13658 /**13659 * Indicates whether the video is ready to stream.13660 */13661 readyToStream: boolean;13662 /**13663 * The date and time the video became ready to stream.13664 */13665 readyToStreamAt: string | null;13666 /**13667 * Processing status information.13668 */13669 status: StreamVideoStatus;13670 /**13671 * A user modifiable key-value store.13672 */13673 meta: Record<string, string>;13674 /**13675 * The date and time the video was created.13676 */13677 created: string;13678 /**13679 * The date and time the video was last modified.13680 */13681 modified: string;13682 /**13683 * The date and time at which the video will be deleted.13684 */13685 scheduledDeletion: string | null;13686 /**13687 * The size of the video in bytes.13688 */13689 size: number;13690 /**13691 * The preview URL for the video.13692 */13693 preview?: string;13694 /**13695 * Origins allowed to display the video.13696 */13697 allowedOrigins: Array<string>;13698 /**13699 * Indicates whether signed URLs are required.13700 */13701 requireSignedURLs: boolean | null;13702 /**13703 * The date and time the video was uploaded.13704 */13705 uploaded: string | null;13706 /**13707 * The date and time when the upload URL expires.13708 */13709 uploadExpiry: string | null;13710 /**13711 * The maximum size in bytes for direct uploads.13712 */13713 maxSizeBytes: number | null;13714 /**13715 * The maximum duration in seconds for direct uploads.13716 */13717 maxDurationSeconds: number | null;13718 /**13719 * The video duration in seconds. -1 indicates unknown.13720 */13721 duration: number;13722 /**13723 * Input metadata for the original upload.13724 */13725 input: StreamVideoInput;13726 /**13727 * Playback URLs for the video.13728 */13729 hlsPlaybackUrl: string;13730 dashPlaybackUrl: string;13731 /**13732 * The watermark applied to the video, if any.13733 */13734 watermark: StreamWatermark | null;13735 /**13736 * The live input id associated with the video, if any.13737 */13738 liveInputId?: string | null;13739 /**13740 * The source video id if this is a clip.13741 */13742 clippedFromId: string | null;13743 /**13744 * Public details associated with the video.13745 */13746 publicDetails: StreamPublicDetails | null;13747}13748type StreamVideoStatus = {13749 /**13750 * The current processing state.13751 */13752 state: string;13753 /**13754 * The current processing step.13755 */13756 step?: string;13757 /**13758 * The percent complete as a string.13759 */13760 pctComplete?: string;13761 /**13762 * An error reason code, if applicable.13763 */13764 errorReasonCode: string;13765 /**13766 * An error reason text, if applicable.13767 */13768 errorReasonText: string;13769};13770type StreamVideoInput = {13771 /**13772 * The input width in pixels.13773 */13774 width: number;13775 /**13776 * The input height in pixels.13777 */13778 height: number;13779};13780type StreamPublicDetails = {13781 /**13782 * The public title for the video.13783 */13784 title: string | null;13785 /**13786 * The public share link.13787 */13788 share_link: string | null;13789 /**13790 * The public channel link.13791 */13792 channel_link: string | null;13793 /**13794 * The public logo URL.13795 */13796 logo: string | null;13797};13798type StreamDirectUpload = {13799 /**13800 * The URL an unauthenticated upload can use for a single multipart request.13801 */13802 uploadURL: string;13803 /**13804 * A Cloudflare-generated unique identifier for a media item.13805 */13806 id: string;13807 /**13808 * The watermark profile applied to the upload.13809 */13810 watermark: StreamWatermark | null;13811 /**13812 * The scheduled deletion time, if any.13813 */13814 scheduledDeletion: string | null;13815};13816type StreamDirectUploadCreateParams = {13817 /**13818 * The maximum duration in seconds for a video upload.13819 */13820 maxDurationSeconds: number;13821 /**13822 * The date and time after upload when videos will not be accepted.13823 */13824 expiry?: string;13825 /**13826 * A user-defined identifier for the media creator.13827 */13828 creator?: string;13829 /**13830 * A user modifiable key-value store used to reference other systems of record for13831 * managing videos.13832 */13833 meta?: Record<string, string>;13834 /**13835 * Lists the origins allowed to display the video.13836 */13837 allowedOrigins?: Array<string>;13838 /**13839 * Indicates whether the video can be accessed using the id. When set to `true`,13840 * a signed token must be generated with a signing key to view the video.13841 */13842 requireSignedURLs?: boolean;13843 /**13844 * The thumbnail timestamp percentage.13845 */13846 thumbnailTimestampPct?: number;13847 /**13848 * The date and time at which the video will be deleted. Include `null` to remove13849 * a scheduled deletion.13850 */13851 scheduledDeletion?: string | null;13852 /**13853 * The watermark profile to apply.13854 */13855 watermark?: StreamDirectUploadWatermark;13856};13857type StreamDirectUploadWatermark = {13858 /**13859 * The unique identifier for the watermark profile.13860 */13861 id: string;13862};13863type StreamUrlUploadParams = {13864 /**13865 * Lists the origins allowed to display the video. Enter allowed origin13866 * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the13867 * video to be viewed on any origin.13868 */13869 allowedOrigins?: Array<string>;13870 /**13871 * A user-defined identifier for the media creator.13872 */13873 creator?: string;13874 /**13875 * A user modifiable key-value store used to reference other systems of13876 * record for managing videos.13877 */13878 meta?: Record<string, string>;13879 /**13880 * Indicates whether the video can be a accessed using the id. When13881 * set to `true`, a signed token must be generated with a signing key to view the13882 * video.13883 */13884 requireSignedURLs?: boolean;13885 /**13886 * Indicates the date and time at which the video will be deleted. Omit13887 * the field to indicate no change, or include with a `null` value to remove an13888 * existing scheduled deletion. If specified, must be at least 30 days from upload13889 * time.13890 */13891 scheduledDeletion?: string | null;13892 /**13893 * The timestamp for a thumbnail image calculated as a percentage value13894 * of the video's duration. To convert from a second-wise timestamp to a13895 * percentage, divide the desired timestamp by the total duration of the video. If13896 * this value is not set, the default thumbnail image is taken from 0s of the13897 * video.13898 */13899 thumbnailTimestampPct?: number;13900 /**13901 * The identifier for the watermark profile13902 */13903 watermarkId?: string;13904};13905interface StreamScopedCaptions {13906 /**13907 * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.13908 * One caption or subtitle file per language is allowed.13909 * @param language The BCP 47 language tag for the caption or subtitle.13910 * @param input The caption or subtitle stream to upload.13911 * @returns The created caption entry.13912 * @throws {NotFoundError} if the video is not found13913 * @throws {BadRequestError} if the language or file is invalid13914 * @throws {InternalError} if an unexpected error occurs13915 */13916 upload(language: string, input: ReadableStream): Promise<StreamCaption>;13917 /**13918 * Generate captions or subtitles for the provided language via AI.13919 * @param language The BCP 47 language tag to generate.13920 * @returns The generated caption entry.13921 * @throws {NotFoundError} if the video is not found13922 * @throws {BadRequestError} if the language is invalid13923 * @throws {StreamError} if a generated caption already exists13924 * @throws {StreamError} if the video duration is too long13925 * @throws {StreamError} if the video is missing audio13926 * @throws {StreamError} if the requested language is not supported13927 * @throws {InternalError} if an unexpected error occurs13928 */13929 generate(language: string): Promise<StreamCaption>;13930 /**13931 * Lists the captions or subtitles.13932 * Use the language parameter to filter by a specific language.13933 * @param language The optional BCP 47 language tag to filter by.13934 * @returns The list of captions or subtitles.13935 * @throws {NotFoundError} if the video or caption is not found13936 * @throws {InternalError} if an unexpected error occurs13937 */13938 list(language?: string): Promise<StreamCaption[]>;13939 /**13940 * Removes the captions or subtitles from a video.13941 * @param language The BCP 47 language tag to remove.13942 * @returns A promise that resolves when deletion completes.13943 * @throws {NotFoundError} if the video or caption is not found13944 * @throws {InternalError} if an unexpected error occurs13945 */13946 delete(language: string): Promise<void>;13947}13948interface StreamScopedDownloads {13949 /**13950 * Generates a download for a video when a video is ready to view. Available13951 * types are `default` and `audio`. Defaults to `default` when omitted.13952 * @param downloadType The download type to create.13953 * @returns The current downloads for the video.13954 * @throws {NotFoundError} if the video is not found13955 * @throws {BadRequestError} if the download type is invalid13956 * @throws {StreamError} if the video duration is too long to generate a download13957 * @throws {StreamError} if the video is not ready to stream13958 * @throws {InternalError} if an unexpected error occurs13959 */13960 generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;13961 /**13962 * Lists the downloads created for a video.13963 * @returns The current downloads for the video.13964 * @throws {NotFoundError} if the video or downloads are not found13965 * @throws {InternalError} if an unexpected error occurs13966 */13967 get(): Promise<StreamDownloadGetResponse>;13968 /**13969 * Delete the downloads for a video. Available types are `default` and `audio`.13970 * Defaults to `default` when omitted.13971 * @param downloadType The download type to delete.13972 * @returns A promise that resolves when deletion completes.13973 * @throws {NotFoundError} if the video or downloads are not found13974 * @throws {InternalError} if an unexpected error occurs13975 */13976 delete(downloadType?: StreamDownloadType): Promise<void>;13977}13978interface StreamVideos {13979 /**13980 * Lists all videos in a users account.13981 * @returns The list of videos.13982 * @throws {BadRequestError} if the parameters are invalid13983 * @throws {InternalError} if an unexpected error occurs13984 */13985 list(params?: StreamVideosListParams): Promise<StreamVideo[]>;13986}13987interface StreamWatermarks {13988 /**13989 * Generate a new watermark profile13990 * @param input The image stream to upload13991 * @param params The watermark creation parameters.13992 * @returns The created watermark profile.13993 * @throws {BadRequestError} if the parameters are invalid13994 * @throws {InvalidURLError} if the URL is invalid13995 * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached13996 * @throws {InternalError} if an unexpected error occurs13997 */13998 generate(input: ReadableStream, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;13999 /**14000 * Generate a new watermark profile14001 * @param url The image url to upload14002 * @param params The watermark creation parameters.14003 * @returns The created watermark profile.14004 * @throws {BadRequestError} if the parameters are invalid14005 * @throws {InvalidURLError} if the URL is invalid14006 * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached14007 * @throws {InternalError} if an unexpected error occurs14008 */14009 generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;14010 /**14011 * Lists all watermark profiles for an account.14012 * @returns The list of watermark profiles.14013 * @throws {InternalError} if an unexpected error occurs14014 */14015 list(): Promise<StreamWatermark[]>;14016 /**14017 * Retrieves details for a single watermark profile.14018 * @param watermarkId The watermark profile identifier.14019 * @returns The watermark profile details.14020 * @throws {NotFoundError} if the watermark is not found14021 * @throws {InternalError} if an unexpected error occurs14022 */14023 get(watermarkId: string): Promise<StreamWatermark>;14024 /**14025 * Deletes a watermark profile.14026 * @param watermarkId The watermark profile identifier.14027 * @returns A promise that resolves when deletion completes.14028 * @throws {NotFoundError} if the watermark is not found14029 * @throws {InternalError} if an unexpected error occurs14030 */14031 delete(watermarkId: string): Promise<void>;14032}14033type StreamUpdateVideoParams = {14034 /**14035 * Lists the origins allowed to display the video. Enter allowed origin14036 * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the14037 * video to be viewed on any origin.14038 */14039 allowedOrigins?: Array<string>;14040 /**14041 * A user-defined identifier for the media creator.14042 */14043 creator?: string;14044 /**14045 * The maximum duration in seconds for a video upload. Can be set for a14046 * video that is not yet uploaded to limit its duration. Uploads that exceed the14047 * specified duration will fail during processing. A value of `-1` means the value14048 * is unknown.14049 */14050 maxDurationSeconds?: number;14051 /**14052 * A user modifiable key-value store used to reference other systems of14053 * record for managing videos.14054 */14055 meta?: Record<string, string>;14056 /**14057 * Indicates whether the video can be a accessed using the id. When14058 * set to `true`, a signed token must be generated with a signing key to view the14059 * video.14060 */14061 requireSignedURLs?: boolean;14062 /**14063 * Indicates the date and time at which the video will be deleted. Omit14064 * the field to indicate no change, or include with a `null` value to remove an14065 * existing scheduled deletion. If specified, must be at least 30 days from upload14066 * time.14067 */14068 scheduledDeletion?: string | null;14069 /**14070 * The timestamp for a thumbnail image calculated as a percentage value14071 * of the video's duration. To convert from a second-wise timestamp to a14072 * percentage, divide the desired timestamp by the total duration of the video. If14073 * this value is not set, the default thumbnail image is taken from 0s of the14074 * video.14075 */14076 thumbnailTimestampPct?: number;14077};14078type StreamCaption = {14079 /**14080 * Whether the caption was generated via AI.14081 */14082 generated?: boolean;14083 /**14084 * The language label displayed in the native language to users.14085 */14086 label: string;14087 /**14088 * The language tag in BCP 47 format.14089 */14090 language: string;14091 /**14092 * The status of a generated caption.14093 */14094 status?: 'ready' | 'inprogress' | 'error';14095};14096type StreamDownloadStatus = 'ready' | 'inprogress' | 'error';14097type StreamDownloadType = 'default' | 'audio';14098type StreamDownload = {14099 /**14100 * Indicates the progress as a percentage between 0 and 100.14101 */14102 percentComplete: number;14103 /**14104 * The status of a generated download.14105 */14106 status: StreamDownloadStatus;14107 /**14108 * The URL to access the generated download.14109 */14110 url?: string;14111};14112/**14113 * An object with download type keys. Each key is optional and only present if that14114 * download type has been created.14115 */14116type StreamDownloadGetResponse = {14117 /**14118 * The audio-only download. Only present if this download type has been created.14119 */14120 audio?: StreamDownload;14121 /**14122 * The default video download. Only present if this download type has been created.14123 */14124 default?: StreamDownload;14125};14126type StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';14127type StreamWatermark = {14128 /**14129 * The unique identifier for a watermark profile.14130 */14131 id: string;14132 /**14133 * The size of the image in bytes.14134 */14135 size: number;14136 /**14137 * The height of the image in pixels.14138 */14139 height: number;14140 /**14141 * The width of the image in pixels.14142 */14143 width: number;14144 /**14145 * The date and a time a watermark profile was created.14146 */14147 created: string;14148 /**14149 * The source URL for a downloaded image. If the watermark profile was created via14150 * direct upload, this field is null.14151 */14152 downloadedFrom: string | null;14153 /**14154 * A short description of the watermark profile.14155 */14156 name: string;14157 /**14158 * The translucency of the image. A value of `0.0` makes the image completely14159 * transparent, and `1.0` makes the image completely opaque. Note that if the image14160 * is already semi-transparent, setting this to `1.0` will not make the image14161 * completely opaque.14162 */14163 opacity: number;14164 /**14165 * The whitespace between the adjacent edges (determined by position) of the video14166 * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded14167 * video width or length, as determined by the algorithm.14168 */14169 padding: number;14170 /**14171 * The size of the image relative to the overall size of the video. This parameter14172 * will adapt to horizontal and vertical videos automatically. `0.0` indicates no14173 * scaling (use the size of the image as-is), and `1.0 `fills the entire video.14174 */14175 scale: number;14176 /**14177 * The location of the image. Valid positions are: `upperRight`, `upperLeft`,14178 * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the14179 * `padding` parameter.14180 */14181 position: StreamWatermarkPosition;14182};14183type StreamWatermarkCreateParams = {14184 /**14185 * A short description of the watermark profile.14186 */14187 name?: string;14188 /**14189 * The translucency of the image. A value of `0.0` makes the image completely14190 * transparent, and `1.0` makes the image completely opaque. Note that if the14191 * image is already semi-transparent, setting this to `1.0` will not make the14192 * image completely opaque.14193 */14194 opacity?: number;14195 /**14196 * The whitespace between the adjacent edges (determined by position) of the14197 * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully14198 * padded video width or length, as determined by the algorithm.14199 */14200 padding?: number;14201 /**14202 * The size of the image relative to the overall size of the video. This14203 * parameter will adapt to horizontal and vertical videos automatically. `0.0`14204 * indicates no scaling (use the size of the image as-is), and `1.0 `fills the14205 * entire video.14206 */14207 scale?: number;14208 /**14209 * The location of the image.14210 */14211 position?: StreamWatermarkPosition;14212};14213type StreamVideosListParams = {14214 /**14215 * The maximum number of videos to return.14216 */14217 limit?: number;14218 /**14219 * Return videos created before this timestamp.14220 * (RFC3339/RFC3339Nano)14221 */14222 before?: string;14223 /**14224 * Comparison operator for the `before` field.14225 * @default 'lt'14226 */14227 beforeComp?: StreamPaginationComparison;14228 /**14229 * Return videos created after this timestamp.14230 * (RFC3339/RFC3339Nano)14231 */14232 after?: string;14233 /**14234 * Comparison operator for the `after` field.14235 * @default 'gte'14236 */14237 afterComp?: StreamPaginationComparison;14238};14239type StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';14240/**14241 * Error object for Stream binding operations.14242 */14243interface StreamError extends Error {14244 readonly code: number;14245 readonly statusCode: number;14246 readonly message: string;14247 readonly stack?: string;14248}14249interface InternalError extends StreamError {14250 name: 'InternalError';14251}14252interface BadRequestError extends StreamError {14253 name: 'BadRequestError';14254}14255interface NotFoundError extends StreamError {14256 name: 'NotFoundError';14257}14258interface ForbiddenError extends StreamError {14259 name: 'ForbiddenError';14260}14261interface RateLimitedError extends StreamError {14262 name: 'RateLimitedError';14263}14264interface QuotaReachedError extends StreamError {14265 name: 'QuotaReachedError';14266}14267interface MaxFileSizeError extends StreamError {14268 name: 'MaxFileSizeError';14269}14270interface InvalidURLError extends StreamError {14271 name: 'InvalidURLError';14272}14273interface AlreadyUploadedError extends StreamError {14274 name: 'AlreadyUploadedError';14275}14276interface TooManyWatermarksError extends StreamError {14277 name: 'TooManyWatermarksError';14278}14279type MarkdownDocument = {14280 name: string;14281 blob: Blob;14282};14283type OutputFormat = 'markdown' | 'text';14284type ConversionResponse = {14285 id: string;14286 name: string;14287 mimeType: string;14288 format: OutputFormat;14289 tokens: number;14290 data: string;14291} | {14292 id: string;14293 name: string;14294 mimeType: string;14295 format: 'error';14296 error: string;14297};14298type ImageConversionOptions = {14299 descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de';14300};14301type EmbeddedImageConversionOptions = ImageConversionOptions & {14302 convert?: boolean;14303 maxConvertedImages?: number;14304};14305type ConversionOutputOptions = {14306 format?: OutputFormat;14307};14308type ConversionOptions = {14309 output?: ConversionOutputOptions;14310 html?: {14311 images?: EmbeddedImageConversionOptions & {14312 convertOGImage?: boolean;14313 };14314 hostname?: string;14315 cssSelector?: string;14316 };14317 docx?: {14318 images?: EmbeddedImageConversionOptions;14319 };14320 image?: ImageConversionOptions;14321 pdf?: {14322 images?: EmbeddedImageConversionOptions;14323 metadata?: boolean;14324 };14325};14326type ConversionRequestOptions = {14327 gateway?: GatewayOptions;14328 extraHeaders?: object;14329 conversionOptions?: ConversionOptions;14330};14331type SupportedFileFormat = {14332 mimeType: string;14333 extension: string;14334};14335declare abstract class ToMarkdownService {14336 transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;14337 transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;14338 supported(): Promise<SupportedFileFormat[]>;14339}14340declare namespace TailStream {14341 interface Header {14342 readonly name: string;14343 readonly value: string;14344 }14345 interface FetchEventInfo {14346 readonly type: "fetch";14347 readonly method: string;14348 readonly url: string;14349 readonly cfJson?: object;14350 readonly headers: Header[];14351 }14352 interface JsRpcEventInfo {14353 readonly type: "jsrpc";14354 }14355 interface ScheduledEventInfo {14356 readonly type: "scheduled";14357 readonly scheduledTime: Date;14358 readonly cron: string;14359 }14360 interface AlarmEventInfo {14361 readonly type: "alarm";14362 readonly scheduledTime: Date;14363 }14364 interface QueueEventInfo {14365 readonly type: "queue";14366 readonly queueName: string;14367 readonly batchSize: number;14368 }14369 interface EmailEventInfo {14370 readonly type: "email";14371 readonly mailFrom: string;14372 readonly rcptTo: string;14373 readonly rawSize: number;14374 }14375 interface TraceEventInfo {14376 readonly type: "trace";14377 readonly traces: (string | null)[];14378 }14379 interface HibernatableWebSocketEventInfoMessage {14380 readonly type: "message";14381 }14382 interface HibernatableWebSocketEventInfoError {14383 readonly type: "error";14384 }14385 interface HibernatableWebSocketEventInfoClose {14386 readonly type: "close";14387 readonly code: number;14388 readonly wasClean: boolean;14389 }14390 interface HibernatableWebSocketEventInfo {14391 readonly type: "hibernatableWebSocket";14392 readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage;14393 }14394 interface CustomEventInfo {14395 readonly type: "custom";14396 }14397 interface FetchResponseInfo {14398 readonly type: "fetch";14399 readonly statusCode: number;14400 }14401 interface ConnectEventInfo {14402 readonly type: "connect";14403 }14404 type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime";14405 interface ScriptVersion {14406 readonly id: string;14407 readonly tag?: string;14408 readonly message?: string;14409 }14410 interface TracePreviewInfo {14411 readonly id: string;14412 readonly slug: string;14413 readonly name: string;14414 }14415 interface Onset {14416 readonly type: "onset";14417 readonly attributes: Attribute[];14418 // id for the span being opened by this Onset event.14419 readonly spanId: string;14420 readonly dispatchNamespace?: string;14421 readonly entrypoint?: string;14422 readonly executionModel: string;14423 readonly durableObjectId?: string;14424 readonly scriptName?: string;14425 readonly scriptTags?: string[];14426 readonly scriptVersion?: ScriptVersion;14427 readonly preview?: TracePreviewInfo;14428 readonly info: FetchEventInfo | ConnectEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo;14429 }14430 interface Outcome {14431 readonly type: "outcome";14432 readonly outcome: EventOutcome;14433 readonly cpuTime: number;14434 readonly wallTime: number;14435 }14436 interface SpanOpen {14437 readonly type: "spanOpen";14438 readonly name: string;14439 // id for the span being opened by this SpanOpen event.14440 readonly spanId: string;14441 readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;14442 }14443 interface SpanClose {14444 readonly type: "spanClose";14445 readonly outcome: EventOutcome;14446 }14447 interface DiagnosticChannelEvent {14448 readonly type: "diagnosticChannel";14449 readonly channel: string;14450 readonly message: any;14451 }14452 interface Exception {14453 readonly type: "exception";14454 readonly name: string;14455 readonly message: string;14456 readonly stack?: string;14457 }14458 interface TailStreamErrorInfo {14459 readonly name: string;14460 readonly message: string;14461 readonly stack?: string;14462 }14463 type Log = {14464 readonly type: "log";14465 readonly level: "debug" | "error" | "info" | "log" | "warn";14466 readonly errorInfo?: readonly (TailStreamErrorInfo | null)[];14467 } & ({14468 readonly message: object;14469 readonly truncated?: false;14470 } | {14471 readonly message: string;14472 readonly truncated: true;14473 });14474 interface DroppedEventsDiagnostic {14475 readonly diagnosticsType: "droppedEvents";14476 readonly count: number;14477 }14478 interface StreamDiagnostic {14479 readonly type: 'streamDiagnostic';14480 // To add new diagnostic types, define a new interface and add it to this union type.14481 readonly diagnostic: DroppedEventsDiagnostic;14482 }14483 // This marks the worker handler return information.14484 // This is separate from Outcome because the worker invocation can live for a long time after14485 // returning. For example - Websockets that return an http upgrade response but then continue14486 // streaming information or SSE http connections.14487 interface Return {14488 readonly type: "return";14489 readonly info?: FetchResponseInfo;14490 }14491 interface Attribute {14492 readonly name: string;14493 readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[];14494 }14495 interface Attributes {14496 readonly type: "attributes";14497 readonly info: Attribute[];14498 }14499 type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;14500 // Context in which this trace event lives.14501 interface SpanContext {14502 // Single id for the entire top-level invocation14503 // This should be a new traceId for the first worker stage invoked in the eyeball request and then14504 // same-account service-bindings should reuse the same traceId but cross-account service-bindings14505 // should use a new traceId.14506 readonly traceId: string;14507 // spanId in which this event is handled14508 // for Onset and SpanOpen events this would be the parent span id14509 // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events14510 // For Hibernate and Mark this would be the span under which they were emitted.14511 // spanId is not set ONLY if:14512 // 1. This is an Onset event14513 // 2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)14514 readonly spanId?: string;14515 // W3C trace flags from an upstream traceparent. Absent when no upstream14516 // sampling decision was made.14517 readonly traceFlags?: number;14518 }14519 interface TailEvent<Event extends EventType> {14520 // invocation id of the currently invoked worker stage.14521 // invocation id will always be unique to every Onset event and will be the same until the Outcome event.14522 readonly invocationId: string;14523 // Inherited spanContext for this event.14524 readonly spanContext: SpanContext;14525 readonly timestamp: Date;14526 readonly sequence: number;14527 readonly event: Event;14528 }14529 type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>;14530 type TailEventHandlerObject = {14531 outcome?: TailEventHandler<Outcome>;14532 spanOpen?: TailEventHandler<SpanOpen>;14533 spanClose?: TailEventHandler<SpanClose>;14534 diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;14535 exception?: TailEventHandler<Exception>;14536 log?: TailEventHandler<Log>;14537 return?: TailEventHandler<Return>;14538 attributes?: TailEventHandler<Attributes>;14539 };14540 type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;14541}14542// Copyright (c) 2022-2023 Cloudflare, Inc.14543// Licensed under the Apache 2.0 license found in the LICENSE file or at:14544// https://opensource.org/licenses/Apache-2.014545/**14546 * Data types supported for holding vector metadata.14547 */14548type VectorizeVectorMetadataValue = string | number | boolean | string[];14549/**14550 * Additional information to associate with a vector.14551 */14552type VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>;14553type VectorFloatArray = Float32Array | Float64Array;14554interface VectorizeError {14555 code?: number;14556 error: string;14557}14558/**14559 * Comparison logic/operation to use for metadata filtering.14560 *14561 * This list is expected to grow as support for more operations are released.14562 */14563type VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte';14564type VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin';14565/**14566 * Filter criteria for vector metadata used to limit the retrieved query result set.14567 */14568type VectorizeVectorMetadataFilter = {14569 [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | {14570 [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null;14571 } | {14572 [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[];14573 };14574};14575/**14576 * Supported distance metrics for an index.14577 * Distance metrics determine how other "similar" vectors are determined.14578 */14579type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";14580/**14581 * Metadata return levels for a Vectorize query.14582 *14583 * Default to "none".14584 *14585 * @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.14586 * @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).14587 * @property none No indexed metadata will be returned.14588 */14589type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";14590interface VectorizeQueryOptions {14591 topK?: number;14592 namespace?: string;14593 returnValues?: boolean;14594 returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;14595 filter?: VectorizeVectorMetadataFilter;14596}14597/**14598 * Information about the configuration of an index.14599 */14600type VectorizeIndexConfig = {14601 dimensions: number;14602 metric: VectorizeDistanceMetric;14603} | {14604 preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity14605};14606/**14607 * Metadata about an existing index.14608 *14609 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.14610 * See {@link VectorizeIndexInfo} for its post-beta equivalent.14611 */14612interface VectorizeIndexDetails {14613 /** The unique ID of the index */14614 readonly id: string;14615 /** The name of the index. */14616 name: string;14617 /** (optional) A human readable description for the index. */14618 description?: string;14619 /** The index configuration, including the dimension size and distance metric. */14620 config: VectorizeIndexConfig;14621 /** The number of records containing vectors within the index. */14622 vectorsCount: number;14623}14624/**14625 * Metadata about an existing index.14626 */14627interface VectorizeIndexInfo {14628 /** The number of records containing vectors within the index. */14629 vectorCount: number;14630 /** Number of dimensions the index has been configured for. */14631 dimensions: number;14632 /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */14633 processedUpToDatetime: number;14634 /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */14635 processedUpToMutation: number;14636}14637/**14638 * Represents a single vector value set along with its associated metadata.14639 */14640interface VectorizeVector {14641 /** 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. */14642 id: string;14643 /** The vector values */14644 values: VectorFloatArray | number[];14645 /** The namespace this vector belongs to. */14646 namespace?: string;14647 /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */14648 metadata?: Record<string, VectorizeVectorMetadata>;14649}14650/**14651 * Represents a matched vector for a query along with its score and (if specified) the matching vector information.14652 */14653type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> & Omit<VectorizeVector, "values"> & {14654 /** The score or rank for similarity, when returned as a result */14655 score: number;14656};14657/**14658 * A set of matching {@link VectorizeMatch} for a particular query.14659 */14660interface VectorizeMatches {14661 matches: VectorizeMatch[];14662 count: number;14663}14664/**14665 * Results of an operation that performed a mutation on a set of vectors.14666 * Here, `ids` is a list of vectors that were successfully processed.14667 *14668 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.14669 * See {@link VectorizeAsyncMutation} for its post-beta equivalent.14670 */14671interface VectorizeVectorMutation {14672 /* List of ids of vectors that were successfully processed. */14673 ids: string[];14674 /* Total count of the number of processed vectors. */14675 count: number;14676}14677/**14678 * Result type indicating a mutation on the Vectorize Index.14679 * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.14680 */14681interface VectorizeAsyncMutation {14682 /** The unique identifier for the async mutation operation containing the changeset. */14683 mutationId: string;14684}14685/**14686 * A Vectorize Vector Search Index for querying vectors/embeddings.14687 *14688 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.14689 * See {@link Vectorize} for its new implementation.14690 */14691declare abstract class VectorizeIndex {14692 /**14693 * Get information about the currently bound index.14694 * @returns A promise that resolves with information about the current index.14695 */14696 public describe(): Promise<VectorizeIndexDetails>;14697 /**14698 * Use the provided vector to perform a similarity search across the index.14699 * @param vector Input vector that will be used to drive the similarity search.14700 * @param options Configuration options to massage the returned data.14701 * @returns A promise that resolves with matched and scored vectors.14702 */14703 public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;14704 /**14705 * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.14706 * @param vectors List of vectors that will be inserted.14707 * @returns A promise that resolves with the ids & count of records that were successfully processed.14708 */14709 public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;14710 /**14711 * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.14712 * @param vectors List of vectors that will be upserted.14713 * @returns A promise that resolves with the ids & count of records that were successfully processed.14714 */14715 public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;14716 /**14717 * Delete a list of vectors with a matching id.14718 * @param ids List of vector ids that should be deleted.14719 * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).14720 */14721 public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;14722 /**14723 * Get a list of vectors with a matching id.14724 * @param ids List of vector ids that should be returned.14725 * @returns A promise that resolves with the raw unscored vectors matching the id set.14726 */14727 public getByIds(ids: string[]): Promise<VectorizeVector[]>;14728}14729/**14730 * A Vectorize Vector Search Index for querying vectors/embeddings.14731 *14732 * Mutations in this version are async, returning a mutation id.14733 */14734declare abstract class Vectorize {14735 /**14736 * Get information about the currently bound index.14737 * @returns A promise that resolves with information about the current index.14738 */14739 public describe(): Promise<VectorizeIndexInfo>;14740 /**14741 * Use the provided vector to perform a similarity search across the index.14742 * @param vector Input vector that will be used to drive the similarity search.14743 * @param options Configuration options to massage the returned data.14744 * @returns A promise that resolves with matched and scored vectors.14745 */14746 public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;14747 /**14748 * Use the provided vector-id to perform a similarity search across the index.14749 * @param vectorId Id for a vector in the index against which the index should be queried.14750 * @param options Configuration options to massage the returned data.14751 * @returns A promise that resolves with matched and scored vectors.14752 */14753 public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;14754 /**14755 * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.14756 * @param vectors List of vectors that will be inserted.14757 * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.14758 */14759 public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;14760 /**14761 * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.14762 * @param vectors List of vectors that will be upserted.14763 * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.14764 */14765 public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;14766 /**14767 * Delete a list of vectors with a matching id.14768 * @param ids List of vector ids that should be deleted.14769 * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.14770 */14771 public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;14772 /**14773 * Get a list of vectors with a matching id.14774 * @param ids List of vector ids that should be returned.14775 * @returns A promise that resolves with the raw unscored vectors matching the id set.14776 */14777 public getByIds(ids: string[]): Promise<VectorizeVector[]>;14778}14779/**14780 * The interface for "version_metadata" binding14781 * providing metadata about the Worker Version using this binding.14782 */14783type WorkerVersionMetadata = {14784 /** The ID of the Worker Version using this binding */14785 id: string;14786 /** The tag of the Worker Version using this binding */14787 tag: string;14788 /** The timestamp of when the Worker Version was uploaded */14789 timestamp: string;14790};14791// ============ Web Search Request Types ============14792/**14793 * Options for a Web Search query.14794 */14795type WebSearchSearchOptions = {14796 /** The search query. */14797 query: string;14798 /**14799 * Maximum number of results to return. Defaults to 10, capped at 20.14800 * The actual count may be lower if fewer matches exist.14801 */14802 limit?: number;14803};14804// ============ Web Search Response Types ============14805/**14806 * A single Web Search result.14807 *14808 * Web Search is discovery-only -- results carry catalog metadata about a page14809 * but never the page body. To read a result's content the caller invokes the14810 * global `fetch()` API against the result's `url`, at which point the14811 * destination's own access controls apply (including Cloudflare Pay-per-Crawl).14812 */14813type WebSearchResult = {14814 /** Canonical URL. */14815 url: string;14816 /** Page title. */14817 title: string;14818 /** Page-level description. May be absent. */14819 description?: string;14820 /**14821 * Last-modified date for the page, when known. Naive (no timezone)14822 * ISO-8601 datetime, e.g. `"2025-11-30T04:39:48"`.14823 */14824 lastModifiedDate?: string;14825 /**14826 * Page meta image URL (typically the `og:image`). May be absent.14827 */14828 imageUrl?: string;14829 /** Optional favicon URL for UI hints. */14830 faviconUrl?: string;14831};14832/**14833 * Per-response metadata for a Web Search query. Carries operational14834 * fields useful for support and debugging.14835 */14836type WebSearchResponseMetadata = {14837 /** The query that was executed. */14838 query: string;14839 /** Opaque request identifier used for support and debugging. */14840 requestId: string;14841 /** End-to-end latency for this search request, in milliseconds. */14842 latencyMs: number;14843};14844/**14845 * Response from a Web Search query.14846 */14847type WebSearchSearchResponse = {14848 items: WebSearchResult[];14849 metadata: WebSearchResponseMetadata;14850};14851// ============ Web Search Binding Class ============14852/**14853 * Cloudflare Web Search binding.14854 *14855 * Discovery-only primitive for agents and Workers. Returns URLs and catalog14856 * metadata for a query; never returns page content or excerpts. To read a14857 * result's body, fetch the URL with the global `fetch()` API.14858 *14859 * Declared in wrangler with a single object (there is exactly one corpus, the14860 * public web, so there is no name, namespace, or instance to specify):14861 *14862 * ```jsonc14863 * { "web_search": { "binding": "WEBSEARCH" } }14864 * ```14865 *14866 * @example14867 * ```ts14868 * const { items, metadata } = await env.WEBSEARCH.search({14869 * query: "Cloudflare Workers",14870 * });14871 *14872 * const top = items[0];14873 * console.log(top.url, top.title, metadata.latencyMs);14874 *14875 * // Read content yourself; pay-per-crawl and other publisher14876 * // controls apply at the fetch site, not at search time.14877 * const page = await fetch(top.url);14878 * ```14879 */14880declare abstract class WebSearch {14881 /**14882 * Run a Web Search query.14883 * @param options Search options. Only `query` is required.14884 * @returns The matching results plus per-response metadata.14885 */14886 search(options: WebSearchSearchOptions): Promise<WebSearchSearchResponse>;14887}14888interface DynamicDispatchLimits {14889 /**14890 * Limit CPU time in milliseconds.14891 */14892 cpuMs?: number;14893 /**14894 * Limit number of subrequests.14895 */14896 subRequests?: number;14897}14898interface DynamicDispatchOptions {14899 /**14900 * Limit resources of invoked Worker script.14901 */14902 limits?: DynamicDispatchLimits;14903 /**14904 * Arguments for outbound Worker script, if configured.14905 */14906 outbound?: {14907 [key: string]: any;14908 };14909}14910interface DispatchNamespace {14911 /**14912 * @param name Name of the Worker script.14913 * @param args Arguments to Worker script.14914 * @param options Options for Dynamic Dispatch invocation.14915 * @returns A Fetcher object that allows you to send requests to the Worker script.14916 * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.14917 */14918 get(name: string, args?: {14919 [key: string]: any;14920 }, options?: DynamicDispatchOptions): Fetcher;14921}14922declare module 'cloudflare:workflows' {14923 /**14924 * NonRetryableError allows for a user to throw a fatal error14925 * that makes a Workflow instance fail immediately without triggering a retry14926 */14927 export class NonRetryableError extends Error {14928 public constructor(message: string, name?: string);14929 }14930}14931declare abstract class Workflow<PARAMS = unknown> {14932 /**14933 * Get a handle to an existing instance of the Workflow.14934 * @param id Id for the instance of this Workflow14935 * @returns A promise that resolves with a handle for the Instance14936 */14937 public get(id: string): Promise<WorkflowInstance>;14938 /**14939 * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.14940 * @param options Options when creating an instance including id and params14941 * @returns A promise that resolves with a handle for the Instance14942 */14943 public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>;14944 /**14945 * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.14946 * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.14947 * @param batch List of Options when creating an instance including name and params14948 * @returns A promise that resolves with a list of handles for the created instances.14949 */14950 public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;14951 /**14952 * Delete a batch of Workflow instances and their stored state.14953 * `deleteBatch` is limited to 100 instances at a time. Duplicate IDs are deleted once.14954 * The result contains one entry for each input position; IDs that do not exist are returned as per-instance errors.14955 * @param instanceIds IDs of the Workflow instances to delete14956 * @returns A promise that resolves with the successfully deleted instances and any per-instance errors.14957 */14958 public deleteBatch(instanceIds: string[]): Promise<WorkflowBatchDeleteResult>;14959}14960type WorkflowBatchDeleteResult = {14961 deleted: {14962 id: string;14963 }[];14964 errors: {14965 id: string;14966 code: number;14967 message: string;14968 }[];14969};14970type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';14971type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;14972type WorkflowRetentionDuration = WorkflowSleepDuration;14973/** Geographic regions supported when creating a Workflow instance.14974 * Location hints are best-effort placement preferences. */14975type WorkflowInstanceLocationHint = 'wnam' | 'enam' | 'sam' | 'weur' | 'eeur' | 'apac' | 'apac-ne' | 'apac-se' | 'oc' | 'afr' | 'me';14976interface WorkflowInstanceCreateOptions<PARAMS = unknown> {14977 /**14978 * An id for your Workflow instance. Must be unique within the Workflow.14979 */14980 id?: string;14981 /**14982 * The event payload the Workflow instance is triggered with14983 */14984 params?: PARAMS;14985 /**14986 * The retention policy for Workflow instance.14987 * Defaults to the maximum retention period available for the owner's account.14988 */14989 retention?: {14990 successRetention?: WorkflowRetentionDuration;14991 errorRetention?: WorkflowRetentionDuration;14992 };14993 /** A best-effort geographic placement preference for the Workflow instance.14994 * See `WorkflowInstanceLocationHint` for supported regions. */14995 locationHint?: WorkflowInstanceLocationHint;14996}14997type InstanceStatus = {14998 status: 'queued' // means that instance is waiting to be started (see concurrency limits)14999 | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running15000 | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish15001 | 'waitingForPause' // instance is finishing the current work to pause15002 | 'unknown';15003 error?: {15004 name: string;15005 message: string;15006 };15007 output?: unknown;15008};15009interface WorkflowError {15010 code?: number;15011 message: string;15012}15013interface WorkflowInstanceTerminateOptions {15014 /**15015 * If true, run registered rollback handlers before terminating the instance.15016 * Only steps that registered rollback handlers are rolled back.15017 */15018 rollback?: boolean;15019}15020interface WorkflowInstanceRestartOptions {15021 /**15022 * Restart from a specific step. If omitted, the instance restarts from the beginning.15023 * The step must exist in the instance's execution history.15024 */15025 from?: {15026 /**15027 * The step name as defined in your workflow code.15028 */15029 name: string;15030 /**15031 * 1-indexed occurrence of this step name. Use when the same step name appears multiple times (e.g. in a loop).15032 * @default 115033 */15034 count?: number;15035 /**15036 * Step type filter. Use when different step types share the same name.15037 */15038 type?: 'do' | 'sleep' | 'waitForEvent';15039 };15040}15041declare abstract class WorkflowInstance {15042 public id: string;15043 /**15044 * Pause the instance.15045 */15046 public pause(): Promise<void>;15047 /**15048 * Resume the instance. If it is already running, an error will be thrown.15049 */15050 public resume(): Promise<void>;15051 /**15052 * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.15053 * @param options Options for termination, including whether registered rollback handlers should run.15054 */15055 public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;15056 /**15057 * Restart the instance. Optionally restart from a specific step, preserving15058 * cached results for all steps before it.15059 * @param options Options for the restart, including an optional step to restart from.15060 */15061 public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;15062 /**15063 * Delete the instance and its stored state.15064 */15065 public delete(): Promise<void>;15066 /**15067 * Returns the current status of the instance.15068 */15069 public status(): Promise<InstanceStatus>;15070 /**15071 * Send an event to this instance.15072 */15073 public sendEvent({ type, payload, }: {15074 type: string;15075 payload: unknown;15076 }): Promise<void>;15077}