the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 12847 lines 477 kB view raw
1/* eslint-disable */ 2// Generated by Wrangler by running `wrangler types` (hash: 38cf771a6b51450cfa1476dd16c8ba52) 3// Runtime types generated with workerd@1.20260401.1 2025-05-06 nodejs_compat 4declare namespace Cloudflare { 5 interface GlobalProps { 6 mainModule: typeof import("./src/index"); 7 durableNamespaces: "Sandbox"; 8 } 9 interface Env { 10 POCKETENV_COPY: R2Bucket; 11 BACKUP_BUCKET: R2Bucket; 12 HYPERDRIVE: Hyperdrive; 13 backup_queue: Queue; 14 SANDBOX_TRANSPORT: "websocket"; 15 PREVIEW_TOKEN: "sandbox"; 16 CLOUDFLARE_ACCOUNT_ID: "fe5b1e2ce9f94f4c0415ab94ce402012"; 17 BACKUP_BUCKET_NAME: "pocketenv-backup"; 18 CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE: string; 19 PUBLIC_KEY: string; 20 PRIVATE_KEY: string; 21 JWT_SECRET: string; 22 VOLUME_BUCKET: string; 23 ACCOUNT_ID: string; 24 R2_ACCESS_KEY_ID: string; 25 R2_SECRET_ACCESS_KEY: string; 26 Sandbox: DurableObjectNamespace<import("./src/index").Sandbox>; 27 } 28} 29interface Env extends Cloudflare.Env {} 30type StringifyValues<EnvType extends Record<string, unknown>> = { 31 [Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string; 32}; 33declare namespace NodeJS { 34 interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "SANDBOX_TRANSPORT" | "PREVIEW_TOKEN" | "CLOUDFLARE_ACCOUNT_ID" | "BACKUP_BUCKET_NAME" | "CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE" | "PUBLIC_KEY" | "PRIVATE_KEY" | "JWT_SECRET" | "VOLUME_BUCKET" | "ACCOUNT_ID" | "R2_ACCESS_KEY_ID" | "R2_SECRET_ACCESS_KEY">> {} 35} 36 37// Begin runtime types 38/*! ***************************************************************************** 39Copyright (c) Cloudflare. All rights reserved. 40Copyright (c) Microsoft Corporation. All rights reserved. 41 42Licensed under the Apache License, Version 2.0 (the "License"); you may not use 43this file except in compliance with the License. You may obtain a copy of the 44License at http://www.apache.org/licenses/LICENSE-2.0 45THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 46KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 47WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 48MERCHANTABLITY OR NON-INFRINGEMENT. 49See the Apache Version 2.0 License for specific language governing permissions 50and limitations under the License. 51***************************************************************************** */ 52/* eslint-disable */ 53// noinspection JSUnusedGlobalSymbols 54declare var onmessage: never; 55/** 56 * 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. 57 * 58 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) 59 */ 60declare class DOMException extends Error { 61 constructor(message?: string, name?: string); 62 /** 63 * The **`message`** read-only property of the a message or description associated with the given error name. 64 * 65 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) 66 */ 67 readonly message: string; 68 /** 69 * The **`name`** read-only property of the one of the strings associated with an error name. 70 * 71 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) 72 */ 73 readonly name: string; 74 /** 75 * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match. 76 * @deprecated 77 * 78 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) 79 */ 80 readonly code: number; 81 static readonly INDEX_SIZE_ERR: number; 82 static readonly DOMSTRING_SIZE_ERR: number; 83 static readonly HIERARCHY_REQUEST_ERR: number; 84 static readonly WRONG_DOCUMENT_ERR: number; 85 static readonly INVALID_CHARACTER_ERR: number; 86 static readonly NO_DATA_ALLOWED_ERR: number; 87 static readonly NO_MODIFICATION_ALLOWED_ERR: number; 88 static readonly NOT_FOUND_ERR: number; 89 static readonly NOT_SUPPORTED_ERR: number; 90 static readonly INUSE_ATTRIBUTE_ERR: number; 91 static readonly INVALID_STATE_ERR: number; 92 static readonly SYNTAX_ERR: number; 93 static readonly INVALID_MODIFICATION_ERR: number; 94 static readonly NAMESPACE_ERR: number; 95 static readonly INVALID_ACCESS_ERR: number; 96 static readonly VALIDATION_ERR: number; 97 static readonly TYPE_MISMATCH_ERR: number; 98 static readonly SECURITY_ERR: number; 99 static readonly NETWORK_ERR: number; 100 static readonly ABORT_ERR: number; 101 static readonly URL_MISMATCH_ERR: number; 102 static readonly QUOTA_EXCEEDED_ERR: number; 103 static readonly TIMEOUT_ERR: number; 104 static readonly INVALID_NODE_TYPE_ERR: number; 105 static readonly DATA_CLONE_ERR: number; 106 get stack(): any; 107 set stack(value: any); 108} 109type WorkerGlobalScopeEventMap = { 110 fetch: FetchEvent; 111 scheduled: ScheduledEvent; 112 queue: QueueEvent; 113 unhandledrejection: PromiseRejectionEvent; 114 rejectionhandled: PromiseRejectionEvent; 115}; 116declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> { 117 EventTarget: typeof EventTarget; 118} 119/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). * 120 * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). 121 * 122 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) 123 */ 124interface Console { 125 "assert"(condition?: boolean, ...data: any[]): void; 126 /** 127 * The **`console.clear()`** static method clears the console if possible. 128 * 129 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) 130 */ 131 clear(): void; 132 /** 133 * The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called. 134 * 135 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) 136 */ 137 count(label?: string): void; 138 /** 139 * The **`console.countReset()`** static method resets counter used with console/count_static. 140 * 141 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) 142 */ 143 countReset(label?: string): void; 144 /** 145 * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level. 146 * 147 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) 148 */ 149 debug(...data: any[]): void; 150 /** 151 * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object. 152 * 153 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) 154 */ 155 dir(item?: any, options?: any): void; 156 /** 157 * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element. 158 * 159 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) 160 */ 161 dirxml(...data: any[]): void; 162 /** 163 * The **`console.error()`** static method outputs a message to the console at the 'error' log level. 164 * 165 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) 166 */ 167 error(...data: any[]): void; 168 /** 169 * 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_static is called. 170 * 171 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) 172 */ 173 group(...data: any[]): void; 174 /** 175 * The **`console.groupCollapsed()`** static method creates a new inline group in the console. 176 * 177 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) 178 */ 179 groupCollapsed(...data: any[]): void; 180 /** 181 * The **`console.groupEnd()`** static method exits the current inline group in the console. 182 * 183 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) 184 */ 185 groupEnd(): void; 186 /** 187 * The **`console.info()`** static method outputs a message to the console at the 'info' log level. 188 * 189 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) 190 */ 191 info(...data: any[]): void; 192 /** 193 * The **`console.log()`** static method outputs a message to the console. 194 * 195 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) 196 */ 197 log(...data: any[]): void; 198 /** 199 * The **`console.table()`** static method displays tabular data as a table. 200 * 201 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) 202 */ 203 table(tabularData?: any, properties?: string[]): void; 204 /** 205 * The **`console.time()`** static method starts a timer you can use to track how long an operation takes. 206 * 207 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) 208 */ 209 time(label?: string): void; 210 /** 211 * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static. 212 * 213 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) 214 */ 215 timeEnd(label?: string): void; 216 /** 217 * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static. 218 * 219 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) 220 */ 221 timeLog(label?: string, ...data: any[]): void; 222 timeStamp(label?: string): void; 223 /** 224 * The **`console.trace()`** static method outputs a stack trace to the console. 225 * 226 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) 227 */ 228 trace(...data: any[]): void; 229 /** 230 * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level. 231 * 232 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) 233 */ 234 warn(...data: any[]): void; 235} 236declare const console: Console; 237type BufferSource = ArrayBufferView | ArrayBuffer; 238type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; 239declare namespace WebAssembly { 240 class CompileError extends Error { 241 constructor(message?: string); 242 } 243 class RuntimeError extends Error { 244 constructor(message?: string); 245 } 246 type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128"; 247 interface GlobalDescriptor { 248 value: ValueType; 249 mutable?: boolean; 250 } 251 class Global { 252 constructor(descriptor: GlobalDescriptor, value?: any); 253 value: any; 254 valueOf(): any; 255 } 256 type ImportValue = ExportValue | number; 257 type ModuleImports = Record<string, ImportValue>; 258 type Imports = Record<string, ModuleImports>; 259 type ExportValue = Function | Global | Memory | Table; 260 type Exports = Record<string, ExportValue>; 261 class Instance { 262 constructor(module: Module, imports?: Imports); 263 readonly exports: Exports; 264 } 265 interface MemoryDescriptor { 266 initial: number; 267 maximum?: number; 268 shared?: boolean; 269 } 270 class Memory { 271 constructor(descriptor: MemoryDescriptor); 272 readonly buffer: ArrayBuffer; 273 grow(delta: number): number; 274 } 275 type ImportExportKind = "function" | "global" | "memory" | "table"; 276 interface ModuleExportDescriptor { 277 kind: ImportExportKind; 278 name: string; 279 } 280 interface ModuleImportDescriptor { 281 kind: ImportExportKind; 282 module: string; 283 name: string; 284 } 285 abstract class Module { 286 static customSections(module: Module, sectionName: string): ArrayBuffer[]; 287 static exports(module: Module): ModuleExportDescriptor[]; 288 static imports(module: Module): ModuleImportDescriptor[]; 289 } 290 type TableKind = "anyfunc" | "externref"; 291 interface TableDescriptor { 292 element: TableKind; 293 initial: number; 294 maximum?: number; 295 } 296 class Table { 297 constructor(descriptor: TableDescriptor, value?: any); 298 readonly length: number; 299 get(index: number): any; 300 grow(delta: number, value?: any): number; 301 set(index: number, value?: any): void; 302 } 303 function instantiate(module: Module, imports?: Imports): Promise<Instance>; 304 function validate(bytes: BufferSource): boolean; 305} 306/** 307 * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker. 308 * Available only in secure contexts. 309 * 310 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope) 311 */ 312interface ServiceWorkerGlobalScope extends WorkerGlobalScope { 313 DOMException: typeof DOMException; 314 WorkerGlobalScope: typeof WorkerGlobalScope; 315 btoa(data: string): string; 316 atob(data: string): string; 317 setTimeout(callback: (...args: any[]) => void, msDelay?: number): number; 318 setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; 319 clearTimeout(timeoutId: number | null): void; 320 setInterval(callback: (...args: any[]) => void, msDelay?: number): number; 321 setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; 322 clearInterval(timeoutId: number | null): void; 323 queueMicrotask(task: Function): void; 324 structuredClone<T>(value: T, options?: StructuredSerializeOptions): T; 325 reportError(error: any): void; 326 fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>; 327 self: ServiceWorkerGlobalScope; 328 crypto: Crypto; 329 caches: CacheStorage; 330 scheduler: Scheduler; 331 performance: Performance; 332 Cloudflare: Cloudflare; 333 readonly origin: string; 334 Event: typeof Event; 335 ExtendableEvent: typeof ExtendableEvent; 336 CustomEvent: typeof CustomEvent; 337 PromiseRejectionEvent: typeof PromiseRejectionEvent; 338 FetchEvent: typeof FetchEvent; 339 TailEvent: typeof TailEvent; 340 TraceEvent: typeof TailEvent; 341 ScheduledEvent: typeof ScheduledEvent; 342 MessageEvent: typeof MessageEvent; 343 CloseEvent: typeof CloseEvent; 344 ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader; 345 ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader; 346 ReadableStream: typeof ReadableStream; 347 WritableStream: typeof WritableStream; 348 WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter; 349 TransformStream: typeof TransformStream; 350 ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy; 351 CountQueuingStrategy: typeof CountQueuingStrategy; 352 ErrorEvent: typeof ErrorEvent; 353 EventSource: typeof EventSource; 354 ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest; 355 ReadableStreamDefaultController: typeof ReadableStreamDefaultController; 356 ReadableByteStreamController: typeof ReadableByteStreamController; 357 WritableStreamDefaultController: typeof WritableStreamDefaultController; 358 TransformStreamDefaultController: typeof TransformStreamDefaultController; 359 CompressionStream: typeof CompressionStream; 360 DecompressionStream: typeof DecompressionStream; 361 TextEncoderStream: typeof TextEncoderStream; 362 TextDecoderStream: typeof TextDecoderStream; 363 Headers: typeof Headers; 364 Body: typeof Body; 365 Request: typeof Request; 366 Response: typeof Response; 367 WebSocket: typeof WebSocket; 368 WebSocketPair: typeof WebSocketPair; 369 WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair; 370 AbortController: typeof AbortController; 371 AbortSignal: typeof AbortSignal; 372 TextDecoder: typeof TextDecoder; 373 TextEncoder: typeof TextEncoder; 374 navigator: Navigator; 375 Navigator: typeof Navigator; 376 URL: typeof URL; 377 URLSearchParams: typeof URLSearchParams; 378 URLPattern: typeof URLPattern; 379 Blob: typeof Blob; 380 File: typeof File; 381 FormData: typeof FormData; 382 Crypto: typeof Crypto; 383 SubtleCrypto: typeof SubtleCrypto; 384 CryptoKey: typeof CryptoKey; 385 CacheStorage: typeof CacheStorage; 386 Cache: typeof Cache; 387 FixedLengthStream: typeof FixedLengthStream; 388 IdentityTransformStream: typeof IdentityTransformStream; 389 HTMLRewriter: typeof HTMLRewriter; 390} 391declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void; 392declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void; 393/** 394 * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. 395 * 396 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) 397 */ 398declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean; 399/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */ 400declare function btoa(data: string): string; 401/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */ 402declare function atob(data: string): string; 403/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */ 404declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number; 405/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */ 406declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; 407/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */ 408declare function clearTimeout(timeoutId: number | null): void; 409/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */ 410declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number; 411/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */ 412declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; 413/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */ 414declare function clearInterval(timeoutId: number | null): void; 415/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */ 416declare function queueMicrotask(task: Function): void; 417/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */ 418declare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T; 419/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */ 420declare function reportError(error: any): void; 421/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */ 422declare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>; 423declare const self: ServiceWorkerGlobalScope; 424/** 425* The Web Crypto API provides a set of low-level functions for common cryptographic tasks. 426* The Workers runtime implements the full surface of this API, but with some differences in 427* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms) 428* compared to those implemented in most browsers. 429* 430* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/) 431*/ 432declare const crypto: Crypto; 433/** 434* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. 435* 436* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) 437*/ 438declare const caches: CacheStorage; 439declare const scheduler: Scheduler; 440/** 441* The Workers runtime supports a subset of the Performance API, used to measure timing and performance, 442* as well as timing of subrequests and other operations. 443* 444* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/) 445*/ 446declare const performance: Performance; 447declare const Cloudflare: Cloudflare; 448declare const origin: string; 449declare const navigator: Navigator; 450interface TestController { 451} 452interface ExecutionContext<Props = unknown> { 453 waitUntil(promise: Promise<any>): void; 454 passThroughOnException(): void; 455 readonly props: Props; 456} 457type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>; 458type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>; 459type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>; 460type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>; 461type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>; 462type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>; 463type ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>; 464type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>; 465interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> { 466 fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>; 467 connect?: ExportedHandlerConnectHandler<Env, Props>; 468 tail?: ExportedHandlerTailHandler<Env, Props>; 469 trace?: ExportedHandlerTraceHandler<Env, Props>; 470 tailStream?: ExportedHandlerTailStreamHandler<Env, Props>; 471 scheduled?: ExportedHandlerScheduledHandler<Env, Props>; 472 test?: ExportedHandlerTestHandler<Env, Props>; 473 email?: EmailExportedHandler<Env, Props>; 474 queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>; 475} 476interface StructuredSerializeOptions { 477 transfer?: any[]; 478} 479declare abstract class Navigator { 480 sendBeacon(url: string, body?: BodyInit): boolean; 481 readonly userAgent: string; 482 readonly hardwareConcurrency: number; 483} 484interface AlarmInvocationInfo { 485 readonly isRetry: boolean; 486 readonly retryCount: number; 487 readonly scheduledTime: number; 488} 489interface Cloudflare { 490 readonly compatibilityFlags: Record<string, boolean>; 491} 492interface DurableObject { 493 fetch(request: Request): Response | Promise<Response>; 494 connect?(socket: Socket): void | Promise<void>; 495 alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>; 496 webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>; 497 webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>; 498 webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>; 499} 500type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"> & { 501 readonly id: DurableObjectId; 502 readonly name?: string; 503}; 504interface DurableObjectId { 505 toString(): string; 506 equals(other: DurableObjectId): boolean; 507 readonly name?: string; 508 readonly jurisdiction?: string; 509} 510declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> { 511 newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId; 512 idFromName(name: string): DurableObjectId; 513 idFromString(id: string): DurableObjectId; 514 get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>; 515 getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>; 516 jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>; 517} 518type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high"; 519interface DurableObjectNamespaceNewUniqueIdOptions { 520 jurisdiction?: DurableObjectJurisdiction; 521} 522type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "oc" | "afr" | "me"; 523type DurableObjectRoutingMode = "primary-only"; 524interface DurableObjectNamespaceGetDurableObjectOptions { 525 locationHint?: DurableObjectLocationHint; 526 routingMode?: DurableObjectRoutingMode; 527} 528interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> { 529} 530interface DurableObjectState<Props = unknown> { 531 waitUntil(promise: Promise<any>): void; 532 readonly props: Props; 533 readonly id: DurableObjectId; 534 readonly storage: DurableObjectStorage; 535 container?: Container; 536 blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>; 537 acceptWebSocket(ws: WebSocket, tags?: string[]): void; 538 getWebSockets(tag?: string): WebSocket[]; 539 setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void; 540 getWebSocketAutoResponse(): WebSocketRequestResponsePair | null; 541 getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null; 542 setHibernatableWebSocketEventTimeout(timeoutMs?: number): void; 543 getHibernatableWebSocketEventTimeout(): number | null; 544 getTags(ws: WebSocket): string[]; 545 abort(reason?: string): void; 546} 547interface DurableObjectTransaction { 548 get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>; 549 get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>; 550 list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>; 551 put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>; 552 put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>; 553 delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>; 554 delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>; 555 rollback(): void; 556 getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>; 557 setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>; 558 deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>; 559} 560interface DurableObjectStorage { 561 get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>; 562 get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>; 563 list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>; 564 put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>; 565 put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>; 566 delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>; 567 delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>; 568 deleteAll(options?: DurableObjectPutOptions): Promise<void>; 569 transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>; 570 getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>; 571 setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>; 572 deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>; 573 sync(): Promise<void>; 574 sql: SqlStorage; 575 kv: SyncKvStorage; 576 transactionSync<T>(closure: () => T): T; 577 getCurrentBookmark(): Promise<string>; 578 getBookmarkForTime(timestamp: number | Date): Promise<string>; 579 onNextSessionRestoreBookmark(bookmark: string): Promise<string>; 580} 581interface DurableObjectListOptions { 582 start?: string; 583 startAfter?: string; 584 end?: string; 585 prefix?: string; 586 reverse?: boolean; 587 limit?: number; 588 allowConcurrency?: boolean; 589 noCache?: boolean; 590} 591interface DurableObjectGetOptions { 592 allowConcurrency?: boolean; 593 noCache?: boolean; 594} 595interface DurableObjectGetAlarmOptions { 596 allowConcurrency?: boolean; 597} 598interface DurableObjectPutOptions { 599 allowConcurrency?: boolean; 600 allowUnconfirmed?: boolean; 601 noCache?: boolean; 602} 603interface DurableObjectSetAlarmOptions { 604 allowConcurrency?: boolean; 605 allowUnconfirmed?: boolean; 606} 607declare class WebSocketRequestResponsePair { 608 constructor(request: string, response: string); 609 get request(): string; 610 get response(): string; 611} 612interface AnalyticsEngineDataset { 613 writeDataPoint(event?: AnalyticsEngineDataPoint): void; 614} 615interface AnalyticsEngineDataPoint { 616 indexes?: ((ArrayBuffer | string) | null)[]; 617 doubles?: number[]; 618 blobs?: ((ArrayBuffer | string) | null)[]; 619} 620/** 621 * The **`Event`** interface represents an event which takes place on an `EventTarget`. 622 * 623 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event) 624 */ 625declare class Event { 626 constructor(type: string, init?: EventInit); 627 /** 628 * The **`type`** read-only property of the Event interface returns a string containing the event's type. 629 * 630 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type) 631 */ 632 get type(): string; 633 /** 634 * The **`eventPhase`** read-only property of the being evaluated. 635 * 636 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase) 637 */ 638 get eventPhase(): number; 639 /** 640 * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM. 641 * 642 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed) 643 */ 644 get composed(): boolean; 645 /** 646 * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not. 647 * 648 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles) 649 */ 650 get bubbles(): boolean; 651 /** 652 * 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. 653 * 654 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable) 655 */ 656 get cancelable(): boolean; 657 /** 658 * 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. 659 * 660 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented) 661 */ 662 get defaultPrevented(): boolean; 663 /** 664 * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not. 665 * @deprecated 666 * 667 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue) 668 */ 669 get returnValue(): boolean; 670 /** 671 * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached. 672 * 673 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget) 674 */ 675 get currentTarget(): EventTarget | undefined; 676 /** 677 * The read-only **`target`** property of the dispatched. 678 * 679 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target) 680 */ 681 get target(): EventTarget | undefined; 682 /** 683 * The deprecated **`Event.srcElement`** is an alias for the Event.target property. 684 * @deprecated 685 * 686 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement) 687 */ 688 get srcElement(): EventTarget | undefined; 689 /** 690 * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created. 691 * 692 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp) 693 */ 694 get timeStamp(): number; 695 /** 696 * The **`isTrusted`** read-only property of the 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 The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents. 697 * 698 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted) 699 */ 700 get isTrusted(): boolean; 701 /** 702 * The **`cancelBubble`** property of the Event interface is deprecated. 703 * @deprecated 704 * 705 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) 706 */ 707 get cancelBubble(): boolean; 708 /** 709 * The **`cancelBubble`** property of the Event interface is deprecated. 710 * @deprecated 711 * 712 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) 713 */ 714 set cancelBubble(value: boolean); 715 /** 716 * The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added. 717 * 718 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation) 719 */ 720 stopImmediatePropagation(): void; 721 /** 722 * The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be. 723 * 724 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault) 725 */ 726 preventDefault(): void; 727 /** 728 * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. 729 * 730 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation) 731 */ 732 stopPropagation(): void; 733 /** 734 * 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. 735 * 736 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath) 737 */ 738 composedPath(): EventTarget[]; 739 static readonly NONE: number; 740 static readonly CAPTURING_PHASE: number; 741 static readonly AT_TARGET: number; 742 static readonly BUBBLING_PHASE: number; 743} 744interface EventInit { 745 bubbles?: boolean; 746 cancelable?: boolean; 747 composed?: boolean; 748} 749type EventListener<EventType extends Event = Event> = (event: EventType) => void; 750interface EventListenerObject<EventType extends Event = Event> { 751 handleEvent(event: EventType): void; 752} 753type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>; 754/** 755 * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them. 756 * 757 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget) 758 */ 759declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> { 760 constructor(); 761 /** 762 * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. 763 * 764 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) 765 */ 766 addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void; 767 /** 768 * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. 769 * 770 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) 771 */ 772 removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void; 773 /** 774 * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. 775 * 776 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) 777 */ 778 dispatchEvent(event: EventMap[keyof EventMap]): boolean; 779} 780interface EventTargetEventListenerOptions { 781 capture?: boolean; 782} 783interface EventTargetAddEventListenerOptions { 784 capture?: boolean; 785 passive?: boolean; 786 once?: boolean; 787 signal?: AbortSignal; 788} 789interface EventTargetHandlerObject { 790 handleEvent: (event: Event) => any | undefined; 791} 792/** 793 * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired. 794 * 795 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController) 796 */ 797declare class AbortController { 798 constructor(); 799 /** 800 * 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. 801 * 802 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal) 803 */ 804 get signal(): AbortSignal; 805 /** 806 * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed. 807 * 808 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort) 809 */ 810 abort(reason?: any): void; 811} 812/** 813 * 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. 814 * 815 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal) 816 */ 817declare abstract class AbortSignal extends EventTarget { 818 /** 819 * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event). 820 * 821 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) 822 */ 823 static abort(reason?: any): AbortSignal; 824 /** 825 * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time. 826 * 827 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) 828 */ 829 static timeout(delay: number): AbortSignal; 830 /** 831 * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal. 832 * 833 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) 834 */ 835 static any(signals: AbortSignal[]): AbortSignal; 836 /** 837 * 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`). 838 * 839 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) 840 */ 841 get aborted(): boolean; 842 /** 843 * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason. 844 * 845 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) 846 */ 847 get reason(): any; 848 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ 849 get onabort(): any | null; 850 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ 851 set onabort(value: any | null); 852 /** 853 * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing. 854 * 855 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) 856 */ 857 throwIfAborted(): void; 858} 859interface Scheduler { 860 wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>; 861} 862interface SchedulerWaitOptions { 863 signal?: AbortSignal; 864} 865/** 866 * The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle. 867 * 868 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent) 869 */ 870declare abstract class ExtendableEvent extends Event { 871 /** 872 * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. 873 * 874 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) 875 */ 876 waitUntil(promise: Promise<any>): void; 877} 878/** 879 * The **`CustomEvent`** interface represents events initialized by an application for any purpose. 880 * 881 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) 882 */ 883declare class CustomEvent<T = any> extends Event { 884 constructor(type: string, init?: CustomEventCustomEventInit); 885 /** 886 * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event. 887 * 888 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail) 889 */ 890 get detail(): T; 891} 892interface CustomEventCustomEventInit { 893 bubbles?: boolean; 894 cancelable?: boolean; 895 composed?: boolean; 896 detail?: any; 897} 898/** 899 * 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. 900 * 901 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob) 902 */ 903declare class Blob { 904 constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions); 905 /** 906 * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes. 907 * 908 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) 909 */ 910 get size(): number; 911 /** 912 * The **`type`** read-only property of the Blob interface returns the MIME type of the file. 913 * 914 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) 915 */ 916 get type(): string; 917 /** 918 * 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. 919 * 920 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) 921 */ 922 slice(start?: number, end?: number, type?: string): Blob; 923 /** 924 * 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. 925 * 926 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) 927 */ 928 arrayBuffer(): Promise<ArrayBuffer>; 929 /** 930 * 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. 931 * 932 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes) 933 */ 934 bytes(): Promise<Uint8Array>; 935 /** 936 * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8. 937 * 938 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) 939 */ 940 text(): Promise<string>; 941 /** 942 * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`. 943 * 944 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) 945 */ 946 stream(): ReadableStream; 947} 948interface BlobOptions { 949 type?: string; 950} 951/** 952 * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content. 953 * 954 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File) 955 */ 956declare class File extends Blob { 957 constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions); 958 /** 959 * The **`name`** read-only property of the File interface returns the name of the file represented by a File object. 960 * 961 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) 962 */ 963 get name(): string; 964 /** 965 * 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). 966 * 967 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) 968 */ 969 get lastModified(): number; 970} 971interface FileOptions { 972 type?: string; 973 lastModified?: number; 974} 975/** 976* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. 977* 978* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) 979*/ 980declare abstract class CacheStorage { 981 /** 982 * The **`open()`** method of the the Cache object matching the `cacheName`. 983 * 984 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) 985 */ 986 open(cacheName: string): Promise<Cache>; 987 readonly default: Cache; 988} 989/** 990* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. 991* 992* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) 993*/ 994declare abstract class Cache { 995 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */ 996 delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>; 997 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */ 998 match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>; 999 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */ 1000 put(request: RequestInfo | URL, response: Response): Promise<void>; 1001} 1002interface CacheQueryOptions { 1003 ignoreMethod?: boolean; 1004} 1005/** 1006* The Web Crypto API provides a set of low-level functions for common cryptographic tasks. 1007* The Workers runtime implements the full surface of this API, but with some differences in 1008* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms) 1009* compared to those implemented in most browsers. 1010* 1011* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/) 1012*/ 1013declare abstract class Crypto { 1014 /** 1015 * The **`Crypto.subtle`** read-only property returns a cryptographic operations. 1016 * Available only in secure contexts. 1017 * 1018 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle) 1019 */ 1020 get subtle(): SubtleCrypto; 1021 /** 1022 * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values. 1023 * 1024 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) 1025 */ 1026 getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T; 1027 /** 1028 * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator. 1029 * Available only in secure contexts. 1030 * 1031 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID) 1032 */ 1033 randomUUID(): string; 1034 DigestStream: typeof DigestStream; 1035} 1036/** 1037 * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions. 1038 * Available only in secure contexts. 1039 * 1040 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto) 1041 */ 1042declare abstract class SubtleCrypto { 1043 /** 1044 * The **`encrypt()`** method of the SubtleCrypto interface encrypts data. 1045 * 1046 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt) 1047 */ 1048 encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>; 1049 /** 1050 * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data. 1051 * 1052 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) 1053 */ 1054 decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>; 1055 /** 1056 * The **`sign()`** method of the SubtleCrypto interface generates a digital signature. 1057 * 1058 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign) 1059 */ 1060 sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>; 1061 /** 1062 * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature. 1063 * 1064 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify) 1065 */ 1066 verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>; 1067 /** 1068 * The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function. 1069 * 1070 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) 1071 */ 1072 digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>; 1073 /** 1074 * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms). 1075 * 1076 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) 1077 */ 1078 generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>; 1079 /** 1080 * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key. 1081 * 1082 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) 1083 */ 1084 deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>; 1085 /** 1086 * The **`deriveBits()`** method of the key. 1087 * 1088 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) 1089 */ 1090 deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>; 1091 /** 1092 * 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. 1093 * 1094 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) 1095 */ 1096 importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>; 1097 /** 1098 * 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. 1099 * 1100 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) 1101 */ 1102 exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>; 1103 /** 1104 * The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key. 1105 * 1106 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) 1107 */ 1108 wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>; 1109 /** 1110 * The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key. 1111 * 1112 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) 1113 */ 1114 unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>; 1115 timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean; 1116} 1117/** 1118 * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey. 1119 * Available only in secure contexts. 1120 * 1121 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey) 1122 */ 1123declare abstract class CryptoKey { 1124 /** 1125 * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object. 1126 * 1127 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) 1128 */ 1129 readonly type: string; 1130 /** 1131 * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`. 1132 * 1133 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) 1134 */ 1135 readonly extractable: boolean; 1136 /** 1137 * 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. 1138 * 1139 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) 1140 */ 1141 readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm; 1142 /** 1143 * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key. 1144 * 1145 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) 1146 */ 1147 readonly usages: string[]; 1148} 1149interface CryptoKeyPair { 1150 publicKey: CryptoKey; 1151 privateKey: CryptoKey; 1152} 1153interface JsonWebKey { 1154 kty: string; 1155 use?: string; 1156 key_ops?: string[]; 1157 alg?: string; 1158 ext?: boolean; 1159 crv?: string; 1160 x?: string; 1161 y?: string; 1162 d?: string; 1163 n?: string; 1164 e?: string; 1165 p?: string; 1166 q?: string; 1167 dp?: string; 1168 dq?: string; 1169 qi?: string; 1170 oth?: RsaOtherPrimesInfo[]; 1171 k?: string; 1172} 1173interface RsaOtherPrimesInfo { 1174 r?: string; 1175 d?: string; 1176 t?: string; 1177} 1178interface SubtleCryptoDeriveKeyAlgorithm { 1179 name: string; 1180 salt?: (ArrayBuffer | ArrayBufferView); 1181 iterations?: number; 1182 hash?: (string | SubtleCryptoHashAlgorithm); 1183 $public?: CryptoKey; 1184 info?: (ArrayBuffer | ArrayBufferView); 1185} 1186interface SubtleCryptoEncryptAlgorithm { 1187 name: string; 1188 iv?: (ArrayBuffer | ArrayBufferView); 1189 additionalData?: (ArrayBuffer | ArrayBufferView); 1190 tagLength?: number; 1191 counter?: (ArrayBuffer | ArrayBufferView); 1192 length?: number; 1193 label?: (ArrayBuffer | ArrayBufferView); 1194} 1195interface SubtleCryptoGenerateKeyAlgorithm { 1196 name: string; 1197 hash?: (string | SubtleCryptoHashAlgorithm); 1198 modulusLength?: number; 1199 publicExponent?: (ArrayBuffer | ArrayBufferView); 1200 length?: number; 1201 namedCurve?: string; 1202} 1203interface SubtleCryptoHashAlgorithm { 1204 name: string; 1205} 1206interface SubtleCryptoImportKeyAlgorithm { 1207 name: string; 1208 hash?: (string | SubtleCryptoHashAlgorithm); 1209 length?: number; 1210 namedCurve?: string; 1211 compressed?: boolean; 1212} 1213interface SubtleCryptoSignAlgorithm { 1214 name: string; 1215 hash?: (string | SubtleCryptoHashAlgorithm); 1216 dataLength?: number; 1217 saltLength?: number; 1218} 1219interface CryptoKeyKeyAlgorithm { 1220 name: string; 1221} 1222interface CryptoKeyAesKeyAlgorithm { 1223 name: string; 1224 length: number; 1225} 1226interface CryptoKeyHmacKeyAlgorithm { 1227 name: string; 1228 hash: CryptoKeyKeyAlgorithm; 1229 length: number; 1230} 1231interface CryptoKeyRsaKeyAlgorithm { 1232 name: string; 1233 modulusLength: number; 1234 publicExponent: ArrayBuffer | ArrayBufferView; 1235 hash?: CryptoKeyKeyAlgorithm; 1236} 1237interface CryptoKeyEllipticKeyAlgorithm { 1238 name: string; 1239 namedCurve: string; 1240} 1241interface CryptoKeyArbitraryKeyAlgorithm { 1242 name: string; 1243 hash?: CryptoKeyKeyAlgorithm; 1244 namedCurve?: string; 1245 length?: number; 1246} 1247declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> { 1248 constructor(algorithm: string | SubtleCryptoHashAlgorithm); 1249 readonly digest: Promise<ArrayBuffer>; 1250 get bytesWritten(): number | bigint; 1251} 1252/** 1253 * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc. 1254 * 1255 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder) 1256 */ 1257declare class TextDecoder { 1258 constructor(label?: string, options?: TextDecoderConstructorOptions); 1259 /** 1260 * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter. 1261 * 1262 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode) 1263 */ 1264 decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string; 1265 get encoding(): string; 1266 get fatal(): boolean; 1267 get ignoreBOM(): boolean; 1268} 1269/** 1270 * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes. 1271 * 1272 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder) 1273 */ 1274declare class TextEncoder { 1275 constructor(); 1276 /** 1277 * The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object. 1278 * 1279 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode) 1280 */ 1281 encode(input?: string): Uint8Array; 1282 /** 1283 * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding. 1284 * 1285 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto) 1286 */ 1287 encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; 1288 get encoding(): string; 1289} 1290interface TextDecoderConstructorOptions { 1291 fatal: boolean; 1292 ignoreBOM: boolean; 1293} 1294interface TextDecoderDecodeOptions { 1295 stream: boolean; 1296} 1297interface TextEncoderEncodeIntoResult { 1298 read: number; 1299 written: number; 1300} 1301/** 1302 * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files. 1303 * 1304 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent) 1305 */ 1306declare class ErrorEvent extends Event { 1307 constructor(type: string, init?: ErrorEventErrorEventInit); 1308 /** 1309 * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred. 1310 * 1311 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) 1312 */ 1313 get filename(): string; 1314 /** 1315 * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem. 1316 * 1317 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) 1318 */ 1319 get message(): string; 1320 /** 1321 * 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. 1322 * 1323 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) 1324 */ 1325 get lineno(): number; 1326 /** 1327 * 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. 1328 * 1329 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) 1330 */ 1331 get colno(): number; 1332 /** 1333 * 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. 1334 * 1335 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) 1336 */ 1337 get error(): any; 1338} 1339interface ErrorEventErrorEventInit { 1340 message?: string; 1341 filename?: string; 1342 lineno?: number; 1343 colno?: number; 1344 error?: any; 1345} 1346/** 1347 * The **`MessageEvent`** interface represents a message received by a target object. 1348 * 1349 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent) 1350 */ 1351declare class MessageEvent extends Event { 1352 constructor(type: string, initializer: MessageEventInit); 1353 /** 1354 * The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event. 1355 * 1356 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data) 1357 */ 1358 readonly data: any; 1359 /** 1360 * The **`origin`** read-only property of the origin of the message emitter. 1361 * 1362 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin) 1363 */ 1364 readonly origin: string | null; 1365 /** 1366 * The **`lastEventId`** read-only property of the unique ID for the event. 1367 * 1368 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId) 1369 */ 1370 readonly lastEventId: string; 1371 /** 1372 * The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter. 1373 * 1374 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source) 1375 */ 1376 readonly source: MessagePort | null; 1377 /** 1378 * The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order. 1379 * 1380 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports) 1381 */ 1382 readonly ports: MessagePort[]; 1383} 1384interface MessageEventInit { 1385 data: ArrayBuffer | string; 1386} 1387/** 1388 * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected. 1389 * 1390 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent) 1391 */ 1392declare abstract class PromiseRejectionEvent extends Event { 1393 /** 1394 * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected. 1395 * 1396 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) 1397 */ 1398 readonly promise: Promise<any>; 1399 /** 1400 * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). 1401 * 1402 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) 1403 */ 1404 readonly reason: any; 1405} 1406/** 1407 * 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 Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods. 1408 * 1409 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData) 1410 */ 1411declare class FormData { 1412 constructor(); 1413 /** 1414 * 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. 1415 * 1416 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) 1417 */ 1418 append(name: string, value: string | Blob): void; 1419 /** 1420 * 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. 1421 * 1422 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) 1423 */ 1424 append(name: string, value: string): void; 1425 /** 1426 * 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. 1427 * 1428 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) 1429 */ 1430 append(name: string, value: Blob, filename?: string): void; 1431 /** 1432 * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object. 1433 * 1434 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) 1435 */ 1436 delete(name: string): void; 1437 /** 1438 * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object. 1439 * 1440 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) 1441 */ 1442 get(name: string): (File | string) | null; 1443 /** 1444 * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object. 1445 * 1446 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) 1447 */ 1448 getAll(name: string): (File | string)[]; 1449 /** 1450 * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key. 1451 * 1452 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) 1453 */ 1454 has(name: string): boolean; 1455 /** 1456 * 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. 1457 * 1458 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) 1459 */ 1460 set(name: string, value: string | Blob): void; 1461 /** 1462 * 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. 1463 * 1464 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) 1465 */ 1466 set(name: string, value: string): void; 1467 /** 1468 * 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. 1469 * 1470 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) 1471 */ 1472 set(name: string, value: Blob, filename?: string): void; 1473 /* Returns an array of key, value pairs for every entry in the list. */ 1474 entries(): IterableIterator<[ 1475 key: string, 1476 value: File | string 1477 ]>; 1478 /* Returns a list of keys in the list. */ 1479 keys(): IterableIterator<string>; 1480 /* Returns a list of values in the list. */ 1481 values(): IterableIterator<(File | string)>; 1482 forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void; 1483 [Symbol.iterator](): IterableIterator<[ 1484 key: string, 1485 value: File | string 1486 ]>; 1487} 1488interface ContentOptions { 1489 html?: boolean; 1490} 1491declare class HTMLRewriter { 1492 constructor(); 1493 on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter; 1494 onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; 1495 transform(response: Response): Response; 1496} 1497interface HTMLRewriterElementContentHandlers { 1498 element?(element: Element): void | Promise<void>; 1499 comments?(comment: Comment): void | Promise<void>; 1500 text?(element: Text): void | Promise<void>; 1501} 1502interface HTMLRewriterDocumentContentHandlers { 1503 doctype?(doctype: Doctype): void | Promise<void>; 1504 comments?(comment: Comment): void | Promise<void>; 1505 text?(text: Text): void | Promise<void>; 1506 end?(end: DocumentEnd): void | Promise<void>; 1507} 1508interface Doctype { 1509 readonly name: string | null; 1510 readonly publicId: string | null; 1511 readonly systemId: string | null; 1512} 1513interface Element { 1514 tagName: string; 1515 readonly attributes: IterableIterator<string[]>; 1516 readonly removed: boolean; 1517 readonly namespaceURI: string; 1518 getAttribute(name: string): string | null; 1519 hasAttribute(name: string): boolean; 1520 setAttribute(name: string, value: string): Element; 1521 removeAttribute(name: string): Element; 1522 before(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1523 after(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1524 prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1525 append(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1526 replace(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1527 remove(): Element; 1528 removeAndKeepContent(): Element; 1529 setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1530 onEndTag(handler: (tag: EndTag) => void | Promise<void>): void; 1531} 1532interface EndTag { 1533 name: string; 1534 before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag; 1535 after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag; 1536 remove(): EndTag; 1537} 1538interface Comment { 1539 text: string; 1540 readonly removed: boolean; 1541 before(content: string, options?: ContentOptions): Comment; 1542 after(content: string, options?: ContentOptions): Comment; 1543 replace(content: string, options?: ContentOptions): Comment; 1544 remove(): Comment; 1545} 1546interface Text { 1547 readonly text: string; 1548 readonly lastInTextNode: boolean; 1549 readonly removed: boolean; 1550 before(content: string | ReadableStream | Response, options?: ContentOptions): Text; 1551 after(content: string | ReadableStream | Response, options?: ContentOptions): Text; 1552 replace(content: string | ReadableStream | Response, options?: ContentOptions): Text; 1553 remove(): Text; 1554} 1555interface DocumentEnd { 1556 append(content: string, options?: ContentOptions): DocumentEnd; 1557} 1558/** 1559 * This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope. 1560 * 1561 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent) 1562 */ 1563declare abstract class FetchEvent extends ExtendableEvent { 1564 /** 1565 * The **`request`** read-only property of the the event handler. 1566 * 1567 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) 1568 */ 1569 readonly request: Request; 1570 /** 1571 * The **`respondWith()`** method of allows you to provide a promise for a Response yourself. 1572 * 1573 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) 1574 */ 1575 respondWith(promise: Response | Promise<Response>): void; 1576 passThroughOnException(): void; 1577} 1578type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>; 1579/** 1580 * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers. 1581 * 1582 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers) 1583 */ 1584declare class Headers { 1585 constructor(init?: HeadersInit); 1586 /** 1587 * 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. 1588 * 1589 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get) 1590 */ 1591 get(name: string): string | null; 1592 getAll(name: string): string[]; 1593 /** 1594 * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response. 1595 * 1596 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie) 1597 */ 1598 getSetCookie(): string[]; 1599 /** 1600 * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header. 1601 * 1602 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has) 1603 */ 1604 has(name: string): boolean; 1605 /** 1606 * 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. 1607 * 1608 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set) 1609 */ 1610 set(name: string, value: string): void; 1611 /** 1612 * 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. 1613 * 1614 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append) 1615 */ 1616 append(name: string, value: string): void; 1617 /** 1618 * The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object. 1619 * 1620 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete) 1621 */ 1622 delete(name: string): void; 1623 forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void; 1624 /* Returns an iterator allowing to go through all key/value pairs contained in this object. */ 1625 entries(): IterableIterator<[ 1626 key: string, 1627 value: string 1628 ]>; 1629 /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */ 1630 keys(): IterableIterator<string>; 1631 /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */ 1632 values(): IterableIterator<string>; 1633 [Symbol.iterator](): IterableIterator<[ 1634 key: string, 1635 value: string 1636 ]>; 1637} 1638type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData; 1639declare abstract class Body { 1640 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */ 1641 get body(): ReadableStream | null; 1642 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */ 1643 get bodyUsed(): boolean; 1644 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */ 1645 arrayBuffer(): Promise<ArrayBuffer>; 1646 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */ 1647 bytes(): Promise<Uint8Array>; 1648 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */ 1649 text(): Promise<string>; 1650 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */ 1651 json<T>(): Promise<T>; 1652 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */ 1653 formData(): Promise<FormData>; 1654 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */ 1655 blob(): Promise<Blob>; 1656} 1657/** 1658 * The **`Response`** interface of the Fetch API represents the response to a request. 1659 * 1660 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response) 1661 */ 1662declare var Response: { 1663 prototype: Response; 1664 new (body?: BodyInit | null, init?: ResponseInit): Response; 1665 error(): Response; 1666 redirect(url: string, status?: number): Response; 1667 json(any: any, maybeInit?: (ResponseInit | Response)): Response; 1668}; 1669/** 1670 * The **`Response`** interface of the Fetch API represents the response to a request. 1671 * 1672 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response) 1673 */ 1674interface Response extends Body { 1675 /** 1676 * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable. 1677 * 1678 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) 1679 */ 1680 clone(): Response; 1681 /** 1682 * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response. 1683 * 1684 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) 1685 */ 1686 status: number; 1687 /** 1688 * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status. 1689 * 1690 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) 1691 */ 1692 statusText: string; 1693 /** 1694 * The **`headers`** read-only property of the with the response. 1695 * 1696 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) 1697 */ 1698 headers: Headers; 1699 /** 1700 * 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. 1701 * 1702 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) 1703 */ 1704 ok: boolean; 1705 /** 1706 * 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. 1707 * 1708 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) 1709 */ 1710 redirected: boolean; 1711 /** 1712 * The **`url`** read-only property of the Response interface contains the URL of the response. 1713 * 1714 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) 1715 */ 1716 url: string; 1717 webSocket: WebSocket | null; 1718 cf: any | undefined; 1719 /** 1720 * The **`type`** read-only property of the Response interface contains the type of the response. 1721 * 1722 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type) 1723 */ 1724 type: "default" | "error"; 1725} 1726interface ResponseInit { 1727 status?: number; 1728 statusText?: string; 1729 headers?: HeadersInit; 1730 cf?: any; 1731 webSocket?: (WebSocket | null); 1732 encodeBody?: "automatic" | "manual"; 1733} 1734type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string; 1735/** 1736 * The **`Request`** interface of the Fetch API represents a resource request. 1737 * 1738 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request) 1739 */ 1740declare var Request: { 1741 prototype: Request; 1742 new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>; 1743}; 1744/** 1745 * The **`Request`** interface of the Fetch API represents a resource request. 1746 * 1747 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request) 1748 */ 1749interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body { 1750 /** 1751 * The **`clone()`** method of the Request interface creates a copy of the current `Request` object. 1752 * 1753 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) 1754 */ 1755 clone(): Request<CfHostMetadata, Cf>; 1756 /** 1757 * The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request. 1758 * 1759 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method) 1760 */ 1761 method: string; 1762 /** 1763 * The **`url`** read-only property of the Request interface contains the URL of the request. 1764 * 1765 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url) 1766 */ 1767 url: string; 1768 /** 1769 * The **`headers`** read-only property of the with the request. 1770 * 1771 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers) 1772 */ 1773 headers: Headers; 1774 /** 1775 * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled. 1776 * 1777 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect) 1778 */ 1779 redirect: string; 1780 fetcher: Fetcher | null; 1781 /** 1782 * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request. 1783 * 1784 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal) 1785 */ 1786 signal: AbortSignal; 1787 cf?: Cf; 1788 /** 1789 * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request. 1790 * 1791 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity) 1792 */ 1793 integrity: string; 1794 /** 1795 * 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. 1796 * 1797 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive) 1798 */ 1799 keepalive: boolean; 1800 /** 1801 * The **`cache`** read-only property of the Request interface contains the cache mode of the request. 1802 * 1803 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache) 1804 */ 1805 cache?: "no-store"; 1806} 1807interface RequestInit<Cf = CfProperties> { 1808 /* A string to set request's method. */ 1809 method?: string; 1810 /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */ 1811 headers?: HeadersInit; 1812 /* A BodyInit object or null to set request's body. */ 1813 body?: BodyInit | null; 1814 /* 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. */ 1815 redirect?: string; 1816 fetcher?: (Fetcher | null); 1817 cf?: Cf; 1818 /* A string indicating how the request will interact with the browser's cache to set request's cache. */ 1819 cache?: "no-store"; 1820 /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */ 1821 integrity?: string; 1822 /* An AbortSignal to set request's signal. */ 1823 signal?: (AbortSignal | null); 1824 encodeResponseBody?: "automatic" | "manual"; 1825} 1826type 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>; 1827type Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | "fetch" | "connect"> : unknown) & { 1828 fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>; 1829 connect(address: SocketAddress | string, options?: SocketOptions): Socket; 1830}; 1831interface KVNamespaceListKey<Metadata, Key extends string = string> { 1832 name: Key; 1833 expiration?: number; 1834 metadata?: Metadata; 1835} 1836type KVNamespaceListResult<Metadata, Key extends string = string> = { 1837 list_complete: false; 1838 keys: KVNamespaceListKey<Metadata, Key>[]; 1839 cursor: string; 1840 cacheStatus: string | null; 1841} | { 1842 list_complete: true; 1843 keys: KVNamespaceListKey<Metadata, Key>[]; 1844 cacheStatus: string | null; 1845}; 1846interface KVNamespace<Key extends string = string> { 1847 get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>; 1848 get(key: Key, type: "text"): Promise<string | null>; 1849 get<ExpectedValue = unknown>(key: Key, type: "json"): Promise<ExpectedValue | null>; 1850 get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>; 1851 get(key: Key, type: "stream"): Promise<ReadableStream | null>; 1852 get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise<string | null>; 1853 get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<"json">): Promise<ExpectedValue | null>; 1854 get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise<ArrayBuffer | null>; 1855 get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise<ReadableStream | null>; 1856 get(key: Array<Key>, type: "text"): Promise<Map<string, string | null>>; 1857 get<ExpectedValue = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, ExpectedValue | null>>; 1858 get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>; 1859 get(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, string | null>>; 1860 get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, ExpectedValue | null>>; 1861 list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>; 1862 put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>; 1863 getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>; 1864 getWithMetadata<Metadata = unknown>(key: Key, type: "text"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>; 1865 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: "json"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>; 1866 getWithMetadata<Metadata = unknown>(key: Key, type: "arrayBuffer"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>; 1867 getWithMetadata<Metadata = unknown>(key: Key, type: "stream"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>; 1868 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"text">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>; 1869 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"json">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>; 1870 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>; 1871 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"stream">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>; 1872 getWithMetadata<Metadata = unknown>(key: Array<Key>, type: "text"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>; 1873 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>; 1874 getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>; 1875 getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>; 1876 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>; 1877 delete(key: Key): Promise<void>; 1878} 1879interface KVNamespaceListOptions { 1880 limit?: number; 1881 prefix?: (string | null); 1882 cursor?: (string | null); 1883} 1884interface KVNamespaceGetOptions<Type> { 1885 type: Type; 1886 cacheTtl?: number; 1887} 1888interface KVNamespacePutOptions { 1889 expiration?: number; 1890 expirationTtl?: number; 1891 metadata?: (any | null); 1892} 1893interface KVNamespaceGetWithMetadataResult<Value, Metadata> { 1894 value: Value | null; 1895 metadata: Metadata | null; 1896 cacheStatus: string | null; 1897} 1898type QueueContentType = "text" | "bytes" | "json" | "v8"; 1899interface Queue<Body = unknown> { 1900 send(message: Body, options?: QueueSendOptions): Promise<void>; 1901 sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<void>; 1902} 1903interface QueueSendOptions { 1904 contentType?: QueueContentType; 1905 delaySeconds?: number; 1906} 1907interface QueueSendBatchOptions { 1908 delaySeconds?: number; 1909} 1910interface MessageSendRequest<Body = unknown> { 1911 body: Body; 1912 contentType?: QueueContentType; 1913 delaySeconds?: number; 1914} 1915interface QueueRetryOptions { 1916 delaySeconds?: number; 1917} 1918interface Message<Body = unknown> { 1919 readonly id: string; 1920 readonly timestamp: Date; 1921 readonly body: Body; 1922 readonly attempts: number; 1923 retry(options?: QueueRetryOptions): void; 1924 ack(): void; 1925} 1926interface QueueEvent<Body = unknown> extends ExtendableEvent { 1927 readonly messages: readonly Message<Body>[]; 1928 readonly queue: string; 1929 retryAll(options?: QueueRetryOptions): void; 1930 ackAll(): void; 1931} 1932interface MessageBatch<Body = unknown> { 1933 readonly messages: readonly Message<Body>[]; 1934 readonly queue: string; 1935 retryAll(options?: QueueRetryOptions): void; 1936 ackAll(): void; 1937} 1938interface R2Error extends Error { 1939 readonly name: string; 1940 readonly code: number; 1941 readonly message: string; 1942 readonly action: string; 1943 readonly stack: any; 1944} 1945interface R2ListOptions { 1946 limit?: number; 1947 prefix?: string; 1948 cursor?: string; 1949 delimiter?: string; 1950 startAfter?: string; 1951 include?: ("httpMetadata" | "customMetadata")[]; 1952} 1953declare abstract class R2Bucket { 1954 head(key: string): Promise<R2Object | null>; 1955 get(key: string, options: R2GetOptions & { 1956 onlyIf: R2Conditional | Headers; 1957 }): Promise<R2ObjectBody | R2Object | null>; 1958 get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>; 1959 put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & { 1960 onlyIf: R2Conditional | Headers; 1961 }): Promise<R2Object | null>; 1962 put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>; 1963 createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>; 1964 resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; 1965 delete(keys: string | string[]): Promise<void>; 1966 list(options?: R2ListOptions): Promise<R2Objects>; 1967} 1968interface R2MultipartUpload { 1969 readonly key: string; 1970 readonly uploadId: string; 1971 uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>; 1972 abort(): Promise<void>; 1973 complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>; 1974} 1975interface R2UploadedPart { 1976 partNumber: number; 1977 etag: string; 1978} 1979declare abstract class R2Object { 1980 readonly key: string; 1981 readonly version: string; 1982 readonly size: number; 1983 readonly etag: string; 1984 readonly httpEtag: string; 1985 readonly checksums: R2Checksums; 1986 readonly uploaded: Date; 1987 readonly httpMetadata?: R2HTTPMetadata; 1988 readonly customMetadata?: Record<string, string>; 1989 readonly range?: R2Range; 1990 readonly storageClass: string; 1991 readonly ssecKeyMd5?: string; 1992 writeHttpMetadata(headers: Headers): void; 1993} 1994interface R2ObjectBody extends R2Object { 1995 get body(): ReadableStream; 1996 get bodyUsed(): boolean; 1997 arrayBuffer(): Promise<ArrayBuffer>; 1998 bytes(): Promise<Uint8Array>; 1999 text(): Promise<string>; 2000 json<T>(): Promise<T>; 2001 blob(): Promise<Blob>; 2002} 2003type R2Range = { 2004 offset: number; 2005 length?: number; 2006} | { 2007 offset?: number; 2008 length: number; 2009} | { 2010 suffix: number; 2011}; 2012interface R2Conditional { 2013 etagMatches?: string; 2014 etagDoesNotMatch?: string; 2015 uploadedBefore?: Date; 2016 uploadedAfter?: Date; 2017 secondsGranularity?: boolean; 2018} 2019interface R2GetOptions { 2020 onlyIf?: (R2Conditional | Headers); 2021 range?: (R2Range | Headers); 2022 ssecKey?: (ArrayBuffer | string); 2023} 2024interface R2PutOptions { 2025 onlyIf?: (R2Conditional | Headers); 2026 httpMetadata?: (R2HTTPMetadata | Headers); 2027 customMetadata?: Record<string, string>; 2028 md5?: ((ArrayBuffer | ArrayBufferView) | string); 2029 sha1?: ((ArrayBuffer | ArrayBufferView) | string); 2030 sha256?: ((ArrayBuffer | ArrayBufferView) | string); 2031 sha384?: ((ArrayBuffer | ArrayBufferView) | string); 2032 sha512?: ((ArrayBuffer | ArrayBufferView) | string); 2033 storageClass?: string; 2034 ssecKey?: (ArrayBuffer | string); 2035} 2036interface R2MultipartOptions { 2037 httpMetadata?: (R2HTTPMetadata | Headers); 2038 customMetadata?: Record<string, string>; 2039 storageClass?: string; 2040 ssecKey?: (ArrayBuffer | string); 2041} 2042interface R2Checksums { 2043 readonly md5?: ArrayBuffer; 2044 readonly sha1?: ArrayBuffer; 2045 readonly sha256?: ArrayBuffer; 2046 readonly sha384?: ArrayBuffer; 2047 readonly sha512?: ArrayBuffer; 2048 toJSON(): R2StringChecksums; 2049} 2050interface R2StringChecksums { 2051 md5?: string; 2052 sha1?: string; 2053 sha256?: string; 2054 sha384?: string; 2055 sha512?: string; 2056} 2057interface R2HTTPMetadata { 2058 contentType?: string; 2059 contentLanguage?: string; 2060 contentDisposition?: string; 2061 contentEncoding?: string; 2062 cacheControl?: string; 2063 cacheExpiry?: Date; 2064} 2065type R2Objects = { 2066 objects: R2Object[]; 2067 delimitedPrefixes: string[]; 2068} & ({ 2069 truncated: true; 2070 cursor: string; 2071} | { 2072 truncated: false; 2073}); 2074interface R2UploadPartOptions { 2075 ssecKey?: (ArrayBuffer | string); 2076} 2077declare abstract class ScheduledEvent extends ExtendableEvent { 2078 readonly scheduledTime: number; 2079 readonly cron: string; 2080 noRetry(): void; 2081} 2082interface ScheduledController { 2083 readonly scheduledTime: number; 2084 readonly cron: string; 2085 noRetry(): void; 2086} 2087interface QueuingStrategy<T = any> { 2088 highWaterMark?: (number | bigint); 2089 size?: (chunk: T) => number | bigint; 2090} 2091interface UnderlyingSink<W = any> { 2092 type?: string; 2093 start?: (controller: WritableStreamDefaultController) => void | Promise<void>; 2094 write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>; 2095 abort?: (reason: any) => void | Promise<void>; 2096 close?: () => void | Promise<void>; 2097} 2098interface UnderlyingByteSource { 2099 type: "bytes"; 2100 autoAllocateChunkSize?: number; 2101 start?: (controller: ReadableByteStreamController) => void | Promise<void>; 2102 pull?: (controller: ReadableByteStreamController) => void | Promise<void>; 2103 cancel?: (reason: any) => void | Promise<void>; 2104} 2105interface UnderlyingSource<R = any> { 2106 type?: "" | undefined; 2107 start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>; 2108 pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>; 2109 cancel?: (reason: any) => void | Promise<void>; 2110 expectedLength?: (number | bigint); 2111} 2112interface Transformer<I = any, O = any> { 2113 readableType?: string; 2114 writableType?: string; 2115 start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>; 2116 transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>; 2117 flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>; 2118 cancel?: (reason: any) => void | Promise<void>; 2119 expectedLength?: number; 2120} 2121interface StreamPipeOptions { 2122 preventAbort?: boolean; 2123 preventCancel?: boolean; 2124 /** 2125 * 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. 2126 * 2127 * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. 2128 * 2129 * Errors and closures of the source and destination streams propagate as follows: 2130 * 2131 * 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. 2132 * 2133 * 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. 2134 * 2135 * 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. 2136 * 2137 * 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. 2138 * 2139 * 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. 2140 */ 2141 preventClose?: boolean; 2142 signal?: AbortSignal; 2143} 2144type ReadableStreamReadResult<R = any> = { 2145 done: false; 2146 value: R; 2147} | { 2148 done: true; 2149 value?: undefined; 2150}; 2151/** 2152 * The `ReadableStream` interface of the Streams API represents a readable stream of byte data. 2153 * 2154 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream) 2155 */ 2156interface ReadableStream<R = any> { 2157 /** 2158 * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader. 2159 * 2160 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) 2161 */ 2162 get locked(): boolean; 2163 /** 2164 * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled. 2165 * 2166 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) 2167 */ 2168 cancel(reason?: any): Promise<void>; 2169 /** 2170 * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. 2171 * 2172 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) 2173 */ 2174 getReader(): ReadableStreamDefaultReader<R>; 2175 /** 2176 * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. 2177 * 2178 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) 2179 */ 2180 getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; 2181 /** 2182 * 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. 2183 * 2184 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) 2185 */ 2186 pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>; 2187 /** 2188 * 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. 2189 * 2190 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) 2191 */ 2192 pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>; 2193 /** 2194 * The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances. 2195 * 2196 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) 2197 */ 2198 tee(): [ 2199 ReadableStream<R>, 2200 ReadableStream<R> 2201 ]; 2202 values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>; 2203 [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>; 2204} 2205/** 2206 * The `ReadableStream` interface of the Streams API represents a readable stream of byte data. 2207 * 2208 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream) 2209 */ 2210declare const ReadableStream: { 2211 prototype: ReadableStream; 2212 new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>; 2213 new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>; 2214}; 2215/** 2216 * 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). 2217 * 2218 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader) 2219 */ 2220declare class ReadableStreamDefaultReader<R = any> { 2221 constructor(stream: ReadableStream); 2222 get closed(): Promise<void>; 2223 cancel(reason?: any): Promise<void>; 2224 /** 2225 * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue. 2226 * 2227 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) 2228 */ 2229 read(): Promise<ReadableStreamReadResult<R>>; 2230 /** 2231 * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream. 2232 * 2233 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) 2234 */ 2235 releaseLock(): void; 2236} 2237/** 2238 * The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source. 2239 * 2240 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) 2241 */ 2242declare class ReadableStreamBYOBReader { 2243 constructor(stream: ReadableStream); 2244 get closed(): Promise<void>; 2245 cancel(reason?: any): Promise<void>; 2246 /** 2247 * 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. 2248 * 2249 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) 2250 */ 2251 read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>; 2252 /** 2253 * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream. 2254 * 2255 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) 2256 */ 2257 releaseLock(): void; 2258 readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>; 2259} 2260interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions { 2261 min?: number; 2262} 2263interface ReadableStreamGetReaderOptions { 2264 /** 2265 * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. 2266 * 2267 * 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. 2268 */ 2269 mode: "byob"; 2270} 2271/** 2272 * 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). 2273 * 2274 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) 2275 */ 2276declare abstract class ReadableStreamBYOBRequest { 2277 /** 2278 * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view. 2279 * 2280 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) 2281 */ 2282 get view(): Uint8Array | null; 2283 /** 2284 * 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. 2285 * 2286 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) 2287 */ 2288 respond(bytesWritten: number): void; 2289 /** 2290 * 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. 2291 * 2292 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) 2293 */ 2294 respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; 2295 get atLeast(): number | null; 2296} 2297/** 2298 * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. 2299 * 2300 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) 2301 */ 2302declare abstract class ReadableStreamDefaultController<R = any> { 2303 /** 2304 * The **`desiredSize`** read-only property of the required to fill the stream's internal queue. 2305 * 2306 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) 2307 */ 2308 get desiredSize(): number | null; 2309 /** 2310 * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream. 2311 * 2312 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) 2313 */ 2314 close(): void; 2315 /** 2316 * The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue. 2317 * 2318 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) 2319 */ 2320 enqueue(chunk?: R): void; 2321 /** 2322 * The **`error()`** method of the with the associated stream to error. 2323 * 2324 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) 2325 */ 2326 error(reason: any): void; 2327} 2328/** 2329 * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream. 2330 * 2331 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) 2332 */ 2333declare abstract class ReadableByteStreamController { 2334 /** 2335 * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests. 2336 * 2337 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) 2338 */ 2339 get byobRequest(): ReadableStreamBYOBRequest | null; 2340 /** 2341 * 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'. 2342 * 2343 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) 2344 */ 2345 get desiredSize(): number | null; 2346 /** 2347 * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream. 2348 * 2349 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) 2350 */ 2351 close(): void; 2352 /** 2353 * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues). 2354 * 2355 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) 2356 */ 2357 enqueue(chunk: ArrayBuffer | ArrayBufferView): void; 2358 /** 2359 * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason. 2360 * 2361 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) 2362 */ 2363 error(reason: any): void; 2364} 2365/** 2366 * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state. 2367 * 2368 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController) 2369 */ 2370declare abstract class WritableStreamDefaultController { 2371 /** 2372 * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller. 2373 * 2374 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) 2375 */ 2376 get signal(): AbortSignal; 2377 /** 2378 * The **`error()`** method of the with the associated stream to error. 2379 * 2380 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) 2381 */ 2382 error(reason?: any): void; 2383} 2384/** 2385 * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream. 2386 * 2387 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) 2388 */ 2389declare abstract class TransformStreamDefaultController<O = any> { 2390 /** 2391 * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream. 2392 * 2393 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) 2394 */ 2395 get desiredSize(): number | null; 2396 /** 2397 * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream. 2398 * 2399 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) 2400 */ 2401 enqueue(chunk?: O): void; 2402 /** 2403 * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream. 2404 * 2405 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) 2406 */ 2407 error(reason: any): void; 2408 /** 2409 * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream. 2410 * 2411 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) 2412 */ 2413 terminate(): void; 2414} 2415interface ReadableWritablePair<R = any, W = any> { 2416 readable: ReadableStream<R>; 2417 /** 2418 * 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. 2419 * 2420 * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. 2421 */ 2422 writable: WritableStream<W>; 2423} 2424/** 2425 * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. 2426 * 2427 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream) 2428 */ 2429declare class WritableStream<W = any> { 2430 constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy); 2431 /** 2432 * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer. 2433 * 2434 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) 2435 */ 2436 get locked(): boolean; 2437 /** 2438 * 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. 2439 * 2440 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) 2441 */ 2442 abort(reason?: any): Promise<void>; 2443 /** 2444 * The **`close()`** method of the WritableStream interface closes the associated stream. 2445 * 2446 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) 2447 */ 2448 close(): Promise<void>; 2449 /** 2450 * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. 2451 * 2452 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) 2453 */ 2454 getWriter(): WritableStreamDefaultWriter<W>; 2455} 2456/** 2457 * 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. 2458 * 2459 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter) 2460 */ 2461declare class WritableStreamDefaultWriter<W = any> { 2462 constructor(stream: WritableStream); 2463 /** 2464 * The **`closed`** read-only property of the the stream errors or the writer's lock is released. 2465 * 2466 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) 2467 */ 2468 get closed(): Promise<void>; 2469 /** 2470 * The **`ready`** read-only property of the 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. 2471 * 2472 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) 2473 */ 2474 get ready(): Promise<void>; 2475 /** 2476 * The **`desiredSize`** read-only property of the to fill the stream's internal queue. 2477 * 2478 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) 2479 */ 2480 get desiredSize(): number | null; 2481 /** 2482 * The **`abort()`** method of the 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. 2483 * 2484 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) 2485 */ 2486 abort(reason?: any): Promise<void>; 2487 /** 2488 * The **`close()`** method of the stream. 2489 * 2490 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) 2491 */ 2492 close(): Promise<void>; 2493 /** 2494 * The **`write()`** method of the operation. 2495 * 2496 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) 2497 */ 2498 write(chunk?: W): Promise<void>; 2499 /** 2500 * The **`releaseLock()`** method of the corresponding stream. 2501 * 2502 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) 2503 */ 2504 releaseLock(): void; 2505} 2506/** 2507 * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept. 2508 * 2509 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream) 2510 */ 2511declare class TransformStream<I = any, O = any> { 2512 constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>); 2513 /** 2514 * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`. 2515 * 2516 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) 2517 */ 2518 get readable(): ReadableStream<O>; 2519 /** 2520 * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`. 2521 * 2522 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) 2523 */ 2524 get writable(): WritableStream<I>; 2525} 2526declare class FixedLengthStream extends IdentityTransformStream { 2527 constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy); 2528} 2529declare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> { 2530 constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy); 2531} 2532interface IdentityTransformStreamQueuingStrategy { 2533 highWaterMark?: (number | bigint); 2534} 2535interface ReadableStreamValuesOptions { 2536 preventCancel?: boolean; 2537} 2538/** 2539 * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data. 2540 * 2541 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) 2542 */ 2543declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> { 2544 constructor(format: "gzip" | "deflate" | "deflate-raw"); 2545} 2546/** 2547 * The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data. 2548 * 2549 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) 2550 */ 2551declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> { 2552 constructor(format: "gzip" | "deflate" | "deflate-raw"); 2553} 2554/** 2555 * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. 2556 * 2557 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream) 2558 */ 2559declare class TextEncoderStream extends TransformStream<string, Uint8Array> { 2560 constructor(); 2561 get encoding(): string; 2562} 2563/** 2564 * 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. 2565 * 2566 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream) 2567 */ 2568declare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> { 2569 constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); 2570 get encoding(): string; 2571 get fatal(): boolean; 2572 get ignoreBOM(): boolean; 2573} 2574interface TextDecoderStreamTextDecoderStreamInit { 2575 fatal?: boolean; 2576 ignoreBOM?: boolean; 2577} 2578/** 2579 * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. 2580 * 2581 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy) 2582 */ 2583declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> { 2584 constructor(init: QueuingStrategyInit); 2585 /** 2586 * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied. 2587 * 2588 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) 2589 */ 2590 get highWaterMark(): number; 2591 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */ 2592 get size(): (chunk?: any) => number; 2593} 2594/** 2595 * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams. 2596 * 2597 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy) 2598 */ 2599declare class CountQueuingStrategy implements QueuingStrategy { 2600 constructor(init: QueuingStrategyInit); 2601 /** 2602 * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied. 2603 * 2604 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) 2605 */ 2606 get highWaterMark(): number; 2607 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */ 2608 get size(): (chunk?: any) => number; 2609} 2610interface QueuingStrategyInit { 2611 /** 2612 * Creates a new ByteLengthQueuingStrategy with the provided high water mark. 2613 * 2614 * 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. 2615 */ 2616 highWaterMark: number; 2617} 2618interface TracePreviewInfo { 2619 id: string; 2620 slug: string; 2621 name: string; 2622} 2623interface ScriptVersion { 2624 id?: string; 2625 tag?: string; 2626 message?: string; 2627} 2628declare abstract class TailEvent extends ExtendableEvent { 2629 readonly events: TraceItem[]; 2630 readonly traces: TraceItem[]; 2631} 2632interface TraceItem { 2633 readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemConnectEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null; 2634 readonly eventTimestamp: number | null; 2635 readonly logs: TraceLog[]; 2636 readonly exceptions: TraceException[]; 2637 readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[]; 2638 readonly scriptName: string | null; 2639 readonly entrypoint?: string; 2640 readonly scriptVersion?: ScriptVersion; 2641 readonly dispatchNamespace?: string; 2642 readonly scriptTags?: string[]; 2643 readonly tailAttributes?: Record<string, boolean | number | string>; 2644 readonly preview?: TracePreviewInfo; 2645 readonly durableObjectId?: string; 2646 readonly outcome: string; 2647 readonly executionModel: string; 2648 readonly truncated: boolean; 2649 readonly cpuTime: number; 2650 readonly wallTime: number; 2651} 2652interface TraceItemAlarmEventInfo { 2653 readonly scheduledTime: Date; 2654} 2655interface TraceItemConnectEventInfo { 2656} 2657interface TraceItemCustomEventInfo { 2658} 2659interface TraceItemScheduledEventInfo { 2660 readonly scheduledTime: number; 2661 readonly cron: string; 2662} 2663interface TraceItemQueueEventInfo { 2664 readonly queue: string; 2665 readonly batchSize: number; 2666} 2667interface TraceItemEmailEventInfo { 2668 readonly mailFrom: string; 2669 readonly rcptTo: string; 2670 readonly rawSize: number; 2671} 2672interface TraceItemTailEventInfo { 2673 readonly consumedEvents: TraceItemTailEventInfoTailItem[]; 2674} 2675interface TraceItemTailEventInfoTailItem { 2676 readonly scriptName: string | null; 2677} 2678interface TraceItemFetchEventInfo { 2679 readonly response?: TraceItemFetchEventInfoResponse; 2680 readonly request: TraceItemFetchEventInfoRequest; 2681} 2682interface TraceItemFetchEventInfoRequest { 2683 readonly cf?: any; 2684 readonly headers: Record<string, string>; 2685 readonly method: string; 2686 readonly url: string; 2687 getUnredacted(): TraceItemFetchEventInfoRequest; 2688} 2689interface TraceItemFetchEventInfoResponse { 2690 readonly status: number; 2691} 2692interface TraceItemJsRpcEventInfo { 2693 readonly rpcMethod: string; 2694} 2695interface TraceItemHibernatableWebSocketEventInfo { 2696 readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError; 2697} 2698interface TraceItemHibernatableWebSocketEventInfoMessage { 2699 readonly webSocketEventType: string; 2700} 2701interface TraceItemHibernatableWebSocketEventInfoClose { 2702 readonly webSocketEventType: string; 2703 readonly code: number; 2704 readonly wasClean: boolean; 2705} 2706interface TraceItemHibernatableWebSocketEventInfoError { 2707 readonly webSocketEventType: string; 2708} 2709interface TraceLog { 2710 readonly timestamp: number; 2711 readonly level: string; 2712 readonly message: any; 2713} 2714interface TraceException { 2715 readonly timestamp: number; 2716 readonly message: string; 2717 readonly name: string; 2718 readonly stack?: string; 2719} 2720interface TraceDiagnosticChannelEvent { 2721 readonly timestamp: number; 2722 readonly channel: string; 2723 readonly message: any; 2724} 2725interface TraceMetrics { 2726 readonly cpuTime: number; 2727 readonly wallTime: number; 2728} 2729interface UnsafeTraceMetrics { 2730 fromTrace(item: TraceItem): TraceMetrics; 2731} 2732/** 2733 * The **`URL`** interface is used to parse, construct, normalize, and encode URL. 2734 * 2735 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL) 2736 */ 2737declare class URL { 2738 constructor(url: string | URL, base?: string | URL); 2739 /** 2740 * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL. 2741 * 2742 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) 2743 */ 2744 get origin(): string; 2745 /** 2746 * The **`href`** property of the URL interface is a string containing the whole URL. 2747 * 2748 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) 2749 */ 2750 get href(): string; 2751 /** 2752 * The **`href`** property of the URL interface is a string containing the whole URL. 2753 * 2754 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) 2755 */ 2756 set href(value: string); 2757 /** 2758 * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`. 2759 * 2760 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) 2761 */ 2762 get protocol(): string; 2763 /** 2764 * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`. 2765 * 2766 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) 2767 */ 2768 set protocol(value: string); 2769 /** 2770 * The **`username`** property of the URL interface is a string containing the username component of the URL. 2771 * 2772 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) 2773 */ 2774 get username(): string; 2775 /** 2776 * The **`username`** property of the URL interface is a string containing the username component of the URL. 2777 * 2778 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) 2779 */ 2780 set username(value: string); 2781 /** 2782 * The **`password`** property of the URL interface is a string containing the password component of the URL. 2783 * 2784 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) 2785 */ 2786 get password(): string; 2787 /** 2788 * The **`password`** property of the URL interface is a string containing the password component of the URL. 2789 * 2790 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) 2791 */ 2792 set password(value: string); 2793 /** 2794 * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL. 2795 * 2796 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) 2797 */ 2798 get host(): string; 2799 /** 2800 * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL. 2801 * 2802 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) 2803 */ 2804 set host(value: string); 2805 /** 2806 * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. 2807 * 2808 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) 2809 */ 2810 get hostname(): string; 2811 /** 2812 * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. 2813 * 2814 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) 2815 */ 2816 set hostname(value: string); 2817 /** 2818 * The **`port`** property of the URL interface is a string containing the port number of the URL. 2819 * 2820 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) 2821 */ 2822 get port(): string; 2823 /** 2824 * The **`port`** property of the URL interface is a string containing the port number of the URL. 2825 * 2826 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) 2827 */ 2828 set port(value: string); 2829 /** 2830 * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. 2831 * 2832 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) 2833 */ 2834 get pathname(): string; 2835 /** 2836 * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. 2837 * 2838 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) 2839 */ 2840 set pathname(value: string); 2841 /** 2842 * 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. 2843 * 2844 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) 2845 */ 2846 get search(): string; 2847 /** 2848 * 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. 2849 * 2850 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) 2851 */ 2852 set search(value: string); 2853 /** 2854 * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL. 2855 * 2856 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) 2857 */ 2858 get hash(): string; 2859 /** 2860 * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL. 2861 * 2862 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) 2863 */ 2864 set hash(value: string); 2865 /** 2866 * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL. 2867 * 2868 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) 2869 */ 2870 get searchParams(): URLSearchParams; 2871 /** 2872 * 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 ```js-nolint toJSON() ``` None. 2873 * 2874 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) 2875 */ 2876 toJSON(): string; 2877 /*function toString() { [native code] }*/ 2878 toString(): string; 2879 /** 2880 * 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. 2881 * 2882 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) 2883 */ 2884 static canParse(url: string, base?: string): boolean; 2885 /** 2886 * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters. 2887 * 2888 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static) 2889 */ 2890 static parse(url: string, base?: string): URL | null; 2891 /** 2892 * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter. 2893 * 2894 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static) 2895 */ 2896 static createObjectURL(object: File | Blob): string; 2897 /** 2898 * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer. 2899 * 2900 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static) 2901 */ 2902 static revokeObjectURL(object_url: string): void; 2903} 2904/** 2905 * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL. 2906 * 2907 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) 2908 */ 2909declare class URLSearchParams { 2910 constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string)); 2911 /** 2912 * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries. 2913 * 2914 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) 2915 */ 2916 get size(): number; 2917 /** 2918 * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter. 2919 * 2920 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append) 2921 */ 2922 append(name: string, value: string): void; 2923 /** 2924 * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters. 2925 * 2926 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete) 2927 */ 2928 delete(name: string, value?: string): void; 2929 /** 2930 * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter. 2931 * 2932 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get) 2933 */ 2934 get(name: string): string | null; 2935 /** 2936 * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array. 2937 * 2938 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll) 2939 */ 2940 getAll(name: string): string[]; 2941 /** 2942 * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters. 2943 * 2944 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has) 2945 */ 2946 has(name: string, value?: string): boolean; 2947 /** 2948 * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value. 2949 * 2950 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set) 2951 */ 2952 set(name: string, value: string): void; 2953 /** 2954 * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`. 2955 * 2956 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) 2957 */ 2958 sort(): void; 2959 /* Returns an array of key, value pairs for every entry in the search params. */ 2960 entries(): IterableIterator<[ 2961 key: string, 2962 value: string 2963 ]>; 2964 /* Returns a list of keys in the search params. */ 2965 keys(): IterableIterator<string>; 2966 /* Returns a list of values in the search params. */ 2967 values(): IterableIterator<string>; 2968 forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void; 2969 /*function toString() { [native code] }*/ 2970 toString(): string; 2971 [Symbol.iterator](): IterableIterator<[ 2972 key: string, 2973 value: string 2974 ]>; 2975} 2976declare class URLPattern { 2977 constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions); 2978 get protocol(): string; 2979 get username(): string; 2980 get password(): string; 2981 get hostname(): string; 2982 get port(): string; 2983 get pathname(): string; 2984 get search(): string; 2985 get hash(): string; 2986 get hasRegExpGroups(): boolean; 2987 test(input?: (string | URLPatternInit), baseURL?: string): boolean; 2988 exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null; 2989} 2990interface URLPatternInit { 2991 protocol?: string; 2992 username?: string; 2993 password?: string; 2994 hostname?: string; 2995 port?: string; 2996 pathname?: string; 2997 search?: string; 2998 hash?: string; 2999 baseURL?: string; 3000} 3001interface URLPatternComponentResult { 3002 input: string; 3003 groups: Record<string, string>; 3004} 3005interface URLPatternResult { 3006 inputs: (string | URLPatternInit)[]; 3007 protocol: URLPatternComponentResult; 3008 username: URLPatternComponentResult; 3009 password: URLPatternComponentResult; 3010 hostname: URLPatternComponentResult; 3011 port: URLPatternComponentResult; 3012 pathname: URLPatternComponentResult; 3013 search: URLPatternComponentResult; 3014 hash: URLPatternComponentResult; 3015} 3016interface URLPatternOptions { 3017 ignoreCase?: boolean; 3018} 3019/** 3020 * A `CloseEvent` is sent to clients using WebSockets when the connection is closed. 3021 * 3022 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent) 3023 */ 3024declare class CloseEvent extends Event { 3025 constructor(type: string, initializer?: CloseEventInit); 3026 /** 3027 * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed. 3028 * 3029 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) 3030 */ 3031 readonly code: number; 3032 /** 3033 * 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. 3034 * 3035 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason) 3036 */ 3037 readonly reason: string; 3038 /** 3039 * The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly. 3040 * 3041 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean) 3042 */ 3043 readonly wasClean: boolean; 3044} 3045interface CloseEventInit { 3046 code?: number; 3047 reason?: string; 3048 wasClean?: boolean; 3049} 3050type WebSocketEventMap = { 3051 close: CloseEvent; 3052 message: MessageEvent; 3053 open: Event; 3054 error: ErrorEvent; 3055}; 3056/** 3057 * 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. 3058 * 3059 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket) 3060 */ 3061declare var WebSocket: { 3062 prototype: WebSocket; 3063 new (url: string, protocols?: (string[] | string)): WebSocket; 3064 readonly READY_STATE_CONNECTING: number; 3065 readonly CONNECTING: number; 3066 readonly READY_STATE_OPEN: number; 3067 readonly OPEN: number; 3068 readonly READY_STATE_CLOSING: number; 3069 readonly CLOSING: number; 3070 readonly READY_STATE_CLOSED: number; 3071 readonly CLOSED: number; 3072}; 3073/** 3074 * 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. 3075 * 3076 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket) 3077 */ 3078interface WebSocket extends EventTarget<WebSocketEventMap> { 3079 accept(options?: WebSocketAcceptOptions): void; 3080 /** 3081 * 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. 3082 * 3083 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send) 3084 */ 3085 send(message: (ArrayBuffer | ArrayBufferView) | string): void; 3086 /** 3087 * The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing. 3088 * 3089 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close) 3090 */ 3091 close(code?: number, reason?: string): void; 3092 serializeAttachment(attachment: any): void; 3093 deserializeAttachment(): any | null; 3094 /** 3095 * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection. 3096 * 3097 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState) 3098 */ 3099 readyState: number; 3100 /** 3101 * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor. 3102 * 3103 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url) 3104 */ 3105 url: string | null; 3106 /** 3107 * 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. 3108 * 3109 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol) 3110 */ 3111 protocol: string | null; 3112 /** 3113 * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server. 3114 * 3115 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions) 3116 */ 3117 extensions: string | null; 3118 /** 3119 * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection. 3120 * 3121 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType) 3122 */ 3123 binaryType: "blob" | "arraybuffer"; 3124} 3125interface WebSocketAcceptOptions { 3126 /** 3127 * When set to `true`, receiving a server-initiated WebSocket Close frame will not 3128 * automatically send a reciprocal Close frame, leaving the connection in a half-open 3129 * state. This is useful for proxying scenarios where you need to coordinate closing 3130 * both sides independently. Defaults to `false` when the 3131 * `no_web_socket_half_open_by_default` compatibility flag is enabled. 3132 */ 3133 allowHalfOpen?: boolean; 3134} 3135declare const WebSocketPair: { 3136 new (): { 3137 0: WebSocket; 3138 1: WebSocket; 3139 }; 3140}; 3141interface SqlStorage { 3142 exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>; 3143 get databaseSize(): number; 3144 Cursor: typeof SqlStorageCursor; 3145 Statement: typeof SqlStorageStatement; 3146} 3147declare abstract class SqlStorageStatement { 3148} 3149type SqlStorageValue = ArrayBuffer | string | number | null; 3150declare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> { 3151 next(): { 3152 done?: false; 3153 value: T; 3154 } | { 3155 done: true; 3156 value?: never; 3157 }; 3158 toArray(): T[]; 3159 one(): T; 3160 raw<U extends SqlStorageValue[]>(): IterableIterator<U>; 3161 columnNames: string[]; 3162 get rowsRead(): number; 3163 get rowsWritten(): number; 3164 [Symbol.iterator](): IterableIterator<T>; 3165} 3166interface Socket { 3167 get readable(): ReadableStream; 3168 get writable(): WritableStream; 3169 get closed(): Promise<void>; 3170 get opened(): Promise<SocketInfo>; 3171 get upgraded(): boolean; 3172 get secureTransport(): "on" | "off" | "starttls"; 3173 close(): Promise<void>; 3174 startTls(options?: TlsOptions): Socket; 3175} 3176interface SocketOptions { 3177 secureTransport?: string; 3178 allowHalfOpen: boolean; 3179 highWaterMark?: (number | bigint); 3180} 3181interface SocketAddress { 3182 hostname: string; 3183 port: number; 3184} 3185interface TlsOptions { 3186 expectedServerHostname?: string; 3187} 3188interface SocketInfo { 3189 remoteAddress?: string; 3190 localAddress?: string; 3191} 3192/** 3193 * The **`EventSource`** interface is web content's interface to server-sent events. 3194 * 3195 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) 3196 */ 3197declare class EventSource extends EventTarget { 3198 constructor(url: string, init?: EventSourceEventSourceInit); 3199 /** 3200 * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None. 3201 * 3202 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close) 3203 */ 3204 close(): void; 3205 /** 3206 * The **`url`** read-only property of the URL of the source. 3207 * 3208 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url) 3209 */ 3210 get url(): string; 3211 /** 3212 * The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set. 3213 * 3214 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials) 3215 */ 3216 get withCredentials(): boolean; 3217 /** 3218 * The **`readyState`** read-only property of the connection. 3219 * 3220 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState) 3221 */ 3222 get readyState(): number; 3223 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ 3224 get onopen(): any | null; 3225 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ 3226 set onopen(value: any | null); 3227 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ 3228 get onmessage(): any | null; 3229 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ 3230 set onmessage(value: any | null); 3231 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ 3232 get onerror(): any | null; 3233 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ 3234 set onerror(value: any | null); 3235 static readonly CONNECTING: number; 3236 static readonly OPEN: number; 3237 static readonly CLOSED: number; 3238 static from(stream: ReadableStream): EventSource; 3239} 3240interface EventSourceEventSourceInit { 3241 withCredentials?: boolean; 3242 fetcher?: Fetcher; 3243} 3244interface Container { 3245 get running(): boolean; 3246 start(options?: ContainerStartupOptions): void; 3247 monitor(): Promise<void>; 3248 destroy(error?: any): Promise<void>; 3249 signal(signo: number): void; 3250 getTcpPort(port: number): Fetcher; 3251 setInactivityTimeout(durationMs: number | bigint): Promise<void>; 3252 interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>; 3253 interceptAllOutboundHttp(binding: Fetcher): Promise<void>; 3254 snapshotDirectory(options: ContainerDirectorySnapshotOptions): Promise<ContainerDirectorySnapshot>; 3255 snapshotContainer(options: ContainerSnapshotOptions): Promise<ContainerSnapshot>; 3256} 3257interface ContainerDirectorySnapshot { 3258 id: string; 3259 size: number; 3260 dir: string; 3261 name?: string; 3262} 3263interface ContainerDirectorySnapshotOptions { 3264 dir: string; 3265 name?: string; 3266} 3267interface ContainerDirectorySnapshotRestoreParams { 3268 snapshot: ContainerDirectorySnapshot; 3269 mountPoint?: string; 3270} 3271interface ContainerSnapshot { 3272 id: string; 3273 size: number; 3274 name?: string; 3275} 3276interface ContainerSnapshotOptions { 3277 name?: string; 3278} 3279interface ContainerStartupOptions { 3280 entrypoint?: string[]; 3281 enableInternet: boolean; 3282 env?: Record<string, string>; 3283 labels?: Record<string, string>; 3284 directorySnapshots?: ContainerDirectorySnapshotRestoreParams[]; 3285 containerSnapshot?: ContainerSnapshot; 3286} 3287/** 3288 * 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. 3289 * 3290 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort) 3291 */ 3292declare abstract class MessagePort extends EventTarget { 3293 /** 3294 * The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts. 3295 * 3296 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage) 3297 */ 3298 postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void; 3299 /** 3300 * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. 3301 * 3302 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close) 3303 */ 3304 close(): void; 3305 /** 3306 * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. 3307 * 3308 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start) 3309 */ 3310 start(): void; 3311 get onmessage(): any | null; 3312 set onmessage(value: any | null); 3313} 3314interface MessagePortPostMessageOptions { 3315 transfer?: any[]; 3316} 3317type 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; 3318type LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: { 3319 props?: Props; 3320}) => Fetcher<T> : (opts: { 3321 props?: any; 3322}) => Fetcher<T>); 3323type LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: { 3324 props?: Props; 3325}) => DurableObjectClass<T> : (opts: { 3326 props?: any; 3327}) => DurableObjectClass<T>); 3328interface SyncKvStorage { 3329 get<T = unknown>(key: string): T | undefined; 3330 list<T = unknown>(options?: SyncKvListOptions): Iterable<[ 3331 string, 3332 T 3333 ]>; 3334 put<T>(key: string, value: T): void; 3335 delete(key: string): boolean; 3336} 3337interface SyncKvListOptions { 3338 start?: string; 3339 startAfter?: string; 3340 end?: string; 3341 prefix?: string; 3342 reverse?: boolean; 3343 limit?: number; 3344} 3345interface WorkerStub { 3346 getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>; 3347} 3348interface WorkerStubEntrypointOptions { 3349 props?: any; 3350} 3351interface WorkerLoader { 3352 get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub; 3353 load(code: WorkerLoaderWorkerCode): WorkerStub; 3354} 3355interface WorkerLoaderModule { 3356 js?: string; 3357 cjs?: string; 3358 text?: string; 3359 data?: ArrayBuffer; 3360 json?: any; 3361 py?: string; 3362 wasm?: ArrayBuffer; 3363} 3364interface WorkerLoaderWorkerCode { 3365 compatibilityDate: string; 3366 compatibilityFlags?: string[]; 3367 allowExperimental?: boolean; 3368 mainModule: string; 3369 modules: Record<string, WorkerLoaderModule | string>; 3370 env?: any; 3371 globalOutbound?: (Fetcher | null); 3372 tails?: Fetcher[]; 3373 streamingTails?: Fetcher[]; 3374} 3375/** 3376* The Workers runtime supports a subset of the Performance API, used to measure timing and performance, 3377* as well as timing of subrequests and other operations. 3378* 3379* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/) 3380*/ 3381declare abstract class Performance { 3382 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */ 3383 get timeOrigin(): number; 3384 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */ 3385 now(): number; 3386 /** 3387 * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object. 3388 * 3389 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON) 3390 */ 3391 toJSON(): object; 3392} 3393// ============ AI Search Error Interfaces ============ 3394interface AiSearchInternalError extends Error { 3395} 3396interface AiSearchNotFoundError extends Error { 3397} 3398// ============ AI Search Request Types ============ 3399type AiSearchSearchRequest = { 3400 messages: Array<{ 3401 role: 'system' | 'developer' | 'user' | 'assistant' | 'tool'; 3402 content: string | null; 3403 }>; 3404 ai_search_options?: { 3405 retrieval?: { 3406 retrieval_type?: 'vector' | 'keyword' | 'hybrid'; 3407 /** Match threshold (0-1, default 0.4) */ 3408 match_threshold?: number; 3409 /** Maximum number of results (1-50, default 10) */ 3410 max_num_results?: number; 3411 filters?: VectorizeVectorMetadataFilter; 3412 /** Context expansion (0-3, default 0) */ 3413 context_expansion?: number; 3414 [key: string]: unknown; 3415 }; 3416 query_rewrite?: { 3417 enabled?: boolean; 3418 model?: string; 3419 rewrite_prompt?: string; 3420 [key: string]: unknown; 3421 }; 3422 reranking?: { 3423 enabled?: boolean; 3424 model?: '@cf/baai/bge-reranker-base' | string; 3425 /** Match threshold (0-1, default 0.4) */ 3426 match_threshold?: number; 3427 [key: string]: unknown; 3428 }; 3429 [key: string]: unknown; 3430 }; 3431}; 3432type AiSearchChatCompletionsRequest = { 3433 messages: Array<{ 3434 role: 'system' | 'developer' | 'user' | 'assistant' | 'tool'; 3435 content: string | null; 3436 [key: string]: unknown; 3437 }>; 3438 model?: string; 3439 stream?: boolean; 3440 ai_search_options?: { 3441 retrieval?: { 3442 retrieval_type?: 'vector' | 'keyword' | 'hybrid'; 3443 match_threshold?: number; 3444 max_num_results?: number; 3445 filters?: VectorizeVectorMetadataFilter; 3446 context_expansion?: number; 3447 [key: string]: unknown; 3448 }; 3449 query_rewrite?: { 3450 enabled?: boolean; 3451 model?: string; 3452 rewrite_prompt?: string; 3453 [key: string]: unknown; 3454 }; 3455 reranking?: { 3456 enabled?: boolean; 3457 model?: '@cf/baai/bge-reranker-base' | string; 3458 match_threshold?: number; 3459 [key: string]: unknown; 3460 }; 3461 [key: string]: unknown; 3462 }; 3463 [key: string]: unknown; 3464}; 3465// ============ AI Search Response Types ============ 3466type AiSearchSearchResponse = { 3467 search_query: string; 3468 chunks: Array<{ 3469 id: string; 3470 type: string; 3471 /** Match score (0-1) */ 3472 score: number; 3473 text: string; 3474 item: { 3475 timestamp?: number; 3476 key: string; 3477 metadata?: Record<string, unknown>; 3478 }; 3479 scoring_details?: { 3480 /** Keyword match score (0-1) */ 3481 keyword_score?: number; 3482 /** Vector similarity score (0-1) */ 3483 vector_score?: number; 3484 [key: string]: unknown; 3485 }; 3486 }>; 3487}; 3488type AiSearchChatCompletionsResponse = { 3489 id?: string; 3490 object?: string; 3491 model?: string; 3492 choices: Array<{ 3493 index?: number; 3494 message: { 3495 role: 'system' | 'developer' | 'user' | 'assistant' | 'tool'; 3496 content: string | null; 3497 [key: string]: unknown; 3498 }; 3499 [key: string]: unknown; 3500 }>; 3501 chunks: AiSearchSearchResponse['chunks']; 3502 [key: string]: unknown; 3503}; 3504type AiSearchStatsResponse = { 3505 queued?: number; 3506 running?: number; 3507 completed?: number; 3508 error?: number; 3509 skipped?: number; 3510 outdated?: number; 3511 last_activity?: string; 3512}; 3513// ============ AI Search Instance Info Types ============ 3514type AiSearchInstanceInfo = { 3515 id: string; 3516 type?: 'r2' | 'web-crawler' | string; 3517 source?: string; 3518 paused?: boolean; 3519 status?: string; 3520 namespace?: string; 3521 created_at?: string; 3522 modified_at?: string; 3523 [key: string]: unknown; 3524}; 3525type AiSearchListResponse = { 3526 result: AiSearchInstanceInfo[]; 3527 result_info?: { 3528 count: number; 3529 page: number; 3530 per_page: number; 3531 total_count: number; 3532 }; 3533}; 3534// ============ AI Search Config Types ============ 3535type AiSearchConfig = { 3536 /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */ 3537 id: string; 3538 /** Instance type. Omit to create with built-in storage. */ 3539 type?: 'r2' | 'web-crawler' | string; 3540 /** Source URL (required for web-crawler type). */ 3541 source?: string; 3542 source_params?: unknown; 3543 /** Token ID (UUID format) */ 3544 token_id?: string; 3545 ai_gateway_id?: string; 3546 /** Enable query rewriting (default false) */ 3547 rewrite_query?: boolean; 3548 /** Enable reranking (default false) */ 3549 reranking?: boolean; 3550 embedding_model?: string; 3551 ai_search_model?: string; 3552 [key: string]: unknown; 3553}; 3554// ============ AI Search Item Types ============ 3555type AiSearchItemInfo = { 3556 id: string; 3557 key: string; 3558 status: 'completed' | 'error' | 'skipped' | 'queued' | 'processing' | 'outdated'; 3559 metadata?: Record<string, unknown>; 3560 [key: string]: unknown; 3561}; 3562type AiSearchItemContentResult = { 3563 body: ReadableStream; 3564 contentType: string; 3565 filename: string; 3566 size: number; 3567}; 3568type AiSearchUploadItemOptions = { 3569 metadata?: Record<string, unknown>; 3570}; 3571type AiSearchListItemsParams = { 3572 page?: number; 3573 per_page?: number; 3574}; 3575type AiSearchListItemsResponse = { 3576 result: AiSearchItemInfo[]; 3577 result_info?: { 3578 count: number; 3579 page: number; 3580 per_page: number; 3581 total_count: number; 3582 }; 3583}; 3584// ============ AI Search Job Types ============ 3585type AiSearchJobInfo = { 3586 id: string; 3587 source: 'user' | 'schedule'; 3588 description?: string; 3589 last_seen_at?: string; 3590 started_at?: string; 3591 ended_at?: string; 3592 end_reason?: string; 3593}; 3594type AiSearchJobLog = { 3595 id: number; 3596 message: string; 3597 message_type: number; 3598 created_at: number; 3599}; 3600type AiSearchCreateJobParams = { 3601 description?: string; 3602}; 3603type AiSearchListJobsParams = { 3604 page?: number; 3605 per_page?: number; 3606}; 3607type AiSearchListJobsResponse = { 3608 result: AiSearchJobInfo[]; 3609 result_info?: { 3610 count: number; 3611 page: number; 3612 per_page: number; 3613 total_count: number; 3614 }; 3615}; 3616type AiSearchJobLogsParams = { 3617 page?: number; 3618 per_page?: number; 3619}; 3620type AiSearchJobLogsResponse = { 3621 result: AiSearchJobLog[]; 3622 result_info?: { 3623 count: number; 3624 page: number; 3625 per_page: number; 3626 total_count: number; 3627 }; 3628}; 3629// ============ AI Search Sub-Service Classes ============ 3630/** 3631 * Single item service for an AI Search instance. 3632 * Provides info, delete, and download operations on a specific item. 3633 */ 3634declare abstract class AiSearchItem { 3635 /** Get metadata about this item. */ 3636 info(): Promise<AiSearchItemInfo>; 3637 /** 3638 * Download the item's content. 3639 * @returns Object with body stream, content type, filename, and size. 3640 */ 3641 download(): Promise<AiSearchItemContentResult>; 3642} 3643/** 3644 * Items collection service for an AI Search instance. 3645 * Provides list, upload, and access to individual items. 3646 */ 3647declare abstract class AiSearchItems { 3648 /** List items in this instance. */ 3649 list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>; 3650 /** 3651 * Upload a file as an item. 3652 * @param name Filename for the uploaded item. 3653 * @param content File content as a ReadableStream, ArrayBuffer, or string. 3654 * @param options Optional metadata to attach to the item. 3655 * @returns The created item info. 3656 */ 3657 upload(name: string, content: ReadableStream | ArrayBuffer | string, options?: AiSearchUploadItemOptions): Promise<AiSearchItemInfo>; 3658 /** 3659 * Upload a file and poll until processing completes. 3660 * @param name Filename for the uploaded item. 3661 * @param content File content as a ReadableStream, ArrayBuffer, or string. 3662 * @param options Optional metadata to attach to the item. 3663 * @returns The item info after processing completes (or timeout). 3664 */ 3665 uploadAndPoll(name: string, content: ReadableStream | ArrayBuffer | string, options?: AiSearchUploadItemOptions): Promise<AiSearchItemInfo>; 3666 /** 3667 * Get an item by ID. 3668 * @param itemId The item identifier. 3669 * @returns Item service for info, delete, and download operations. 3670 */ 3671 get(itemId: string): AiSearchItem; 3672 /** Delete this item from the instance. 3673 * @param itemId The item identifier. 3674 */ 3675 delete(itemId: string): Promise<void>; 3676} 3677/** 3678 * Single job service for an AI Search instance. 3679 * Provides info and logs for a specific job. 3680 */ 3681declare abstract class AiSearchJob { 3682 /** Get metadata about this job. */ 3683 info(): Promise<AiSearchJobInfo>; 3684 /** Get logs for this job. */ 3685 logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>; 3686} 3687/** 3688 * Jobs collection service for an AI Search instance. 3689 * Provides list, create, and access to individual jobs. 3690 */ 3691declare abstract class AiSearchJobs { 3692 /** List jobs for this instance. */ 3693 list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>; 3694 /** 3695 * Create a new indexing job. 3696 * @param params Optional job parameters. 3697 * @returns The created job info. 3698 */ 3699 create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>; 3700 /** 3701 * Get a job by ID. 3702 * @param jobId The job identifier. 3703 * @returns Job service for info and logs operations. 3704 */ 3705 get(jobId: string): AiSearchJob; 3706} 3707// ============ AI Search Binding Classes ============ 3708/** 3709 * Instance-level AI Search service. 3710 * 3711 * Used as: 3712 * - The return type of `AiSearchNamespace.get(name)` (namespace binding) 3713 * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`) 3714 * 3715 * Provides search, chat, update, stats, items, and jobs operations. 3716 * 3717 * @example 3718 * ```ts 3719 * // Via namespace binding 3720 * const instance = env.AI_SEARCH.get("blog"); 3721 * const results = await instance.search({ 3722 * messages: [{ role: "user", content: "How does caching work?" }], 3723 * }); 3724 * 3725 * // Via single instance binding 3726 * const results = await env.BLOG_SEARCH.search({ 3727 * messages: [{ role: "user", content: "How does caching work?" }], 3728 * }); 3729 * ``` 3730 */ 3731declare abstract class AiSearchInstance { 3732 /** 3733 * Search the AI Search instance for relevant chunks. 3734 * @param params Search request with messages and optional AI search options. 3735 * @returns Search response with matching chunks and search query. 3736 */ 3737 search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>; 3738 /** 3739 * Generate chat completions with AI Search context (streaming). 3740 * @param params Chat completions request with stream: true. 3741 * @returns ReadableStream of server-sent events. 3742 */ 3743 chatCompletions(params: AiSearchChatCompletionsRequest & { 3744 stream: true; 3745 }): Promise<ReadableStream>; 3746 /** 3747 * Generate chat completions with AI Search context. 3748 * @param params Chat completions request. 3749 * @returns Chat completion response with choices and RAG chunks. 3750 */ 3751 chatCompletions(params: AiSearchChatCompletionsRequest): Promise<AiSearchChatCompletionsResponse>; 3752 /** 3753 * Update the instance configuration. 3754 * @param config Partial configuration to update. 3755 * @returns Updated instance info. 3756 */ 3757 update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>; 3758 /** Get metadata about this instance. */ 3759 info(): Promise<AiSearchInstanceInfo>; 3760 /** 3761 * Get instance statistics (item count, indexing status, etc.). 3762 * @returns Statistics with counts per status and last activity time. 3763 */ 3764 stats(): Promise<AiSearchStatsResponse>; 3765 /** Items collection — list, upload, and manage items in this instance. */ 3766 get items(): AiSearchItems; 3767 /** Jobs collection — list, create, and inspect indexing jobs. */ 3768 get jobs(): AiSearchJobs; 3769} 3770/** 3771 * Namespace-level AI Search service. 3772 * 3773 * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`). 3774 * Scoped to a single namespace. Provides dynamic instance access, creation, and deletion. 3775 * 3776 * @example 3777 * ```ts 3778 * // Access an instance within the namespace 3779 * const blog = env.AI_SEARCH.get("blog"); 3780 * const results = await blog.search({ 3781 * messages: [{ role: "user", content: "How does caching work?" }], 3782 * }); 3783 * 3784 * // List all instances in the namespace 3785 * const instances = await env.AI_SEARCH.list(); 3786 * 3787 * // Create a new instance with built-in storage 3788 * const tenant = await env.AI_SEARCH.create({ 3789 * id: "tenant-123", 3790 * }); 3791 * 3792 * // Upload items into the instance 3793 * await tenant.items.upload("doc.pdf", fileContent); 3794 * 3795 * // Delete an instance 3796 * await env.AI_SEARCH.delete("tenant-123"); 3797 * ``` 3798 */ 3799declare abstract class AiSearchNamespace { 3800 /** 3801 * Get an instance by name within the bound namespace. 3802 * @param name Instance name. 3803 * @returns Instance service for search, chat, update, stats, items, and jobs. 3804 */ 3805 get(name: string): AiSearchInstance; 3806 /** 3807 * List all instances in the bound namespace. 3808 * @returns Array of instance metadata. 3809 */ 3810 list(): Promise<AiSearchListResponse>; 3811 /** 3812 * Create a new instance within the bound namespace. 3813 * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage. 3814 * @returns Instance service for the newly created instance. 3815 * 3816 * @example 3817 * ```ts 3818 * // Create with built-in storage (upload items manually) 3819 * const instance = await env.AI_SEARCH.create({ id: "my-search" }); 3820 * 3821 * // Create with web crawler source 3822 * const instance = await env.AI_SEARCH.create({ 3823 * id: "docs-search", 3824 * type: "web-crawler", 3825 * source: "https://developers.cloudflare.com", 3826 * }); 3827 * ``` 3828 */ 3829 create(config: AiSearchConfig): Promise<AiSearchInstance>; 3830 /** 3831 * Delete an instance from the bound namespace. 3832 * @param name Instance name to delete. 3833 */ 3834 delete(name: string): Promise<void>; 3835} 3836type AiImageClassificationInput = { 3837 image: number[]; 3838}; 3839type AiImageClassificationOutput = { 3840 score?: number; 3841 label?: string; 3842}[]; 3843declare abstract class BaseAiImageClassification { 3844 inputs: AiImageClassificationInput; 3845 postProcessedOutputs: AiImageClassificationOutput; 3846} 3847type AiImageToTextInput = { 3848 image: number[]; 3849 prompt?: string; 3850 max_tokens?: number; 3851 temperature?: number; 3852 top_p?: number; 3853 top_k?: number; 3854 seed?: number; 3855 repetition_penalty?: number; 3856 frequency_penalty?: number; 3857 presence_penalty?: number; 3858 raw?: boolean; 3859 messages?: RoleScopedChatInput[]; 3860}; 3861type AiImageToTextOutput = { 3862 description: string; 3863}; 3864declare abstract class BaseAiImageToText { 3865 inputs: AiImageToTextInput; 3866 postProcessedOutputs: AiImageToTextOutput; 3867} 3868type AiImageTextToTextInput = { 3869 image: string; 3870 prompt?: string; 3871 max_tokens?: number; 3872 temperature?: number; 3873 ignore_eos?: boolean; 3874 top_p?: number; 3875 top_k?: number; 3876 seed?: number; 3877 repetition_penalty?: number; 3878 frequency_penalty?: number; 3879 presence_penalty?: number; 3880 raw?: boolean; 3881 messages?: RoleScopedChatInput[]; 3882}; 3883type AiImageTextToTextOutput = { 3884 description: string; 3885}; 3886declare abstract class BaseAiImageTextToText { 3887 inputs: AiImageTextToTextInput; 3888 postProcessedOutputs: AiImageTextToTextOutput; 3889} 3890type AiMultimodalEmbeddingsInput = { 3891 image: string; 3892 text: string[]; 3893}; 3894type AiIMultimodalEmbeddingsOutput = { 3895 data: number[][]; 3896 shape: number[]; 3897}; 3898declare abstract class BaseAiMultimodalEmbeddings { 3899 inputs: AiImageTextToTextInput; 3900 postProcessedOutputs: AiImageTextToTextOutput; 3901} 3902type AiObjectDetectionInput = { 3903 image: number[]; 3904}; 3905type AiObjectDetectionOutput = { 3906 score?: number; 3907 label?: string; 3908}[]; 3909declare abstract class BaseAiObjectDetection { 3910 inputs: AiObjectDetectionInput; 3911 postProcessedOutputs: AiObjectDetectionOutput; 3912} 3913type AiSentenceSimilarityInput = { 3914 source: string; 3915 sentences: string[]; 3916}; 3917type AiSentenceSimilarityOutput = number[]; 3918declare abstract class BaseAiSentenceSimilarity { 3919 inputs: AiSentenceSimilarityInput; 3920 postProcessedOutputs: AiSentenceSimilarityOutput; 3921} 3922type AiAutomaticSpeechRecognitionInput = { 3923 audio: number[]; 3924}; 3925type AiAutomaticSpeechRecognitionOutput = { 3926 text?: string; 3927 words?: { 3928 word: string; 3929 start: number; 3930 end: number; 3931 }[]; 3932 vtt?: string; 3933}; 3934declare abstract class BaseAiAutomaticSpeechRecognition { 3935 inputs: AiAutomaticSpeechRecognitionInput; 3936 postProcessedOutputs: AiAutomaticSpeechRecognitionOutput; 3937} 3938type AiSummarizationInput = { 3939 input_text: string; 3940 max_length?: number; 3941}; 3942type AiSummarizationOutput = { 3943 summary: string; 3944}; 3945declare abstract class BaseAiSummarization { 3946 inputs: AiSummarizationInput; 3947 postProcessedOutputs: AiSummarizationOutput; 3948} 3949type AiTextClassificationInput = { 3950 text: string; 3951}; 3952type AiTextClassificationOutput = { 3953 score?: number; 3954 label?: string; 3955}[]; 3956declare abstract class BaseAiTextClassification { 3957 inputs: AiTextClassificationInput; 3958 postProcessedOutputs: AiTextClassificationOutput; 3959} 3960type AiTextEmbeddingsInput = { 3961 text: string | string[]; 3962}; 3963type AiTextEmbeddingsOutput = { 3964 shape: number[]; 3965 data: number[][]; 3966}; 3967declare abstract class BaseAiTextEmbeddings { 3968 inputs: AiTextEmbeddingsInput; 3969 postProcessedOutputs: AiTextEmbeddingsOutput; 3970} 3971type RoleScopedChatInput = { 3972 role: "user" | "assistant" | "system" | "tool" | (string & NonNullable<unknown>); 3973 content: string; 3974 name?: string; 3975}; 3976type AiTextGenerationToolLegacyInput = { 3977 name: string; 3978 description: string; 3979 parameters?: { 3980 type: "object" | (string & NonNullable<unknown>); 3981 properties: { 3982 [key: string]: { 3983 type: string; 3984 description?: string; 3985 }; 3986 }; 3987 required: string[]; 3988 }; 3989}; 3990type AiTextGenerationToolInput = { 3991 type: "function" | (string & NonNullable<unknown>); 3992 function: { 3993 name: string; 3994 description: string; 3995 parameters?: { 3996 type: "object" | (string & NonNullable<unknown>); 3997 properties: { 3998 [key: string]: { 3999 type: string; 4000 description?: string; 4001 }; 4002 }; 4003 required: string[]; 4004 }; 4005 }; 4006}; 4007type AiTextGenerationFunctionsInput = { 4008 name: string; 4009 code: string; 4010}; 4011type AiTextGenerationResponseFormat = { 4012 type: string; 4013 json_schema?: any; 4014}; 4015type AiTextGenerationInput = { 4016 prompt?: string; 4017 raw?: boolean; 4018 stream?: boolean; 4019 max_tokens?: number; 4020 temperature?: number; 4021 top_p?: number; 4022 top_k?: number; 4023 seed?: number; 4024 repetition_penalty?: number; 4025 frequency_penalty?: number; 4026 presence_penalty?: number; 4027 messages?: RoleScopedChatInput[]; 4028 response_format?: AiTextGenerationResponseFormat; 4029 tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>); 4030 functions?: AiTextGenerationFunctionsInput[]; 4031}; 4032type AiTextGenerationToolLegacyOutput = { 4033 name: string; 4034 arguments: unknown; 4035}; 4036type AiTextGenerationToolOutput = { 4037 id: string; 4038 type: "function"; 4039 function: { 4040 name: string; 4041 arguments: string; 4042 }; 4043}; 4044type UsageTags = { 4045 prompt_tokens: number; 4046 completion_tokens: number; 4047 total_tokens: number; 4048}; 4049type AiTextGenerationOutput = { 4050 response?: string; 4051 tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[]; 4052 usage?: UsageTags; 4053}; 4054declare abstract class BaseAiTextGeneration { 4055 inputs: AiTextGenerationInput; 4056 postProcessedOutputs: AiTextGenerationOutput; 4057} 4058type AiTextToSpeechInput = { 4059 prompt: string; 4060 lang?: string; 4061}; 4062type AiTextToSpeechOutput = Uint8Array | { 4063 audio: string; 4064}; 4065declare abstract class BaseAiTextToSpeech { 4066 inputs: AiTextToSpeechInput; 4067 postProcessedOutputs: AiTextToSpeechOutput; 4068} 4069type AiTextToImageInput = { 4070 prompt: string; 4071 negative_prompt?: string; 4072 height?: number; 4073 width?: number; 4074 image?: number[]; 4075 image_b64?: string; 4076 mask?: number[]; 4077 num_steps?: number; 4078 strength?: number; 4079 guidance?: number; 4080 seed?: number; 4081}; 4082type AiTextToImageOutput = ReadableStream<Uint8Array>; 4083declare abstract class BaseAiTextToImage { 4084 inputs: AiTextToImageInput; 4085 postProcessedOutputs: AiTextToImageOutput; 4086} 4087type AiTranslationInput = { 4088 text: string; 4089 target_lang: string; 4090 source_lang?: string; 4091}; 4092type AiTranslationOutput = { 4093 translated_text?: string; 4094}; 4095declare abstract class BaseAiTranslation { 4096 inputs: AiTranslationInput; 4097 postProcessedOutputs: AiTranslationOutput; 4098} 4099/** 4100 * Workers AI support for OpenAI's Chat Completions API 4101 */ 4102type ChatCompletionContentPartText = { 4103 type: "text"; 4104 text: string; 4105}; 4106type ChatCompletionContentPartImage = { 4107 type: "image_url"; 4108 image_url: { 4109 url: string; 4110 detail?: "auto" | "low" | "high"; 4111 }; 4112}; 4113type ChatCompletionContentPartInputAudio = { 4114 type: "input_audio"; 4115 input_audio: { 4116 /** Base64 encoded audio data. */ 4117 data: string; 4118 format: "wav" | "mp3"; 4119 }; 4120}; 4121type ChatCompletionContentPartFile = { 4122 type: "file"; 4123 file: { 4124 /** Base64 encoded file data. */ 4125 file_data?: string; 4126 /** The ID of an uploaded file. */ 4127 file_id?: string; 4128 filename?: string; 4129 }; 4130}; 4131type ChatCompletionContentPartRefusal = { 4132 type: "refusal"; 4133 refusal: string; 4134}; 4135type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage | ChatCompletionContentPartInputAudio | ChatCompletionContentPartFile; 4136type FunctionDefinition = { 4137 name: string; 4138 description?: string; 4139 parameters?: Record<string, unknown>; 4140 strict?: boolean | null; 4141}; 4142type ChatCompletionFunctionTool = { 4143 type: "function"; 4144 function: FunctionDefinition; 4145}; 4146type ChatCompletionCustomToolGrammarFormat = { 4147 type: "grammar"; 4148 grammar: { 4149 definition: string; 4150 syntax: "lark" | "regex"; 4151 }; 4152}; 4153type ChatCompletionCustomToolTextFormat = { 4154 type: "text"; 4155}; 4156type ChatCompletionCustomToolFormat = ChatCompletionCustomToolTextFormat | ChatCompletionCustomToolGrammarFormat; 4157type ChatCompletionCustomTool = { 4158 type: "custom"; 4159 custom: { 4160 name: string; 4161 description?: string; 4162 format?: ChatCompletionCustomToolFormat; 4163 }; 4164}; 4165type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool; 4166type ChatCompletionMessageFunctionToolCall = { 4167 id: string; 4168 type: "function"; 4169 function: { 4170 name: string; 4171 /** JSON-encoded arguments string. */ 4172 arguments: string; 4173 }; 4174}; 4175type ChatCompletionMessageCustomToolCall = { 4176 id: string; 4177 type: "custom"; 4178 custom: { 4179 name: string; 4180 input: string; 4181 }; 4182}; 4183type ChatCompletionMessageToolCall = ChatCompletionMessageFunctionToolCall | ChatCompletionMessageCustomToolCall; 4184type ChatCompletionToolChoiceFunction = { 4185 type: "function"; 4186 function: { 4187 name: string; 4188 }; 4189}; 4190type ChatCompletionToolChoiceCustom = { 4191 type: "custom"; 4192 custom: { 4193 name: string; 4194 }; 4195}; 4196type ChatCompletionToolChoiceAllowedTools = { 4197 type: "allowed_tools"; 4198 allowed_tools: { 4199 mode: "auto" | "required"; 4200 tools: Array<Record<string, unknown>>; 4201 }; 4202}; 4203type ChatCompletionToolChoiceOption = "none" | "auto" | "required" | ChatCompletionToolChoiceFunction | ChatCompletionToolChoiceCustom | ChatCompletionToolChoiceAllowedTools; 4204type DeveloperMessage = { 4205 role: "developer"; 4206 content: string | Array<{ 4207 type: "text"; 4208 text: string; 4209 }>; 4210 name?: string; 4211}; 4212type SystemMessage = { 4213 role: "system"; 4214 content: string | Array<{ 4215 type: "text"; 4216 text: string; 4217 }>; 4218 name?: string; 4219}; 4220/** 4221 * Permissive merged content part used inside UserMessage arrays. 4222 * 4223 * Cabidela has a limitation where anyOf/oneOf with enum-based discrimination 4224 * inside nested array items does not correctly match different branches for 4225 * different array elements, so the schema uses a single merged object. 4226 */ 4227type UserMessageContentPart = { 4228 type: "text" | "image_url" | "input_audio" | "file"; 4229 text?: string; 4230 image_url?: { 4231 url?: string; 4232 detail?: "auto" | "low" | "high"; 4233 }; 4234 input_audio?: { 4235 data?: string; 4236 format?: "wav" | "mp3"; 4237 }; 4238 file?: { 4239 file_data?: string; 4240 file_id?: string; 4241 filename?: string; 4242 }; 4243}; 4244type UserMessage = { 4245 role: "user"; 4246 content: string | Array<UserMessageContentPart>; 4247 name?: string; 4248}; 4249type AssistantMessageContentPart = { 4250 type: "text" | "refusal"; 4251 text?: string; 4252 refusal?: string; 4253}; 4254type AssistantMessage = { 4255 role: "assistant"; 4256 content?: string | null | Array<AssistantMessageContentPart>; 4257 refusal?: string | null; 4258 name?: string; 4259 audio?: { 4260 id: string; 4261 }; 4262 tool_calls?: Array<ChatCompletionMessageToolCall>; 4263 function_call?: { 4264 name: string; 4265 arguments: string; 4266 }; 4267}; 4268type ToolMessage = { 4269 role: "tool"; 4270 content: string | Array<{ 4271 type: "text"; 4272 text: string; 4273 }>; 4274 tool_call_id: string; 4275}; 4276type FunctionMessage = { 4277 role: "function"; 4278 content: string; 4279 name: string; 4280}; 4281type ChatCompletionMessageParam = DeveloperMessage | SystemMessage | UserMessage | AssistantMessage | ToolMessage | FunctionMessage; 4282type ChatCompletionsResponseFormatText = { 4283 type: "text"; 4284}; 4285type ChatCompletionsResponseFormatJSONObject = { 4286 type: "json_object"; 4287}; 4288type ResponseFormatJSONSchema = { 4289 type: "json_schema"; 4290 json_schema: { 4291 name: string; 4292 description?: string; 4293 schema?: Record<string, unknown>; 4294 strict?: boolean | null; 4295 }; 4296}; 4297type ResponseFormat = ChatCompletionsResponseFormatText | ChatCompletionsResponseFormatJSONObject | ResponseFormatJSONSchema; 4298type ChatCompletionsStreamOptions = { 4299 include_usage?: boolean; 4300 include_obfuscation?: boolean; 4301}; 4302type PredictionContent = { 4303 type: "content"; 4304 content: string | Array<{ 4305 type: "text"; 4306 text: string; 4307 }>; 4308}; 4309type AudioParams = { 4310 voice: string | { 4311 id: string; 4312 }; 4313 format: "wav" | "aac" | "mp3" | "flac" | "opus" | "pcm16"; 4314}; 4315type WebSearchUserLocation = { 4316 type: "approximate"; 4317 approximate: { 4318 city?: string; 4319 country?: string; 4320 region?: string; 4321 timezone?: string; 4322 }; 4323}; 4324type WebSearchOptions = { 4325 search_context_size?: "low" | "medium" | "high"; 4326 user_location?: WebSearchUserLocation; 4327}; 4328type ChatTemplateKwargs = { 4329 /** Whether to enable reasoning, enabled by default. */ 4330 enable_thinking?: boolean; 4331 /** If false, preserves reasoning context between turns. */ 4332 clear_thinking?: boolean; 4333}; 4334/** Shared optional properties used by both Prompt and Messages input branches. */ 4335type ChatCompletionsCommonOptions = { 4336 model?: string; 4337 audio?: AudioParams; 4338 frequency_penalty?: number | null; 4339 logit_bias?: Record<string, unknown> | null; 4340 logprobs?: boolean | null; 4341 top_logprobs?: number | null; 4342 max_tokens?: number | null; 4343 max_completion_tokens?: number | null; 4344 metadata?: Record<string, unknown> | null; 4345 modalities?: Array<"text" | "audio"> | null; 4346 n?: number | null; 4347 parallel_tool_calls?: boolean; 4348 prediction?: PredictionContent; 4349 presence_penalty?: number | null; 4350 reasoning_effort?: "low" | "medium" | "high" | null; 4351 chat_template_kwargs?: ChatTemplateKwargs; 4352 response_format?: ResponseFormat; 4353 seed?: number | null; 4354 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; 4355 stop?: string | Array<string> | null; 4356 store?: boolean | null; 4357 stream?: boolean | null; 4358 stream_options?: ChatCompletionsStreamOptions; 4359 temperature?: number | null; 4360 tool_choice?: ChatCompletionToolChoiceOption; 4361 tools?: Array<ChatCompletionTool>; 4362 top_p?: number | null; 4363 user?: string; 4364 web_search_options?: WebSearchOptions; 4365 function_call?: "none" | "auto" | { 4366 name: string; 4367 }; 4368 functions?: Array<FunctionDefinition>; 4369}; 4370type PromptTokensDetails = { 4371 cached_tokens?: number; 4372 audio_tokens?: number; 4373}; 4374type CompletionTokensDetails = { 4375 reasoning_tokens?: number; 4376 audio_tokens?: number; 4377 accepted_prediction_tokens?: number; 4378 rejected_prediction_tokens?: number; 4379}; 4380type CompletionUsage = { 4381 prompt_tokens: number; 4382 completion_tokens: number; 4383 total_tokens: number; 4384 prompt_tokens_details?: PromptTokensDetails; 4385 completion_tokens_details?: CompletionTokensDetails; 4386}; 4387type ChatCompletionTopLogprob = { 4388 token: string; 4389 logprob: number; 4390 bytes: Array<number> | null; 4391}; 4392type ChatCompletionTokenLogprob = { 4393 token: string; 4394 logprob: number; 4395 bytes: Array<number> | null; 4396 top_logprobs: Array<ChatCompletionTopLogprob>; 4397}; 4398type ChatCompletionAudio = { 4399 id: string; 4400 /** Base64 encoded audio bytes. */ 4401 data: string; 4402 expires_at: number; 4403 transcript: string; 4404}; 4405type ChatCompletionUrlCitation = { 4406 type: "url_citation"; 4407 url_citation: { 4408 url: string; 4409 title: string; 4410 start_index: number; 4411 end_index: number; 4412 }; 4413}; 4414type ChatCompletionResponseMessage = { 4415 role: "assistant"; 4416 content: string | null; 4417 refusal: string | null; 4418 annotations?: Array<ChatCompletionUrlCitation>; 4419 audio?: ChatCompletionAudio; 4420 tool_calls?: Array<ChatCompletionMessageToolCall>; 4421 function_call?: { 4422 name: string; 4423 arguments: string; 4424 } | null; 4425}; 4426type ChatCompletionLogprobs = { 4427 content: Array<ChatCompletionTokenLogprob> | null; 4428 refusal?: Array<ChatCompletionTokenLogprob> | null; 4429}; 4430type ChatCompletionChoice = { 4431 index: number; 4432 message: ChatCompletionResponseMessage; 4433 finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call"; 4434 logprobs: ChatCompletionLogprobs | null; 4435}; 4436type ChatCompletionsPromptInput = { 4437 prompt: string; 4438} & ChatCompletionsCommonOptions; 4439type ChatCompletionsMessagesInput = { 4440 messages: Array<ChatCompletionMessageParam>; 4441} & ChatCompletionsCommonOptions; 4442type ChatCompletionsOutput = { 4443 id: string; 4444 object: string; 4445 created: number; 4446 model: string; 4447 choices: Array<ChatCompletionChoice>; 4448 usage?: CompletionUsage; 4449 system_fingerprint?: string | null; 4450 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; 4451}; 4452/** 4453 * Workers AI support for OpenAI's Responses API 4454 * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts 4455 * 4456 * It's a stripped down version from its source. 4457 * It currently supports basic function calling, json mode and accepts images as input. 4458 * 4459 * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. 4460 * We plan to add those incrementally as model + platform capabilities evolve. 4461 */ 4462type ResponsesInput = { 4463 background?: boolean | null; 4464 conversation?: string | ResponseConversationParam | null; 4465 include?: Array<ResponseIncludable> | null; 4466 input?: string | ResponseInput; 4467 instructions?: string | null; 4468 max_output_tokens?: number | null; 4469 parallel_tool_calls?: boolean | null; 4470 previous_response_id?: string | null; 4471 prompt_cache_key?: string; 4472 reasoning?: Reasoning | null; 4473 safety_identifier?: string; 4474 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; 4475 stream?: boolean | null; 4476 stream_options?: StreamOptions | null; 4477 temperature?: number | null; 4478 text?: ResponseTextConfig; 4479 tool_choice?: ToolChoiceOptions | ToolChoiceFunction; 4480 tools?: Array<Tool>; 4481 top_p?: number | null; 4482 truncation?: "auto" | "disabled" | null; 4483}; 4484type ResponsesOutput = { 4485 id?: string; 4486 created_at?: number; 4487 output_text?: string; 4488 error?: ResponseError | null; 4489 incomplete_details?: ResponseIncompleteDetails | null; 4490 instructions?: string | Array<ResponseInputItem> | null; 4491 object?: "response"; 4492 output?: Array<ResponseOutputItem>; 4493 parallel_tool_calls?: boolean; 4494 temperature?: number | null; 4495 tool_choice?: ToolChoiceOptions | ToolChoiceFunction; 4496 tools?: Array<Tool>; 4497 top_p?: number | null; 4498 max_output_tokens?: number | null; 4499 previous_response_id?: string | null; 4500 prompt?: ResponsePrompt | null; 4501 reasoning?: Reasoning | null; 4502 safety_identifier?: string; 4503 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; 4504 status?: ResponseStatus; 4505 text?: ResponseTextConfig; 4506 truncation?: "auto" | "disabled" | null; 4507 usage?: ResponseUsage; 4508}; 4509type EasyInputMessage = { 4510 content: string | ResponseInputMessageContentList; 4511 role: "user" | "assistant" | "system" | "developer"; 4512 type?: "message"; 4513}; 4514type ResponsesFunctionTool = { 4515 name: string; 4516 parameters: { 4517 [key: string]: unknown; 4518 } | null; 4519 strict: boolean | null; 4520 type: "function"; 4521 description?: string | null; 4522}; 4523type ResponseIncompleteDetails = { 4524 reason?: "max_output_tokens" | "content_filter"; 4525}; 4526type ResponsePrompt = { 4527 id: string; 4528 variables?: { 4529 [key: string]: string | ResponseInputText | ResponseInputImage; 4530 } | null; 4531 version?: string | null; 4532}; 4533type Reasoning = { 4534 effort?: ReasoningEffort | null; 4535 generate_summary?: "auto" | "concise" | "detailed" | null; 4536 summary?: "auto" | "concise" | "detailed" | null; 4537}; 4538type ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText; 4539type ResponseContentReasoningText = { 4540 text: string; 4541 type: "reasoning_text"; 4542}; 4543type ResponseConversationParam = { 4544 id: string; 4545}; 4546type ResponseCreatedEvent = { 4547 response: Response; 4548 sequence_number: number; 4549 type: "response.created"; 4550}; 4551type ResponseCustomToolCallOutput = { 4552 call_id: string; 4553 output: string | Array<ResponseInputText | ResponseInputImage>; 4554 type: "custom_tool_call_output"; 4555 id?: string; 4556}; 4557type ResponseError = { 4558 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"; 4559 message: string; 4560}; 4561type ResponseErrorEvent = { 4562 code: string | null; 4563 message: string; 4564 param: string | null; 4565 sequence_number: number; 4566 type: "error"; 4567}; 4568type ResponseFailedEvent = { 4569 response: Response; 4570 sequence_number: number; 4571 type: "response.failed"; 4572}; 4573type ResponseFormatText = { 4574 type: "text"; 4575}; 4576type ResponseFormatJSONObject = { 4577 type: "json_object"; 4578}; 4579type ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject; 4580type ResponseFormatTextJSONSchemaConfig = { 4581 name: string; 4582 schema: { 4583 [key: string]: unknown; 4584 }; 4585 type: "json_schema"; 4586 description?: string; 4587 strict?: boolean | null; 4588}; 4589type ResponseFunctionCallArgumentsDeltaEvent = { 4590 delta: string; 4591 item_id: string; 4592 output_index: number; 4593 sequence_number: number; 4594 type: "response.function_call_arguments.delta"; 4595}; 4596type ResponseFunctionCallArgumentsDoneEvent = { 4597 arguments: string; 4598 item_id: string; 4599 name: string; 4600 output_index: number; 4601 sequence_number: number; 4602 type: "response.function_call_arguments.done"; 4603}; 4604type ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent; 4605type ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>; 4606type ResponseFunctionToolCall = { 4607 arguments: string; 4608 call_id: string; 4609 name: string; 4610 type: "function_call"; 4611 id?: string; 4612 status?: "in_progress" | "completed" | "incomplete"; 4613}; 4614interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall { 4615 id: string; 4616} 4617type ResponseFunctionToolCallOutputItem = { 4618 id: string; 4619 call_id: string; 4620 output: string | Array<ResponseInputText | ResponseInputImage>; 4621 type: "function_call_output"; 4622 status?: "in_progress" | "completed" | "incomplete"; 4623}; 4624type ResponseIncludable = "message.input_image.image_url" | "message.output_text.logprobs"; 4625type ResponseIncompleteEvent = { 4626 response: Response; 4627 sequence_number: number; 4628 type: "response.incomplete"; 4629}; 4630type ResponseInput = Array<ResponseInputItem>; 4631type ResponseInputContent = ResponseInputText | ResponseInputImage; 4632type ResponseInputImage = { 4633 detail: "low" | "high" | "auto"; 4634 type: "input_image"; 4635 /** 4636 * Base64 encoded image 4637 */ 4638 image_url?: string | null; 4639}; 4640type ResponseInputImageContent = { 4641 type: "input_image"; 4642 detail?: "low" | "high" | "auto" | null; 4643 /** 4644 * Base64 encoded image 4645 */ 4646 image_url?: string | null; 4647}; 4648type ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem; 4649type ResponseInputItemFunctionCallOutput = { 4650 call_id: string; 4651 output: string | ResponseFunctionCallOutputItemList; 4652 type: "function_call_output"; 4653 id?: string | null; 4654 status?: "in_progress" | "completed" | "incomplete" | null; 4655}; 4656type ResponseInputItemMessage = { 4657 content: ResponseInputMessageContentList; 4658 role: "user" | "system" | "developer"; 4659 status?: "in_progress" | "completed" | "incomplete"; 4660 type?: "message"; 4661}; 4662type ResponseInputMessageContentList = Array<ResponseInputContent>; 4663type ResponseInputMessageItem = { 4664 id: string; 4665 content: ResponseInputMessageContentList; 4666 role: "user" | "system" | "developer"; 4667 status?: "in_progress" | "completed" | "incomplete"; 4668 type?: "message"; 4669}; 4670type ResponseInputText = { 4671 text: string; 4672 type: "input_text"; 4673}; 4674type ResponseInputTextContent = { 4675 text: string; 4676 type: "input_text"; 4677}; 4678type ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem; 4679type ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem; 4680type ResponseOutputItemAddedEvent = { 4681 item: ResponseOutputItem; 4682 output_index: number; 4683 sequence_number: number; 4684 type: "response.output_item.added"; 4685}; 4686type ResponseOutputItemDoneEvent = { 4687 item: ResponseOutputItem; 4688 output_index: number; 4689 sequence_number: number; 4690 type: "response.output_item.done"; 4691}; 4692type ResponseOutputMessage = { 4693 id: string; 4694 content: Array<ResponseOutputText | ResponseOutputRefusal>; 4695 role: "assistant"; 4696 status: "in_progress" | "completed" | "incomplete"; 4697 type: "message"; 4698}; 4699type ResponseOutputRefusal = { 4700 refusal: string; 4701 type: "refusal"; 4702}; 4703type ResponseOutputText = { 4704 text: string; 4705 type: "output_text"; 4706 logprobs?: Array<Logprob>; 4707}; 4708type ResponseReasoningItem = { 4709 id: string; 4710 summary: Array<ResponseReasoningSummaryItem>; 4711 type: "reasoning"; 4712 content?: Array<ResponseReasoningContentItem>; 4713 encrypted_content?: string | null; 4714 status?: "in_progress" | "completed" | "incomplete"; 4715}; 4716type ResponseReasoningSummaryItem = { 4717 text: string; 4718 type: "summary_text"; 4719}; 4720type ResponseReasoningContentItem = { 4721 text: string; 4722 type: "reasoning_text"; 4723}; 4724type ResponseReasoningTextDeltaEvent = { 4725 content_index: number; 4726 delta: string; 4727 item_id: string; 4728 output_index: number; 4729 sequence_number: number; 4730 type: "response.reasoning_text.delta"; 4731}; 4732type ResponseReasoningTextDoneEvent = { 4733 content_index: number; 4734 item_id: string; 4735 output_index: number; 4736 sequence_number: number; 4737 text: string; 4738 type: "response.reasoning_text.done"; 4739}; 4740type ResponseRefusalDeltaEvent = { 4741 content_index: number; 4742 delta: string; 4743 item_id: string; 4744 output_index: number; 4745 sequence_number: number; 4746 type: "response.refusal.delta"; 4747}; 4748type ResponseRefusalDoneEvent = { 4749 content_index: number; 4750 item_id: string; 4751 output_index: number; 4752 refusal: string; 4753 sequence_number: number; 4754 type: "response.refusal.done"; 4755}; 4756type ResponseStatus = "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete"; 4757type ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent; 4758type ResponseCompletedEvent = { 4759 response: Response; 4760 sequence_number: number; 4761 type: "response.completed"; 4762}; 4763type ResponseTextConfig = { 4764 format?: ResponseFormatTextConfig; 4765 verbosity?: "low" | "medium" | "high" | null; 4766}; 4767type ResponseTextDeltaEvent = { 4768 content_index: number; 4769 delta: string; 4770 item_id: string; 4771 logprobs: Array<Logprob>; 4772 output_index: number; 4773 sequence_number: number; 4774 type: "response.output_text.delta"; 4775}; 4776type ResponseTextDoneEvent = { 4777 content_index: number; 4778 item_id: string; 4779 logprobs: Array<Logprob>; 4780 output_index: number; 4781 sequence_number: number; 4782 text: string; 4783 type: "response.output_text.done"; 4784}; 4785type Logprob = { 4786 token: string; 4787 logprob: number; 4788 top_logprobs?: Array<TopLogprob>; 4789}; 4790type TopLogprob = { 4791 token?: string; 4792 logprob?: number; 4793}; 4794type ResponseUsage = { 4795 input_tokens: number; 4796 output_tokens: number; 4797 total_tokens: number; 4798}; 4799type Tool = ResponsesFunctionTool; 4800type ToolChoiceFunction = { 4801 name: string; 4802 type: "function"; 4803}; 4804type ToolChoiceOptions = "none"; 4805type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null; 4806type StreamOptions = { 4807 include_obfuscation?: boolean; 4808}; 4809/** Marks keys from T that aren't in U as optional never */ 4810type Without<T, U> = { 4811 [P in Exclude<keyof T, keyof U>]?: never; 4812}; 4813/** Either T or U, but not both (mutually exclusive) */ 4814type XOR<T, U> = (T & Without<U, T>) | (U & Without<T, U>); 4815type Ai_Cf_Baai_Bge_Base_En_V1_5_Input = { 4816 text: string | string[]; 4817 /** 4818 * 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. 4819 */ 4820 pooling?: "mean" | "cls"; 4821} | { 4822 /** 4823 * Batch of the embeddings requests to run using async-queue 4824 */ 4825 requests: { 4826 text: string | string[]; 4827 /** 4828 * 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. 4829 */ 4830 pooling?: "mean" | "cls"; 4831 }[]; 4832}; 4833type Ai_Cf_Baai_Bge_Base_En_V1_5_Output = { 4834 shape?: number[]; 4835 /** 4836 * Embeddings of the requested text values 4837 */ 4838 data?: number[][]; 4839 /** 4840 * The pooling method used in the embedding process. 4841 */ 4842 pooling?: "mean" | "cls"; 4843} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse; 4844interface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse { 4845 /** 4846 * The async request id that can be used to obtain the results. 4847 */ 4848 request_id?: string; 4849} 4850declare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 { 4851 inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input; 4852 postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output; 4853} 4854type Ai_Cf_Openai_Whisper_Input = string | { 4855 /** 4856 * An array of integers that represent the audio data constrained to 8-bit unsigned integer values 4857 */ 4858 audio: number[]; 4859}; 4860interface Ai_Cf_Openai_Whisper_Output { 4861 /** 4862 * The transcription 4863 */ 4864 text: string; 4865 word_count?: number; 4866 words?: { 4867 word?: string; 4868 /** 4869 * The second this word begins in the recording 4870 */ 4871 start?: number; 4872 /** 4873 * The ending second when the word completes 4874 */ 4875 end?: number; 4876 }[]; 4877 vtt?: string; 4878} 4879declare abstract class Base_Ai_Cf_Openai_Whisper { 4880 inputs: Ai_Cf_Openai_Whisper_Input; 4881 postProcessedOutputs: Ai_Cf_Openai_Whisper_Output; 4882} 4883type Ai_Cf_Meta_M2M100_1_2B_Input = { 4884 /** 4885 * The text to be translated 4886 */ 4887 text: string; 4888 /** 4889 * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified 4890 */ 4891 source_lang?: string; 4892 /** 4893 * The language code to translate the text into (e.g., 'es' for Spanish) 4894 */ 4895 target_lang: string; 4896} | { 4897 /** 4898 * Batch of the embeddings requests to run using async-queue 4899 */ 4900 requests: { 4901 /** 4902 * The text to be translated 4903 */ 4904 text: string; 4905 /** 4906 * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified 4907 */ 4908 source_lang?: string; 4909 /** 4910 * The language code to translate the text into (e.g., 'es' for Spanish) 4911 */ 4912 target_lang: string; 4913 }[]; 4914}; 4915type Ai_Cf_Meta_M2M100_1_2B_Output = { 4916 /** 4917 * The translated text in the target language 4918 */ 4919 translated_text?: string; 4920} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse; 4921interface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse { 4922 /** 4923 * The async request id that can be used to obtain the results. 4924 */ 4925 request_id?: string; 4926} 4927declare abstract class Base_Ai_Cf_Meta_M2M100_1_2B { 4928 inputs: Ai_Cf_Meta_M2M100_1_2B_Input; 4929 postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output; 4930} 4931type Ai_Cf_Baai_Bge_Small_En_V1_5_Input = { 4932 text: string | string[]; 4933 /** 4934 * 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. 4935 */ 4936 pooling?: "mean" | "cls"; 4937} | { 4938 /** 4939 * Batch of the embeddings requests to run using async-queue 4940 */ 4941 requests: { 4942 text: string | string[]; 4943 /** 4944 * 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. 4945 */ 4946 pooling?: "mean" | "cls"; 4947 }[]; 4948}; 4949type Ai_Cf_Baai_Bge_Small_En_V1_5_Output = { 4950 shape?: number[]; 4951 /** 4952 * Embeddings of the requested text values 4953 */ 4954 data?: number[][]; 4955 /** 4956 * The pooling method used in the embedding process. 4957 */ 4958 pooling?: "mean" | "cls"; 4959} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse; 4960interface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse { 4961 /** 4962 * The async request id that can be used to obtain the results. 4963 */ 4964 request_id?: string; 4965} 4966declare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 { 4967 inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input; 4968 postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output; 4969} 4970type Ai_Cf_Baai_Bge_Large_En_V1_5_Input = { 4971 text: string | string[]; 4972 /** 4973 * 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. 4974 */ 4975 pooling?: "mean" | "cls"; 4976} | { 4977 /** 4978 * Batch of the embeddings requests to run using async-queue 4979 */ 4980 requests: { 4981 text: string | string[]; 4982 /** 4983 * 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. 4984 */ 4985 pooling?: "mean" | "cls"; 4986 }[]; 4987}; 4988type Ai_Cf_Baai_Bge_Large_En_V1_5_Output = { 4989 shape?: number[]; 4990 /** 4991 * Embeddings of the requested text values 4992 */ 4993 data?: number[][]; 4994 /** 4995 * The pooling method used in the embedding process. 4996 */ 4997 pooling?: "mean" | "cls"; 4998} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse; 4999interface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse { 5000 /** 5001 * The async request id that can be used to obtain the results. 5002 */ 5003 request_id?: string; 5004} 5005declare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 { 5006 inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input; 5007 postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output; 5008} 5009type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | { 5010 /** 5011 * The input text prompt for the model to generate a response. 5012 */ 5013 prompt?: string; 5014 /** 5015 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5016 */ 5017 raw?: boolean; 5018 /** 5019 * 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. 5020 */ 5021 top_p?: number; 5022 /** 5023 * 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. 5024 */ 5025 top_k?: number; 5026 /** 5027 * Random seed for reproducibility of the generation. 5028 */ 5029 seed?: number; 5030 /** 5031 * Penalty for repeated tokens; higher values discourage repetition. 5032 */ 5033 repetition_penalty?: number; 5034 /** 5035 * Decreases the likelihood of the model repeating the same lines verbatim. 5036 */ 5037 frequency_penalty?: number; 5038 /** 5039 * Increases the likelihood of the model introducing new topics. 5040 */ 5041 presence_penalty?: number; 5042 image: number[] | (string & NonNullable<unknown>); 5043 /** 5044 * The maximum number of tokens to generate in the response. 5045 */ 5046 max_tokens?: number; 5047}; 5048interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output { 5049 description?: string; 5050} 5051declare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M { 5052 inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input; 5053 postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output; 5054} 5055type Ai_Cf_Openai_Whisper_Tiny_En_Input = string | { 5056 /** 5057 * An array of integers that represent the audio data constrained to 8-bit unsigned integer values 5058 */ 5059 audio: number[]; 5060}; 5061interface Ai_Cf_Openai_Whisper_Tiny_En_Output { 5062 /** 5063 * The transcription 5064 */ 5065 text: string; 5066 word_count?: number; 5067 words?: { 5068 word?: string; 5069 /** 5070 * The second this word begins in the recording 5071 */ 5072 start?: number; 5073 /** 5074 * The ending second when the word completes 5075 */ 5076 end?: number; 5077 }[]; 5078 vtt?: string; 5079} 5080declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En { 5081 inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input; 5082 postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output; 5083} 5084interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input { 5085 audio: string | { 5086 body?: object; 5087 contentType?: string; 5088 }; 5089 /** 5090 * Supported tasks are 'translate' or 'transcribe'. 5091 */ 5092 task?: string; 5093 /** 5094 * The language of the audio being transcribed or translated. 5095 */ 5096 language?: string; 5097 /** 5098 * Preprocess the audio with a voice activity detection model. 5099 */ 5100 vad_filter?: boolean; 5101 /** 5102 * A text prompt to help provide context to the model on the contents of the audio. 5103 */ 5104 initial_prompt?: string; 5105 /** 5106 * The prefix appended to the beginning of the output of the transcription and can guide the transcription result. 5107 */ 5108 prefix?: string; 5109 /** 5110 * The number of beams to use in beam search decoding. Higher values may improve accuracy at the cost of speed. 5111 */ 5112 beam_size?: number; 5113 /** 5114 * Whether to condition on previous text during transcription. Setting to false may help prevent hallucination loops. 5115 */ 5116 condition_on_previous_text?: boolean; 5117 /** 5118 * Threshold for detecting no-speech segments. Segments with no-speech probability above this value are skipped. 5119 */ 5120 no_speech_threshold?: number; 5121 /** 5122 * Threshold for filtering out segments with high compression ratio, which often indicate repetitive or hallucinated text. 5123 */ 5124 compression_ratio_threshold?: number; 5125 /** 5126 * Threshold for filtering out segments with low average log probability, indicating low confidence. 5127 */ 5128 log_prob_threshold?: number; 5129 /** 5130 * Optional threshold (in seconds) to skip silent periods that may cause hallucinations. 5131 */ 5132 hallucination_silence_threshold?: number; 5133} 5134interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output { 5135 transcription_info?: { 5136 /** 5137 * The language of the audio being transcribed or translated. 5138 */ 5139 language?: string; 5140 /** 5141 * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1. 5142 */ 5143 language_probability?: number; 5144 /** 5145 * The total duration of the original audio file, in seconds. 5146 */ 5147 duration?: number; 5148 /** 5149 * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds. 5150 */ 5151 duration_after_vad?: number; 5152 }; 5153 /** 5154 * The complete transcription of the audio. 5155 */ 5156 text: string; 5157 /** 5158 * The total number of words in the transcription. 5159 */ 5160 word_count?: number; 5161 segments?: { 5162 /** 5163 * The starting time of the segment within the audio, in seconds. 5164 */ 5165 start?: number; 5166 /** 5167 * The ending time of the segment within the audio, in seconds. 5168 */ 5169 end?: number; 5170 /** 5171 * The transcription of the segment. 5172 */ 5173 text?: string; 5174 /** 5175 * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs. 5176 */ 5177 temperature?: number; 5178 /** 5179 * The average log probability of the predictions for the words in this segment, indicating overall confidence. 5180 */ 5181 avg_logprob?: number; 5182 /** 5183 * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process. 5184 */ 5185 compression_ratio?: number; 5186 /** 5187 * The probability that the segment contains no speech, represented as a decimal between 0 and 1. 5188 */ 5189 no_speech_prob?: number; 5190 words?: { 5191 /** 5192 * The individual word transcribed from the audio. 5193 */ 5194 word?: string; 5195 /** 5196 * The starting time of the word within the audio, in seconds. 5197 */ 5198 start?: number; 5199 /** 5200 * The ending time of the word within the audio, in seconds. 5201 */ 5202 end?: number; 5203 }[]; 5204 }[]; 5205 /** 5206 * The transcription in WebVTT format, which includes timing and text information for use in subtitles. 5207 */ 5208 vtt?: string; 5209} 5210declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo { 5211 inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input; 5212 postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output; 5213} 5214type Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | { 5215 /** 5216 * Batch of the embeddings requests to run using async-queue 5217 */ 5218 requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[]; 5219}; 5220interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts { 5221 /** 5222 * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts 5223 */ 5224 query?: string; 5225 /** 5226 * List of provided contexts. Note that the index in this array is important, as the response will refer to it. 5227 */ 5228 contexts: { 5229 /** 5230 * One of the provided context content 5231 */ 5232 text?: string; 5233 }[]; 5234 /** 5235 * When provided with too long context should the model error out or truncate the context to fit? 5236 */ 5237 truncate_inputs?: boolean; 5238} 5239interface Ai_Cf_Baai_Bge_M3_Input_Embedding { 5240 text: string | string[]; 5241 /** 5242 * When provided with too long context should the model error out or truncate the context to fit? 5243 */ 5244 truncate_inputs?: boolean; 5245} 5246interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 { 5247 /** 5248 * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts 5249 */ 5250 query?: string; 5251 /** 5252 * List of provided contexts. Note that the index in this array is important, as the response will refer to it. 5253 */ 5254 contexts: { 5255 /** 5256 * One of the provided context content 5257 */ 5258 text?: string; 5259 }[]; 5260 /** 5261 * When provided with too long context should the model error out or truncate the context to fit? 5262 */ 5263 truncate_inputs?: boolean; 5264} 5265interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 { 5266 text: string | string[]; 5267 /** 5268 * When provided with too long context should the model error out or truncate the context to fit? 5269 */ 5270 truncate_inputs?: boolean; 5271} 5272type 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; 5273interface Ai_Cf_Baai_Bge_M3_Output_Query { 5274 response?: { 5275 /** 5276 * Index of the context in the request 5277 */ 5278 id?: number; 5279 /** 5280 * Score of the context under the index. 5281 */ 5282 score?: number; 5283 }[]; 5284} 5285interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts { 5286 response?: number[][]; 5287 shape?: number[]; 5288 /** 5289 * The pooling method used in the embedding process. 5290 */ 5291 pooling?: "mean" | "cls"; 5292} 5293interface Ai_Cf_Baai_Bge_M3_Output_Embedding { 5294 shape?: number[]; 5295 /** 5296 * Embeddings of the requested text values 5297 */ 5298 data?: number[][]; 5299 /** 5300 * The pooling method used in the embedding process. 5301 */ 5302 pooling?: "mean" | "cls"; 5303} 5304interface Ai_Cf_Baai_Bge_M3_AsyncResponse { 5305 /** 5306 * The async request id that can be used to obtain the results. 5307 */ 5308 request_id?: string; 5309} 5310declare abstract class Base_Ai_Cf_Baai_Bge_M3 { 5311 inputs: Ai_Cf_Baai_Bge_M3_Input; 5312 postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output; 5313} 5314interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input { 5315 /** 5316 * A text description of the image you want to generate. 5317 */ 5318 prompt: string; 5319 /** 5320 * The number of diffusion steps; higher values can improve quality but take longer. 5321 */ 5322 steps?: number; 5323} 5324interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output { 5325 /** 5326 * The generated image in Base64 format. 5327 */ 5328 image?: string; 5329} 5330declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell { 5331 inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input; 5332 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output; 5333} 5334type 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; 5335interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt { 5336 /** 5337 * The input text prompt for the model to generate a response. 5338 */ 5339 prompt: string; 5340 image?: number[] | (string & NonNullable<unknown>); 5341 /** 5342 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5343 */ 5344 raw?: boolean; 5345 /** 5346 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5347 */ 5348 stream?: boolean; 5349 /** 5350 * The maximum number of tokens to generate in the response. 5351 */ 5352 max_tokens?: number; 5353 /** 5354 * Controls the randomness of the output; higher values produce more random results. 5355 */ 5356 temperature?: number; 5357 /** 5358 * 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. 5359 */ 5360 top_p?: number; 5361 /** 5362 * 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. 5363 */ 5364 top_k?: number; 5365 /** 5366 * Random seed for reproducibility of the generation. 5367 */ 5368 seed?: number; 5369 /** 5370 * Penalty for repeated tokens; higher values discourage repetition. 5371 */ 5372 repetition_penalty?: number; 5373 /** 5374 * Decreases the likelihood of the model repeating the same lines verbatim. 5375 */ 5376 frequency_penalty?: number; 5377 /** 5378 * Increases the likelihood of the model introducing new topics. 5379 */ 5380 presence_penalty?: number; 5381 /** 5382 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 5383 */ 5384 lora?: string; 5385} 5386interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages { 5387 /** 5388 * An array of message objects representing the conversation history. 5389 */ 5390 messages: { 5391 /** 5392 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 5393 */ 5394 role?: string; 5395 /** 5396 * The tool call id. If you don't know what to put here you can fall back to 000000001 5397 */ 5398 tool_call_id?: string; 5399 content?: string | { 5400 /** 5401 * Type of the content provided 5402 */ 5403 type?: string; 5404 text?: string; 5405 image_url?: { 5406 /** 5407 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 5408 */ 5409 url?: string; 5410 }; 5411 }[] | { 5412 /** 5413 * Type of the content provided 5414 */ 5415 type?: string; 5416 text?: string; 5417 image_url?: { 5418 /** 5419 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 5420 */ 5421 url?: string; 5422 }; 5423 }; 5424 }[]; 5425 image?: number[] | (string & NonNullable<unknown>); 5426 functions?: { 5427 name: string; 5428 code: string; 5429 }[]; 5430 /** 5431 * A list of tools available for the assistant to use. 5432 */ 5433 tools?: ({ 5434 /** 5435 * The name of the tool. More descriptive the better. 5436 */ 5437 name: string; 5438 /** 5439 * A brief description of what the tool does. 5440 */ 5441 description: string; 5442 /** 5443 * Schema defining the parameters accepted by the tool. 5444 */ 5445 parameters: { 5446 /** 5447 * The type of the parameters object (usually 'object'). 5448 */ 5449 type: string; 5450 /** 5451 * List of required parameter names. 5452 */ 5453 required?: string[]; 5454 /** 5455 * Definitions of each parameter. 5456 */ 5457 properties: { 5458 [k: string]: { 5459 /** 5460 * The data type of the parameter. 5461 */ 5462 type: string; 5463 /** 5464 * A description of the expected parameter. 5465 */ 5466 description: string; 5467 }; 5468 }; 5469 }; 5470 } | { 5471 /** 5472 * Specifies the type of tool (e.g., 'function'). 5473 */ 5474 type: string; 5475 /** 5476 * Details of the function tool. 5477 */ 5478 function: { 5479 /** 5480 * The name of the function. 5481 */ 5482 name: string; 5483 /** 5484 * A brief description of what the function does. 5485 */ 5486 description: string; 5487 /** 5488 * Schema defining the parameters accepted by the function. 5489 */ 5490 parameters: { 5491 /** 5492 * The type of the parameters object (usually 'object'). 5493 */ 5494 type: string; 5495 /** 5496 * List of required parameter names. 5497 */ 5498 required?: string[]; 5499 /** 5500 * Definitions of each parameter. 5501 */ 5502 properties: { 5503 [k: string]: { 5504 /** 5505 * The data type of the parameter. 5506 */ 5507 type: string; 5508 /** 5509 * A description of the expected parameter. 5510 */ 5511 description: string; 5512 }; 5513 }; 5514 }; 5515 }; 5516 })[]; 5517 /** 5518 * If true, the response will be streamed back incrementally. 5519 */ 5520 stream?: boolean; 5521 /** 5522 * The maximum number of tokens to generate in the response. 5523 */ 5524 max_tokens?: number; 5525 /** 5526 * Controls the randomness of the output; higher values produce more random results. 5527 */ 5528 temperature?: number; 5529 /** 5530 * 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. 5531 */ 5532 top_p?: number; 5533 /** 5534 * 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. 5535 */ 5536 top_k?: number; 5537 /** 5538 * Random seed for reproducibility of the generation. 5539 */ 5540 seed?: number; 5541 /** 5542 * Penalty for repeated tokens; higher values discourage repetition. 5543 */ 5544 repetition_penalty?: number; 5545 /** 5546 * Decreases the likelihood of the model repeating the same lines verbatim. 5547 */ 5548 frequency_penalty?: number; 5549 /** 5550 * Increases the likelihood of the model introducing new topics. 5551 */ 5552 presence_penalty?: number; 5553} 5554type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = { 5555 /** 5556 * The generated text response from the model 5557 */ 5558 response?: string; 5559 /** 5560 * An array of tool calls requests made during the response generation 5561 */ 5562 tool_calls?: { 5563 /** 5564 * The arguments passed to be passed to the tool call request 5565 */ 5566 arguments?: object; 5567 /** 5568 * The name of the tool to be called 5569 */ 5570 name?: string; 5571 }[]; 5572}; 5573declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct { 5574 inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input; 5575 postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output; 5576} 5577type 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; 5578interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt { 5579 /** 5580 * The input text prompt for the model to generate a response. 5581 */ 5582 prompt: string; 5583 /** 5584 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 5585 */ 5586 lora?: string; 5587 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode; 5588 /** 5589 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5590 */ 5591 raw?: boolean; 5592 /** 5593 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5594 */ 5595 stream?: boolean; 5596 /** 5597 * The maximum number of tokens to generate in the response. 5598 */ 5599 max_tokens?: number; 5600 /** 5601 * Controls the randomness of the output; higher values produce more random results. 5602 */ 5603 temperature?: number; 5604 /** 5605 * 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. 5606 */ 5607 top_p?: number; 5608 /** 5609 * 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. 5610 */ 5611 top_k?: number; 5612 /** 5613 * Random seed for reproducibility of the generation. 5614 */ 5615 seed?: number; 5616 /** 5617 * Penalty for repeated tokens; higher values discourage repetition. 5618 */ 5619 repetition_penalty?: number; 5620 /** 5621 * Decreases the likelihood of the model repeating the same lines verbatim. 5622 */ 5623 frequency_penalty?: number; 5624 /** 5625 * Increases the likelihood of the model introducing new topics. 5626 */ 5627 presence_penalty?: number; 5628} 5629interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode { 5630 type?: "json_object" | "json_schema"; 5631 json_schema?: unknown; 5632} 5633interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages { 5634 /** 5635 * An array of message objects representing the conversation history. 5636 */ 5637 messages: { 5638 /** 5639 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 5640 */ 5641 role: string; 5642 content: string | { 5643 /** 5644 * Type of the content (text) 5645 */ 5646 type?: string; 5647 /** 5648 * Text content 5649 */ 5650 text?: string; 5651 }[]; 5652 }[]; 5653 functions?: { 5654 name: string; 5655 code: string; 5656 }[]; 5657 /** 5658 * A list of tools available for the assistant to use. 5659 */ 5660 tools?: ({ 5661 /** 5662 * The name of the tool. More descriptive the better. 5663 */ 5664 name: string; 5665 /** 5666 * A brief description of what the tool does. 5667 */ 5668 description: string; 5669 /** 5670 * Schema defining the parameters accepted by the tool. 5671 */ 5672 parameters: { 5673 /** 5674 * The type of the parameters object (usually 'object'). 5675 */ 5676 type: string; 5677 /** 5678 * List of required parameter names. 5679 */ 5680 required?: string[]; 5681 /** 5682 * Definitions of each parameter. 5683 */ 5684 properties: { 5685 [k: string]: { 5686 /** 5687 * The data type of the parameter. 5688 */ 5689 type: string; 5690 /** 5691 * A description of the expected parameter. 5692 */ 5693 description: string; 5694 }; 5695 }; 5696 }; 5697 } | { 5698 /** 5699 * Specifies the type of tool (e.g., 'function'). 5700 */ 5701 type: string; 5702 /** 5703 * Details of the function tool. 5704 */ 5705 function: { 5706 /** 5707 * The name of the function. 5708 */ 5709 name: string; 5710 /** 5711 * A brief description of what the function does. 5712 */ 5713 description: string; 5714 /** 5715 * Schema defining the parameters accepted by the function. 5716 */ 5717 parameters: { 5718 /** 5719 * The type of the parameters object (usually 'object'). 5720 */ 5721 type: string; 5722 /** 5723 * List of required parameter names. 5724 */ 5725 required?: string[]; 5726 /** 5727 * Definitions of each parameter. 5728 */ 5729 properties: { 5730 [k: string]: { 5731 /** 5732 * The data type of the parameter. 5733 */ 5734 type: string; 5735 /** 5736 * A description of the expected parameter. 5737 */ 5738 description: string; 5739 }; 5740 }; 5741 }; 5742 }; 5743 })[]; 5744 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1; 5745 /** 5746 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5747 */ 5748 raw?: boolean; 5749 /** 5750 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5751 */ 5752 stream?: boolean; 5753 /** 5754 * The maximum number of tokens to generate in the response. 5755 */ 5756 max_tokens?: number; 5757 /** 5758 * Controls the randomness of the output; higher values produce more random results. 5759 */ 5760 temperature?: number; 5761 /** 5762 * 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. 5763 */ 5764 top_p?: number; 5765 /** 5766 * 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. 5767 */ 5768 top_k?: number; 5769 /** 5770 * Random seed for reproducibility of the generation. 5771 */ 5772 seed?: number; 5773 /** 5774 * Penalty for repeated tokens; higher values discourage repetition. 5775 */ 5776 repetition_penalty?: number; 5777 /** 5778 * Decreases the likelihood of the model repeating the same lines verbatim. 5779 */ 5780 frequency_penalty?: number; 5781 /** 5782 * Increases the likelihood of the model introducing new topics. 5783 */ 5784 presence_penalty?: number; 5785} 5786interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 { 5787 type?: "json_object" | "json_schema"; 5788 json_schema?: unknown; 5789} 5790interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch { 5791 requests?: { 5792 /** 5793 * 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. 5794 */ 5795 external_reference?: string; 5796 /** 5797 * Prompt for the text generation model 5798 */ 5799 prompt?: string; 5800 /** 5801 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5802 */ 5803 stream?: boolean; 5804 /** 5805 * The maximum number of tokens to generate in the response. 5806 */ 5807 max_tokens?: number; 5808 /** 5809 * Controls the randomness of the output; higher values produce more random results. 5810 */ 5811 temperature?: number; 5812 /** 5813 * 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. 5814 */ 5815 top_p?: number; 5816 /** 5817 * Random seed for reproducibility of the generation. 5818 */ 5819 seed?: number; 5820 /** 5821 * Penalty for repeated tokens; higher values discourage repetition. 5822 */ 5823 repetition_penalty?: number; 5824 /** 5825 * Decreases the likelihood of the model repeating the same lines verbatim. 5826 */ 5827 frequency_penalty?: number; 5828 /** 5829 * Increases the likelihood of the model introducing new topics. 5830 */ 5831 presence_penalty?: number; 5832 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2; 5833 }[]; 5834} 5835interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 { 5836 type?: "json_object" | "json_schema"; 5837 json_schema?: unknown; 5838} 5839type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = { 5840 /** 5841 * The generated text response from the model 5842 */ 5843 response: string; 5844 /** 5845 * Usage statistics for the inference request 5846 */ 5847 usage?: { 5848 /** 5849 * Total number of tokens in input 5850 */ 5851 prompt_tokens?: number; 5852 /** 5853 * Total number of tokens in output 5854 */ 5855 completion_tokens?: number; 5856 /** 5857 * Total number of input and output tokens 5858 */ 5859 total_tokens?: number; 5860 }; 5861 /** 5862 * An array of tool calls requests made during the response generation 5863 */ 5864 tool_calls?: { 5865 /** 5866 * The arguments passed to be passed to the tool call request 5867 */ 5868 arguments?: object; 5869 /** 5870 * The name of the tool to be called 5871 */ 5872 name?: string; 5873 }[]; 5874} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse; 5875interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse { 5876 /** 5877 * The async request id that can be used to obtain the results. 5878 */ 5879 request_id?: string; 5880} 5881declare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast { 5882 inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input; 5883 postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output; 5884} 5885interface Ai_Cf_Meta_Llama_Guard_3_8B_Input { 5886 /** 5887 * An array of message objects representing the conversation history. 5888 */ 5889 messages: { 5890 /** 5891 * The role of the message sender must alternate between 'user' and 'assistant'. 5892 */ 5893 role: "user" | "assistant"; 5894 /** 5895 * The content of the message as a string. 5896 */ 5897 content: string; 5898 }[]; 5899 /** 5900 * The maximum number of tokens to generate in the response. 5901 */ 5902 max_tokens?: number; 5903 /** 5904 * Controls the randomness of the output; higher values produce more random results. 5905 */ 5906 temperature?: number; 5907 /** 5908 * Dictate the output format of the generated response. 5909 */ 5910 response_format?: { 5911 /** 5912 * Set to json_object to process and output generated text as JSON. 5913 */ 5914 type?: string; 5915 }; 5916} 5917interface Ai_Cf_Meta_Llama_Guard_3_8B_Output { 5918 response?: string | { 5919 /** 5920 * Whether the conversation is safe or not. 5921 */ 5922 safe?: boolean; 5923 /** 5924 * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe. 5925 */ 5926 categories?: string[]; 5927 }; 5928 /** 5929 * Usage statistics for the inference request 5930 */ 5931 usage?: { 5932 /** 5933 * Total number of tokens in input 5934 */ 5935 prompt_tokens?: number; 5936 /** 5937 * Total number of tokens in output 5938 */ 5939 completion_tokens?: number; 5940 /** 5941 * Total number of input and output tokens 5942 */ 5943 total_tokens?: number; 5944 }; 5945} 5946declare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B { 5947 inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input; 5948 postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output; 5949} 5950interface Ai_Cf_Baai_Bge_Reranker_Base_Input { 5951 /** 5952 * A query you wish to perform against the provided contexts. 5953 */ 5954 /** 5955 * Number of returned results starting with the best score. 5956 */ 5957 top_k?: number; 5958 /** 5959 * List of provided contexts. Note that the index in this array is important, as the response will refer to it. 5960 */ 5961 contexts: { 5962 /** 5963 * One of the provided context content 5964 */ 5965 text?: string; 5966 }[]; 5967} 5968interface Ai_Cf_Baai_Bge_Reranker_Base_Output { 5969 response?: { 5970 /** 5971 * Index of the context in the request 5972 */ 5973 id?: number; 5974 /** 5975 * Score of the context under the index. 5976 */ 5977 score?: number; 5978 }[]; 5979} 5980declare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base { 5981 inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input; 5982 postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output; 5983} 5984type 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; 5985interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt { 5986 /** 5987 * The input text prompt for the model to generate a response. 5988 */ 5989 prompt: string; 5990 /** 5991 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 5992 */ 5993 lora?: string; 5994 response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode; 5995 /** 5996 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5997 */ 5998 raw?: boolean; 5999 /** 6000 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6001 */ 6002 stream?: boolean; 6003 /** 6004 * The maximum number of tokens to generate in the response. 6005 */ 6006 max_tokens?: number; 6007 /** 6008 * Controls the randomness of the output; higher values produce more random results. 6009 */ 6010 temperature?: number; 6011 /** 6012 * 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. 6013 */ 6014 top_p?: number; 6015 /** 6016 * 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. 6017 */ 6018 top_k?: number; 6019 /** 6020 * Random seed for reproducibility of the generation. 6021 */ 6022 seed?: number; 6023 /** 6024 * Penalty for repeated tokens; higher values discourage repetition. 6025 */ 6026 repetition_penalty?: number; 6027 /** 6028 * Decreases the likelihood of the model repeating the same lines verbatim. 6029 */ 6030 frequency_penalty?: number; 6031 /** 6032 * Increases the likelihood of the model introducing new topics. 6033 */ 6034 presence_penalty?: number; 6035} 6036interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode { 6037 type?: "json_object" | "json_schema"; 6038 json_schema?: unknown; 6039} 6040interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages { 6041 /** 6042 * An array of message objects representing the conversation history. 6043 */ 6044 messages: { 6045 /** 6046 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 6047 */ 6048 role: string; 6049 /** 6050 * The content of the message as a string. 6051 */ 6052 content: string; 6053 }[]; 6054 functions?: { 6055 name: string; 6056 code: string; 6057 }[]; 6058 /** 6059 * A list of tools available for the assistant to use. 6060 */ 6061 tools?: ({ 6062 /** 6063 * The name of the tool. More descriptive the better. 6064 */ 6065 name: string; 6066 /** 6067 * A brief description of what the tool does. 6068 */ 6069 description: string; 6070 /** 6071 * Schema defining the parameters accepted by the tool. 6072 */ 6073 parameters: { 6074 /** 6075 * The type of the parameters object (usually 'object'). 6076 */ 6077 type: string; 6078 /** 6079 * List of required parameter names. 6080 */ 6081 required?: string[]; 6082 /** 6083 * Definitions of each parameter. 6084 */ 6085 properties: { 6086 [k: string]: { 6087 /** 6088 * The data type of the parameter. 6089 */ 6090 type: string; 6091 /** 6092 * A description of the expected parameter. 6093 */ 6094 description: string; 6095 }; 6096 }; 6097 }; 6098 } | { 6099 /** 6100 * Specifies the type of tool (e.g., 'function'). 6101 */ 6102 type: string; 6103 /** 6104 * Details of the function tool. 6105 */ 6106 function: { 6107 /** 6108 * The name of the function. 6109 */ 6110 name: string; 6111 /** 6112 * A brief description of what the function does. 6113 */ 6114 description: string; 6115 /** 6116 * Schema defining the parameters accepted by the function. 6117 */ 6118 parameters: { 6119 /** 6120 * The type of the parameters object (usually 'object'). 6121 */ 6122 type: string; 6123 /** 6124 * List of required parameter names. 6125 */ 6126 required?: string[]; 6127 /** 6128 * Definitions of each parameter. 6129 */ 6130 properties: { 6131 [k: string]: { 6132 /** 6133 * The data type of the parameter. 6134 */ 6135 type: string; 6136 /** 6137 * A description of the expected parameter. 6138 */ 6139 description: string; 6140 }; 6141 }; 6142 }; 6143 }; 6144 })[]; 6145 response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1; 6146 /** 6147 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6148 */ 6149 raw?: boolean; 6150 /** 6151 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6152 */ 6153 stream?: boolean; 6154 /** 6155 * The maximum number of tokens to generate in the response. 6156 */ 6157 max_tokens?: number; 6158 /** 6159 * Controls the randomness of the output; higher values produce more random results. 6160 */ 6161 temperature?: number; 6162 /** 6163 * 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. 6164 */ 6165 top_p?: number; 6166 /** 6167 * 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. 6168 */ 6169 top_k?: number; 6170 /** 6171 * Random seed for reproducibility of the generation. 6172 */ 6173 seed?: number; 6174 /** 6175 * Penalty for repeated tokens; higher values discourage repetition. 6176 */ 6177 repetition_penalty?: number; 6178 /** 6179 * Decreases the likelihood of the model repeating the same lines verbatim. 6180 */ 6181 frequency_penalty?: number; 6182 /** 6183 * Increases the likelihood of the model introducing new topics. 6184 */ 6185 presence_penalty?: number; 6186} 6187interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 { 6188 type?: "json_object" | "json_schema"; 6189 json_schema?: unknown; 6190} 6191type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = { 6192 /** 6193 * The generated text response from the model 6194 */ 6195 response: string; 6196 /** 6197 * Usage statistics for the inference request 6198 */ 6199 usage?: { 6200 /** 6201 * Total number of tokens in input 6202 */ 6203 prompt_tokens?: number; 6204 /** 6205 * Total number of tokens in output 6206 */ 6207 completion_tokens?: number; 6208 /** 6209 * Total number of input and output tokens 6210 */ 6211 total_tokens?: number; 6212 }; 6213 /** 6214 * An array of tool calls requests made during the response generation 6215 */ 6216 tool_calls?: { 6217 /** 6218 * The arguments passed to be passed to the tool call request 6219 */ 6220 arguments?: object; 6221 /** 6222 * The name of the tool to be called 6223 */ 6224 name?: string; 6225 }[]; 6226}; 6227declare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct { 6228 inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input; 6229 postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output; 6230} 6231type Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages; 6232interface Ai_Cf_Qwen_Qwq_32B_Prompt { 6233 /** 6234 * The input text prompt for the model to generate a response. 6235 */ 6236 prompt: string; 6237 /** 6238 * JSON schema that should be fulfilled for the response. 6239 */ 6240 guided_json?: object; 6241 /** 6242 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6243 */ 6244 raw?: boolean; 6245 /** 6246 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6247 */ 6248 stream?: boolean; 6249 /** 6250 * The maximum number of tokens to generate in the response. 6251 */ 6252 max_tokens?: number; 6253 /** 6254 * Controls the randomness of the output; higher values produce more random results. 6255 */ 6256 temperature?: number; 6257 /** 6258 * 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. 6259 */ 6260 top_p?: number; 6261 /** 6262 * 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. 6263 */ 6264 top_k?: number; 6265 /** 6266 * Random seed for reproducibility of the generation. 6267 */ 6268 seed?: number; 6269 /** 6270 * Penalty for repeated tokens; higher values discourage repetition. 6271 */ 6272 repetition_penalty?: number; 6273 /** 6274 * Decreases the likelihood of the model repeating the same lines verbatim. 6275 */ 6276 frequency_penalty?: number; 6277 /** 6278 * Increases the likelihood of the model introducing new topics. 6279 */ 6280 presence_penalty?: number; 6281} 6282interface Ai_Cf_Qwen_Qwq_32B_Messages { 6283 /** 6284 * An array of message objects representing the conversation history. 6285 */ 6286 messages: { 6287 /** 6288 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 6289 */ 6290 role?: string; 6291 /** 6292 * The tool call id. If you don't know what to put here you can fall back to 000000001 6293 */ 6294 tool_call_id?: string; 6295 content?: string | { 6296 /** 6297 * Type of the content provided 6298 */ 6299 type?: string; 6300 text?: string; 6301 image_url?: { 6302 /** 6303 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 6304 */ 6305 url?: string; 6306 }; 6307 }[] | { 6308 /** 6309 * Type of the content provided 6310 */ 6311 type?: string; 6312 text?: string; 6313 image_url?: { 6314 /** 6315 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 6316 */ 6317 url?: string; 6318 }; 6319 }; 6320 }[]; 6321 functions?: { 6322 name: string; 6323 code: string; 6324 }[]; 6325 /** 6326 * A list of tools available for the assistant to use. 6327 */ 6328 tools?: ({ 6329 /** 6330 * The name of the tool. More descriptive the better. 6331 */ 6332 name: string; 6333 /** 6334 * A brief description of what the tool does. 6335 */ 6336 description: string; 6337 /** 6338 * Schema defining the parameters accepted by the tool. 6339 */ 6340 parameters: { 6341 /** 6342 * The type of the parameters object (usually 'object'). 6343 */ 6344 type: string; 6345 /** 6346 * List of required parameter names. 6347 */ 6348 required?: string[]; 6349 /** 6350 * Definitions of each parameter. 6351 */ 6352 properties: { 6353 [k: string]: { 6354 /** 6355 * The data type of the parameter. 6356 */ 6357 type: string; 6358 /** 6359 * A description of the expected parameter. 6360 */ 6361 description: string; 6362 }; 6363 }; 6364 }; 6365 } | { 6366 /** 6367 * Specifies the type of tool (e.g., 'function'). 6368 */ 6369 type: string; 6370 /** 6371 * Details of the function tool. 6372 */ 6373 function: { 6374 /** 6375 * The name of the function. 6376 */ 6377 name: string; 6378 /** 6379 * A brief description of what the function does. 6380 */ 6381 description: string; 6382 /** 6383 * Schema defining the parameters accepted by the function. 6384 */ 6385 parameters: { 6386 /** 6387 * The type of the parameters object (usually 'object'). 6388 */ 6389 type: string; 6390 /** 6391 * List of required parameter names. 6392 */ 6393 required?: string[]; 6394 /** 6395 * Definitions of each parameter. 6396 */ 6397 properties: { 6398 [k: string]: { 6399 /** 6400 * The data type of the parameter. 6401 */ 6402 type: string; 6403 /** 6404 * A description of the expected parameter. 6405 */ 6406 description: string; 6407 }; 6408 }; 6409 }; 6410 }; 6411 })[]; 6412 /** 6413 * JSON schema that should be fufilled for the response. 6414 */ 6415 guided_json?: object; 6416 /** 6417 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6418 */ 6419 raw?: boolean; 6420 /** 6421 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6422 */ 6423 stream?: boolean; 6424 /** 6425 * The maximum number of tokens to generate in the response. 6426 */ 6427 max_tokens?: number; 6428 /** 6429 * Controls the randomness of the output; higher values produce more random results. 6430 */ 6431 temperature?: number; 6432 /** 6433 * 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. 6434 */ 6435 top_p?: number; 6436 /** 6437 * 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. 6438 */ 6439 top_k?: number; 6440 /** 6441 * Random seed for reproducibility of the generation. 6442 */ 6443 seed?: number; 6444 /** 6445 * Penalty for repeated tokens; higher values discourage repetition. 6446 */ 6447 repetition_penalty?: number; 6448 /** 6449 * Decreases the likelihood of the model repeating the same lines verbatim. 6450 */ 6451 frequency_penalty?: number; 6452 /** 6453 * Increases the likelihood of the model introducing new topics. 6454 */ 6455 presence_penalty?: number; 6456} 6457type Ai_Cf_Qwen_Qwq_32B_Output = { 6458 /** 6459 * The generated text response from the model 6460 */ 6461 response: string; 6462 /** 6463 * Usage statistics for the inference request 6464 */ 6465 usage?: { 6466 /** 6467 * Total number of tokens in input 6468 */ 6469 prompt_tokens?: number; 6470 /** 6471 * Total number of tokens in output 6472 */ 6473 completion_tokens?: number; 6474 /** 6475 * Total number of input and output tokens 6476 */ 6477 total_tokens?: number; 6478 }; 6479 /** 6480 * An array of tool calls requests made during the response generation 6481 */ 6482 tool_calls?: { 6483 /** 6484 * The arguments passed to be passed to the tool call request 6485 */ 6486 arguments?: object; 6487 /** 6488 * The name of the tool to be called 6489 */ 6490 name?: string; 6491 }[]; 6492}; 6493declare abstract class Base_Ai_Cf_Qwen_Qwq_32B { 6494 inputs: Ai_Cf_Qwen_Qwq_32B_Input; 6495 postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output; 6496} 6497type 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; 6498interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt { 6499 /** 6500 * The input text prompt for the model to generate a response. 6501 */ 6502 prompt: string; 6503 /** 6504 * JSON schema that should be fulfilled for the response. 6505 */ 6506 guided_json?: object; 6507 /** 6508 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6509 */ 6510 raw?: boolean; 6511 /** 6512 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6513 */ 6514 stream?: boolean; 6515 /** 6516 * The maximum number of tokens to generate in the response. 6517 */ 6518 max_tokens?: number; 6519 /** 6520 * Controls the randomness of the output; higher values produce more random results. 6521 */ 6522 temperature?: number; 6523 /** 6524 * 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. 6525 */ 6526 top_p?: number; 6527 /** 6528 * 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. 6529 */ 6530 top_k?: number; 6531 /** 6532 * Random seed for reproducibility of the generation. 6533 */ 6534 seed?: number; 6535 /** 6536 * Penalty for repeated tokens; higher values discourage repetition. 6537 */ 6538 repetition_penalty?: number; 6539 /** 6540 * Decreases the likelihood of the model repeating the same lines verbatim. 6541 */ 6542 frequency_penalty?: number; 6543 /** 6544 * Increases the likelihood of the model introducing new topics. 6545 */ 6546 presence_penalty?: number; 6547} 6548interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages { 6549 /** 6550 * An array of message objects representing the conversation history. 6551 */ 6552 messages: { 6553 /** 6554 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 6555 */ 6556 role?: string; 6557 /** 6558 * 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 000000001 6559 */ 6560 tool_call_id?: string; 6561 content?: string | { 6562 /** 6563 * Type of the content provided 6564 */ 6565 type?: string; 6566 text?: string; 6567 image_url?: { 6568 /** 6569 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 6570 */ 6571 url?: string; 6572 }; 6573 }[] | { 6574 /** 6575 * Type of the content provided 6576 */ 6577 type?: string; 6578 text?: string; 6579 image_url?: { 6580 /** 6581 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 6582 */ 6583 url?: string; 6584 }; 6585 }; 6586 }[]; 6587 functions?: { 6588 name: string; 6589 code: string; 6590 }[]; 6591 /** 6592 * A list of tools available for the assistant to use. 6593 */ 6594 tools?: ({ 6595 /** 6596 * The name of the tool. More descriptive the better. 6597 */ 6598 name: string; 6599 /** 6600 * A brief description of what the tool does. 6601 */ 6602 description: string; 6603 /** 6604 * Schema defining the parameters accepted by the tool. 6605 */ 6606 parameters: { 6607 /** 6608 * The type of the parameters object (usually 'object'). 6609 */ 6610 type: string; 6611 /** 6612 * List of required parameter names. 6613 */ 6614 required?: string[]; 6615 /** 6616 * Definitions of each parameter. 6617 */ 6618 properties: { 6619 [k: string]: { 6620 /** 6621 * The data type of the parameter. 6622 */ 6623 type: string; 6624 /** 6625 * A description of the expected parameter. 6626 */ 6627 description: string; 6628 }; 6629 }; 6630 }; 6631 } | { 6632 /** 6633 * Specifies the type of tool (e.g., 'function'). 6634 */ 6635 type: string; 6636 /** 6637 * Details of the function tool. 6638 */ 6639 function: { 6640 /** 6641 * The name of the function. 6642 */ 6643 name: string; 6644 /** 6645 * A brief description of what the function does. 6646 */ 6647 description: string; 6648 /** 6649 * Schema defining the parameters accepted by the function. 6650 */ 6651 parameters: { 6652 /** 6653 * The type of the parameters object (usually 'object'). 6654 */ 6655 type: string; 6656 /** 6657 * List of required parameter names. 6658 */ 6659 required?: string[]; 6660 /** 6661 * Definitions of each parameter. 6662 */ 6663 properties: { 6664 [k: string]: { 6665 /** 6666 * The data type of the parameter. 6667 */ 6668 type: string; 6669 /** 6670 * A description of the expected parameter. 6671 */ 6672 description: string; 6673 }; 6674 }; 6675 }; 6676 }; 6677 })[]; 6678 /** 6679 * JSON schema that should be fufilled for the response. 6680 */ 6681 guided_json?: object; 6682 /** 6683 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6684 */ 6685 raw?: boolean; 6686 /** 6687 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6688 */ 6689 stream?: boolean; 6690 /** 6691 * The maximum number of tokens to generate in the response. 6692 */ 6693 max_tokens?: number; 6694 /** 6695 * Controls the randomness of the output; higher values produce more random results. 6696 */ 6697 temperature?: number; 6698 /** 6699 * 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. 6700 */ 6701 top_p?: number; 6702 /** 6703 * 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. 6704 */ 6705 top_k?: number; 6706 /** 6707 * Random seed for reproducibility of the generation. 6708 */ 6709 seed?: number; 6710 /** 6711 * Penalty for repeated tokens; higher values discourage repetition. 6712 */ 6713 repetition_penalty?: number; 6714 /** 6715 * Decreases the likelihood of the model repeating the same lines verbatim. 6716 */ 6717 frequency_penalty?: number; 6718 /** 6719 * Increases the likelihood of the model introducing new topics. 6720 */ 6721 presence_penalty?: number; 6722} 6723type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = { 6724 /** 6725 * The generated text response from the model 6726 */ 6727 response: string; 6728 /** 6729 * Usage statistics for the inference request 6730 */ 6731 usage?: { 6732 /** 6733 * Total number of tokens in input 6734 */ 6735 prompt_tokens?: number; 6736 /** 6737 * Total number of tokens in output 6738 */ 6739 completion_tokens?: number; 6740 /** 6741 * Total number of input and output tokens 6742 */ 6743 total_tokens?: number; 6744 }; 6745 /** 6746 * An array of tool calls requests made during the response generation 6747 */ 6748 tool_calls?: { 6749 /** 6750 * The arguments passed to be passed to the tool call request 6751 */ 6752 arguments?: object; 6753 /** 6754 * The name of the tool to be called 6755 */ 6756 name?: string; 6757 }[]; 6758}; 6759declare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct { 6760 inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input; 6761 postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output; 6762} 6763type Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages; 6764interface Ai_Cf_Google_Gemma_3_12B_It_Prompt { 6765 /** 6766 * The input text prompt for the model to generate a response. 6767 */ 6768 prompt: string; 6769 /** 6770 * JSON schema that should be fufilled for the response. 6771 */ 6772 guided_json?: object; 6773 /** 6774 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6775 */ 6776 raw?: boolean; 6777 /** 6778 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6779 */ 6780 stream?: boolean; 6781 /** 6782 * The maximum number of tokens to generate in the response. 6783 */ 6784 max_tokens?: number; 6785 /** 6786 * Controls the randomness of the output; higher values produce more random results. 6787 */ 6788 temperature?: number; 6789 /** 6790 * 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. 6791 */ 6792 top_p?: number; 6793 /** 6794 * 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. 6795 */ 6796 top_k?: number; 6797 /** 6798 * Random seed for reproducibility of the generation. 6799 */ 6800 seed?: number; 6801 /** 6802 * Penalty for repeated tokens; higher values discourage repetition. 6803 */ 6804 repetition_penalty?: number; 6805 /** 6806 * Decreases the likelihood of the model repeating the same lines verbatim. 6807 */ 6808 frequency_penalty?: number; 6809 /** 6810 * Increases the likelihood of the model introducing new topics. 6811 */ 6812 presence_penalty?: number; 6813} 6814interface Ai_Cf_Google_Gemma_3_12B_It_Messages { 6815 /** 6816 * An array of message objects representing the conversation history. 6817 */ 6818 messages: { 6819 /** 6820 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 6821 */ 6822 role?: string; 6823 content?: string | { 6824 /** 6825 * Type of the content provided 6826 */ 6827 type?: string; 6828 text?: string; 6829 image_url?: { 6830 /** 6831 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 6832 */ 6833 url?: string; 6834 }; 6835 }[]; 6836 }[]; 6837 functions?: { 6838 name: string; 6839 code: string; 6840 }[]; 6841 /** 6842 * A list of tools available for the assistant to use. 6843 */ 6844 tools?: ({ 6845 /** 6846 * The name of the tool. More descriptive the better. 6847 */ 6848 name: string; 6849 /** 6850 * A brief description of what the tool does. 6851 */ 6852 description: string; 6853 /** 6854 * Schema defining the parameters accepted by the tool. 6855 */ 6856 parameters: { 6857 /** 6858 * The type of the parameters object (usually 'object'). 6859 */ 6860 type: string; 6861 /** 6862 * List of required parameter names. 6863 */ 6864 required?: string[]; 6865 /** 6866 * Definitions of each parameter. 6867 */ 6868 properties: { 6869 [k: string]: { 6870 /** 6871 * The data type of the parameter. 6872 */ 6873 type: string; 6874 /** 6875 * A description of the expected parameter. 6876 */ 6877 description: string; 6878 }; 6879 }; 6880 }; 6881 } | { 6882 /** 6883 * Specifies the type of tool (e.g., 'function'). 6884 */ 6885 type: string; 6886 /** 6887 * Details of the function tool. 6888 */ 6889 function: { 6890 /** 6891 * The name of the function. 6892 */ 6893 name: string; 6894 /** 6895 * A brief description of what the function does. 6896 */ 6897 description: string; 6898 /** 6899 * Schema defining the parameters accepted by the function. 6900 */ 6901 parameters: { 6902 /** 6903 * The type of the parameters object (usually 'object'). 6904 */ 6905 type: string; 6906 /** 6907 * List of required parameter names. 6908 */ 6909 required?: string[]; 6910 /** 6911 * Definitions of each parameter. 6912 */ 6913 properties: { 6914 [k: string]: { 6915 /** 6916 * The data type of the parameter. 6917 */ 6918 type: string; 6919 /** 6920 * A description of the expected parameter. 6921 */ 6922 description: string; 6923 }; 6924 }; 6925 }; 6926 }; 6927 })[]; 6928 /** 6929 * JSON schema that should be fufilled for the response. 6930 */ 6931 guided_json?: object; 6932 /** 6933 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6934 */ 6935 raw?: boolean; 6936 /** 6937 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6938 */ 6939 stream?: boolean; 6940 /** 6941 * The maximum number of tokens to generate in the response. 6942 */ 6943 max_tokens?: number; 6944 /** 6945 * Controls the randomness of the output; higher values produce more random results. 6946 */ 6947 temperature?: number; 6948 /** 6949 * 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. 6950 */ 6951 top_p?: number; 6952 /** 6953 * 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. 6954 */ 6955 top_k?: number; 6956 /** 6957 * Random seed for reproducibility of the generation. 6958 */ 6959 seed?: number; 6960 /** 6961 * Penalty for repeated tokens; higher values discourage repetition. 6962 */ 6963 repetition_penalty?: number; 6964 /** 6965 * Decreases the likelihood of the model repeating the same lines verbatim. 6966 */ 6967 frequency_penalty?: number; 6968 /** 6969 * Increases the likelihood of the model introducing new topics. 6970 */ 6971 presence_penalty?: number; 6972} 6973type Ai_Cf_Google_Gemma_3_12B_It_Output = { 6974 /** 6975 * The generated text response from the model 6976 */ 6977 response: string; 6978 /** 6979 * Usage statistics for the inference request 6980 */ 6981 usage?: { 6982 /** 6983 * Total number of tokens in input 6984 */ 6985 prompt_tokens?: number; 6986 /** 6987 * Total number of tokens in output 6988 */ 6989 completion_tokens?: number; 6990 /** 6991 * Total number of input and output tokens 6992 */ 6993 total_tokens?: number; 6994 }; 6995 /** 6996 * An array of tool calls requests made during the response generation 6997 */ 6998 tool_calls?: { 6999 /** 7000 * The arguments passed to be passed to the tool call request 7001 */ 7002 arguments?: object; 7003 /** 7004 * The name of the tool to be called 7005 */ 7006 name?: string; 7007 }[]; 7008}; 7009declare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It { 7010 inputs: Ai_Cf_Google_Gemma_3_12B_It_Input; 7011 postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output; 7012} 7013type 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; 7014interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt { 7015 /** 7016 * The input text prompt for the model to generate a response. 7017 */ 7018 prompt: string; 7019 /** 7020 * JSON schema that should be fulfilled for the response. 7021 */ 7022 guided_json?: object; 7023 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; 7024 /** 7025 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7026 */ 7027 raw?: boolean; 7028 /** 7029 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7030 */ 7031 stream?: boolean; 7032 /** 7033 * The maximum number of tokens to generate in the response. 7034 */ 7035 max_tokens?: number; 7036 /** 7037 * Controls the randomness of the output; higher values produce more random results. 7038 */ 7039 temperature?: number; 7040 /** 7041 * 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. 7042 */ 7043 top_p?: number; 7044 /** 7045 * 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. 7046 */ 7047 top_k?: number; 7048 /** 7049 * Random seed for reproducibility of the generation. 7050 */ 7051 seed?: number; 7052 /** 7053 * Penalty for repeated tokens; higher values discourage repetition. 7054 */ 7055 repetition_penalty?: number; 7056 /** 7057 * Decreases the likelihood of the model repeating the same lines verbatim. 7058 */ 7059 frequency_penalty?: number; 7060 /** 7061 * Increases the likelihood of the model introducing new topics. 7062 */ 7063 presence_penalty?: number; 7064} 7065interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode { 7066 type?: "json_object" | "json_schema"; 7067 json_schema?: unknown; 7068} 7069interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages { 7070 /** 7071 * An array of message objects representing the conversation history. 7072 */ 7073 messages: { 7074 /** 7075 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 7076 */ 7077 role?: string; 7078 /** 7079 * The tool call id. If you don't know what to put here you can fall back to 000000001 7080 */ 7081 tool_call_id?: string; 7082 content?: string | { 7083 /** 7084 * Type of the content provided 7085 */ 7086 type?: string; 7087 text?: string; 7088 image_url?: { 7089 /** 7090 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 7091 */ 7092 url?: string; 7093 }; 7094 }[] | { 7095 /** 7096 * Type of the content provided 7097 */ 7098 type?: string; 7099 text?: string; 7100 image_url?: { 7101 /** 7102 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 7103 */ 7104 url?: string; 7105 }; 7106 }; 7107 }[]; 7108 functions?: { 7109 name: string; 7110 code: string; 7111 }[]; 7112 /** 7113 * A list of tools available for the assistant to use. 7114 */ 7115 tools?: ({ 7116 /** 7117 * The name of the tool. More descriptive the better. 7118 */ 7119 name: string; 7120 /** 7121 * A brief description of what the tool does. 7122 */ 7123 description: string; 7124 /** 7125 * Schema defining the parameters accepted by the tool. 7126 */ 7127 parameters: { 7128 /** 7129 * The type of the parameters object (usually 'object'). 7130 */ 7131 type: string; 7132 /** 7133 * List of required parameter names. 7134 */ 7135 required?: string[]; 7136 /** 7137 * Definitions of each parameter. 7138 */ 7139 properties: { 7140 [k: string]: { 7141 /** 7142 * The data type of the parameter. 7143 */ 7144 type: string; 7145 /** 7146 * A description of the expected parameter. 7147 */ 7148 description: string; 7149 }; 7150 }; 7151 }; 7152 } | { 7153 /** 7154 * Specifies the type of tool (e.g., 'function'). 7155 */ 7156 type: string; 7157 /** 7158 * Details of the function tool. 7159 */ 7160 function: { 7161 /** 7162 * The name of the function. 7163 */ 7164 name: string; 7165 /** 7166 * A brief description of what the function does. 7167 */ 7168 description: string; 7169 /** 7170 * Schema defining the parameters accepted by the function. 7171 */ 7172 parameters: { 7173 /** 7174 * The type of the parameters object (usually 'object'). 7175 */ 7176 type: string; 7177 /** 7178 * List of required parameter names. 7179 */ 7180 required?: string[]; 7181 /** 7182 * Definitions of each parameter. 7183 */ 7184 properties: { 7185 [k: string]: { 7186 /** 7187 * The data type of the parameter. 7188 */ 7189 type: string; 7190 /** 7191 * A description of the expected parameter. 7192 */ 7193 description: string; 7194 }; 7195 }; 7196 }; 7197 }; 7198 })[]; 7199 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; 7200 /** 7201 * JSON schema that should be fufilled for the response. 7202 */ 7203 guided_json?: object; 7204 /** 7205 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7206 */ 7207 raw?: boolean; 7208 /** 7209 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7210 */ 7211 stream?: boolean; 7212 /** 7213 * The maximum number of tokens to generate in the response. 7214 */ 7215 max_tokens?: number; 7216 /** 7217 * Controls the randomness of the output; higher values produce more random results. 7218 */ 7219 temperature?: number; 7220 /** 7221 * 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. 7222 */ 7223 top_p?: number; 7224 /** 7225 * 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. 7226 */ 7227 top_k?: number; 7228 /** 7229 * Random seed for reproducibility of the generation. 7230 */ 7231 seed?: number; 7232 /** 7233 * Penalty for repeated tokens; higher values discourage repetition. 7234 */ 7235 repetition_penalty?: number; 7236 /** 7237 * Decreases the likelihood of the model repeating the same lines verbatim. 7238 */ 7239 frequency_penalty?: number; 7240 /** 7241 * Increases the likelihood of the model introducing new topics. 7242 */ 7243 presence_penalty?: number; 7244} 7245interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch { 7246 requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[]; 7247} 7248interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner { 7249 /** 7250 * The input text prompt for the model to generate a response. 7251 */ 7252 prompt: string; 7253 /** 7254 * JSON schema that should be fulfilled for the response. 7255 */ 7256 guided_json?: object; 7257 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; 7258 /** 7259 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7260 */ 7261 raw?: boolean; 7262 /** 7263 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7264 */ 7265 stream?: boolean; 7266 /** 7267 * The maximum number of tokens to generate in the response. 7268 */ 7269 max_tokens?: number; 7270 /** 7271 * Controls the randomness of the output; higher values produce more random results. 7272 */ 7273 temperature?: number; 7274 /** 7275 * 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. 7276 */ 7277 top_p?: number; 7278 /** 7279 * 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. 7280 */ 7281 top_k?: number; 7282 /** 7283 * Random seed for reproducibility of the generation. 7284 */ 7285 seed?: number; 7286 /** 7287 * Penalty for repeated tokens; higher values discourage repetition. 7288 */ 7289 repetition_penalty?: number; 7290 /** 7291 * Decreases the likelihood of the model repeating the same lines verbatim. 7292 */ 7293 frequency_penalty?: number; 7294 /** 7295 * Increases the likelihood of the model introducing new topics. 7296 */ 7297 presence_penalty?: number; 7298} 7299interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner { 7300 /** 7301 * An array of message objects representing the conversation history. 7302 */ 7303 messages: { 7304 /** 7305 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 7306 */ 7307 role?: string; 7308 /** 7309 * The tool call id. If you don't know what to put here you can fall back to 000000001 7310 */ 7311 tool_call_id?: string; 7312 content?: string | { 7313 /** 7314 * Type of the content provided 7315 */ 7316 type?: string; 7317 text?: string; 7318 image_url?: { 7319 /** 7320 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 7321 */ 7322 url?: string; 7323 }; 7324 }[] | { 7325 /** 7326 * Type of the content provided 7327 */ 7328 type?: string; 7329 text?: string; 7330 image_url?: { 7331 /** 7332 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 7333 */ 7334 url?: string; 7335 }; 7336 }; 7337 }[]; 7338 functions?: { 7339 name: string; 7340 code: string; 7341 }[]; 7342 /** 7343 * A list of tools available for the assistant to use. 7344 */ 7345 tools?: ({ 7346 /** 7347 * The name of the tool. More descriptive the better. 7348 */ 7349 name: string; 7350 /** 7351 * A brief description of what the tool does. 7352 */ 7353 description: string; 7354 /** 7355 * Schema defining the parameters accepted by the tool. 7356 */ 7357 parameters: { 7358 /** 7359 * The type of the parameters object (usually 'object'). 7360 */ 7361 type: string; 7362 /** 7363 * List of required parameter names. 7364 */ 7365 required?: string[]; 7366 /** 7367 * Definitions of each parameter. 7368 */ 7369 properties: { 7370 [k: string]: { 7371 /** 7372 * The data type of the parameter. 7373 */ 7374 type: string; 7375 /** 7376 * A description of the expected parameter. 7377 */ 7378 description: string; 7379 }; 7380 }; 7381 }; 7382 } | { 7383 /** 7384 * Specifies the type of tool (e.g., 'function'). 7385 */ 7386 type: string; 7387 /** 7388 * Details of the function tool. 7389 */ 7390 function: { 7391 /** 7392 * The name of the function. 7393 */ 7394 name: string; 7395 /** 7396 * A brief description of what the function does. 7397 */ 7398 description: string; 7399 /** 7400 * Schema defining the parameters accepted by the function. 7401 */ 7402 parameters: { 7403 /** 7404 * The type of the parameters object (usually 'object'). 7405 */ 7406 type: string; 7407 /** 7408 * List of required parameter names. 7409 */ 7410 required?: string[]; 7411 /** 7412 * Definitions of each parameter. 7413 */ 7414 properties: { 7415 [k: string]: { 7416 /** 7417 * The data type of the parameter. 7418 */ 7419 type: string; 7420 /** 7421 * A description of the expected parameter. 7422 */ 7423 description: string; 7424 }; 7425 }; 7426 }; 7427 }; 7428 })[]; 7429 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; 7430 /** 7431 * JSON schema that should be fufilled for the response. 7432 */ 7433 guided_json?: object; 7434 /** 7435 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7436 */ 7437 raw?: boolean; 7438 /** 7439 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7440 */ 7441 stream?: boolean; 7442 /** 7443 * The maximum number of tokens to generate in the response. 7444 */ 7445 max_tokens?: number; 7446 /** 7447 * Controls the randomness of the output; higher values produce more random results. 7448 */ 7449 temperature?: number; 7450 /** 7451 * 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. 7452 */ 7453 top_p?: number; 7454 /** 7455 * 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. 7456 */ 7457 top_k?: number; 7458 /** 7459 * Random seed for reproducibility of the generation. 7460 */ 7461 seed?: number; 7462 /** 7463 * Penalty for repeated tokens; higher values discourage repetition. 7464 */ 7465 repetition_penalty?: number; 7466 /** 7467 * Decreases the likelihood of the model repeating the same lines verbatim. 7468 */ 7469 frequency_penalty?: number; 7470 /** 7471 * Increases the likelihood of the model introducing new topics. 7472 */ 7473 presence_penalty?: number; 7474} 7475type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = { 7476 /** 7477 * The generated text response from the model 7478 */ 7479 response: string; 7480 /** 7481 * Usage statistics for the inference request 7482 */ 7483 usage?: { 7484 /** 7485 * Total number of tokens in input 7486 */ 7487 prompt_tokens?: number; 7488 /** 7489 * Total number of tokens in output 7490 */ 7491 completion_tokens?: number; 7492 /** 7493 * Total number of input and output tokens 7494 */ 7495 total_tokens?: number; 7496 }; 7497 /** 7498 * An array of tool calls requests made during the response generation 7499 */ 7500 tool_calls?: { 7501 /** 7502 * The tool call id. 7503 */ 7504 id?: string; 7505 /** 7506 * Specifies the type of tool (e.g., 'function'). 7507 */ 7508 type?: string; 7509 /** 7510 * Details of the function tool. 7511 */ 7512 function?: { 7513 /** 7514 * The name of the tool to be called 7515 */ 7516 name?: string; 7517 /** 7518 * The arguments passed to be passed to the tool call request 7519 */ 7520 arguments?: object; 7521 }; 7522 }[]; 7523}; 7524declare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct { 7525 inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input; 7526 postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output; 7527} 7528type 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; 7529interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt { 7530 /** 7531 * The input text prompt for the model to generate a response. 7532 */ 7533 prompt: string; 7534 /** 7535 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 7536 */ 7537 lora?: string; 7538 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode; 7539 /** 7540 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7541 */ 7542 raw?: boolean; 7543 /** 7544 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7545 */ 7546 stream?: boolean; 7547 /** 7548 * The maximum number of tokens to generate in the response. 7549 */ 7550 max_tokens?: number; 7551 /** 7552 * Controls the randomness of the output; higher values produce more random results. 7553 */ 7554 temperature?: number; 7555 /** 7556 * 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. 7557 */ 7558 top_p?: number; 7559 /** 7560 * 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. 7561 */ 7562 top_k?: number; 7563 /** 7564 * Random seed for reproducibility of the generation. 7565 */ 7566 seed?: number; 7567 /** 7568 * Penalty for repeated tokens; higher values discourage repetition. 7569 */ 7570 repetition_penalty?: number; 7571 /** 7572 * Decreases the likelihood of the model repeating the same lines verbatim. 7573 */ 7574 frequency_penalty?: number; 7575 /** 7576 * Increases the likelihood of the model introducing new topics. 7577 */ 7578 presence_penalty?: number; 7579} 7580interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode { 7581 type?: "json_object" | "json_schema"; 7582 json_schema?: unknown; 7583} 7584interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages { 7585 /** 7586 * An array of message objects representing the conversation history. 7587 */ 7588 messages: { 7589 /** 7590 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 7591 */ 7592 role: string; 7593 content: string | { 7594 /** 7595 * Type of the content (text) 7596 */ 7597 type?: string; 7598 /** 7599 * Text content 7600 */ 7601 text?: string; 7602 }[]; 7603 }[]; 7604 functions?: { 7605 name: string; 7606 code: string; 7607 }[]; 7608 /** 7609 * A list of tools available for the assistant to use. 7610 */ 7611 tools?: ({ 7612 /** 7613 * The name of the tool. More descriptive the better. 7614 */ 7615 name: string; 7616 /** 7617 * A brief description of what the tool does. 7618 */ 7619 description: string; 7620 /** 7621 * Schema defining the parameters accepted by the tool. 7622 */ 7623 parameters: { 7624 /** 7625 * The type of the parameters object (usually 'object'). 7626 */ 7627 type: string; 7628 /** 7629 * List of required parameter names. 7630 */ 7631 required?: string[]; 7632 /** 7633 * Definitions of each parameter. 7634 */ 7635 properties: { 7636 [k: string]: { 7637 /** 7638 * The data type of the parameter. 7639 */ 7640 type: string; 7641 /** 7642 * A description of the expected parameter. 7643 */ 7644 description: string; 7645 }; 7646 }; 7647 }; 7648 } | { 7649 /** 7650 * Specifies the type of tool (e.g., 'function'). 7651 */ 7652 type: string; 7653 /** 7654 * Details of the function tool. 7655 */ 7656 function: { 7657 /** 7658 * The name of the function. 7659 */ 7660 name: string; 7661 /** 7662 * A brief description of what the function does. 7663 */ 7664 description: string; 7665 /** 7666 * Schema defining the parameters accepted by the function. 7667 */ 7668 parameters: { 7669 /** 7670 * The type of the parameters object (usually 'object'). 7671 */ 7672 type: string; 7673 /** 7674 * List of required parameter names. 7675 */ 7676 required?: string[]; 7677 /** 7678 * Definitions of each parameter. 7679 */ 7680 properties: { 7681 [k: string]: { 7682 /** 7683 * The data type of the parameter. 7684 */ 7685 type: string; 7686 /** 7687 * A description of the expected parameter. 7688 */ 7689 description: string; 7690 }; 7691 }; 7692 }; 7693 }; 7694 })[]; 7695 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1; 7696 /** 7697 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7698 */ 7699 raw?: boolean; 7700 /** 7701 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7702 */ 7703 stream?: boolean; 7704 /** 7705 * The maximum number of tokens to generate in the response. 7706 */ 7707 max_tokens?: number; 7708 /** 7709 * Controls the randomness of the output; higher values produce more random results. 7710 */ 7711 temperature?: number; 7712 /** 7713 * 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. 7714 */ 7715 top_p?: number; 7716 /** 7717 * 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. 7718 */ 7719 top_k?: number; 7720 /** 7721 * Random seed for reproducibility of the generation. 7722 */ 7723 seed?: number; 7724 /** 7725 * Penalty for repeated tokens; higher values discourage repetition. 7726 */ 7727 repetition_penalty?: number; 7728 /** 7729 * Decreases the likelihood of the model repeating the same lines verbatim. 7730 */ 7731 frequency_penalty?: number; 7732 /** 7733 * Increases the likelihood of the model introducing new topics. 7734 */ 7735 presence_penalty?: number; 7736} 7737interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 { 7738 type?: "json_object" | "json_schema"; 7739 json_schema?: unknown; 7740} 7741interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch { 7742 requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[]; 7743} 7744interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 { 7745 /** 7746 * The input text prompt for the model to generate a response. 7747 */ 7748 prompt: string; 7749 /** 7750 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 7751 */ 7752 lora?: string; 7753 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2; 7754 /** 7755 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7756 */ 7757 raw?: boolean; 7758 /** 7759 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7760 */ 7761 stream?: boolean; 7762 /** 7763 * The maximum number of tokens to generate in the response. 7764 */ 7765 max_tokens?: number; 7766 /** 7767 * Controls the randomness of the output; higher values produce more random results. 7768 */ 7769 temperature?: number; 7770 /** 7771 * 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. 7772 */ 7773 top_p?: number; 7774 /** 7775 * 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. 7776 */ 7777 top_k?: number; 7778 /** 7779 * Random seed for reproducibility of the generation. 7780 */ 7781 seed?: number; 7782 /** 7783 * Penalty for repeated tokens; higher values discourage repetition. 7784 */ 7785 repetition_penalty?: number; 7786 /** 7787 * Decreases the likelihood of the model repeating the same lines verbatim. 7788 */ 7789 frequency_penalty?: number; 7790 /** 7791 * Increases the likelihood of the model introducing new topics. 7792 */ 7793 presence_penalty?: number; 7794} 7795interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 { 7796 type?: "json_object" | "json_schema"; 7797 json_schema?: unknown; 7798} 7799interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 { 7800 /** 7801 * An array of message objects representing the conversation history. 7802 */ 7803 messages: { 7804 /** 7805 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 7806 */ 7807 role: string; 7808 content: string | { 7809 /** 7810 * Type of the content (text) 7811 */ 7812 type?: string; 7813 /** 7814 * Text content 7815 */ 7816 text?: string; 7817 }[]; 7818 }[]; 7819 functions?: { 7820 name: string; 7821 code: string; 7822 }[]; 7823 /** 7824 * A list of tools available for the assistant to use. 7825 */ 7826 tools?: ({ 7827 /** 7828 * The name of the tool. More descriptive the better. 7829 */ 7830 name: string; 7831 /** 7832 * A brief description of what the tool does. 7833 */ 7834 description: string; 7835 /** 7836 * Schema defining the parameters accepted by the tool. 7837 */ 7838 parameters: { 7839 /** 7840 * The type of the parameters object (usually 'object'). 7841 */ 7842 type: string; 7843 /** 7844 * List of required parameter names. 7845 */ 7846 required?: string[]; 7847 /** 7848 * Definitions of each parameter. 7849 */ 7850 properties: { 7851 [k: string]: { 7852 /** 7853 * The data type of the parameter. 7854 */ 7855 type: string; 7856 /** 7857 * A description of the expected parameter. 7858 */ 7859 description: string; 7860 }; 7861 }; 7862 }; 7863 } | { 7864 /** 7865 * Specifies the type of tool (e.g., 'function'). 7866 */ 7867 type: string; 7868 /** 7869 * Details of the function tool. 7870 */ 7871 function: { 7872 /** 7873 * The name of the function. 7874 */ 7875 name: string; 7876 /** 7877 * A brief description of what the function does. 7878 */ 7879 description: string; 7880 /** 7881 * Schema defining the parameters accepted by the function. 7882 */ 7883 parameters: { 7884 /** 7885 * The type of the parameters object (usually 'object'). 7886 */ 7887 type: string; 7888 /** 7889 * List of required parameter names. 7890 */ 7891 required?: string[]; 7892 /** 7893 * Definitions of each parameter. 7894 */ 7895 properties: { 7896 [k: string]: { 7897 /** 7898 * The data type of the parameter. 7899 */ 7900 type: string; 7901 /** 7902 * A description of the expected parameter. 7903 */ 7904 description: string; 7905 }; 7906 }; 7907 }; 7908 }; 7909 })[]; 7910 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3; 7911 /** 7912 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7913 */ 7914 raw?: boolean; 7915 /** 7916 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7917 */ 7918 stream?: boolean; 7919 /** 7920 * The maximum number of tokens to generate in the response. 7921 */ 7922 max_tokens?: number; 7923 /** 7924 * Controls the randomness of the output; higher values produce more random results. 7925 */ 7926 temperature?: number; 7927 /** 7928 * 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. 7929 */ 7930 top_p?: number; 7931 /** 7932 * 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. 7933 */ 7934 top_k?: number; 7935 /** 7936 * Random seed for reproducibility of the generation. 7937 */ 7938 seed?: number; 7939 /** 7940 * Penalty for repeated tokens; higher values discourage repetition. 7941 */ 7942 repetition_penalty?: number; 7943 /** 7944 * Decreases the likelihood of the model repeating the same lines verbatim. 7945 */ 7946 frequency_penalty?: number; 7947 /** 7948 * Increases the likelihood of the model introducing new topics. 7949 */ 7950 presence_penalty?: number; 7951} 7952interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 { 7953 type?: "json_object" | "json_schema"; 7954 json_schema?: unknown; 7955} 7956type 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; 7957interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response { 7958 /** 7959 * Unique identifier for the completion 7960 */ 7961 id?: string; 7962 /** 7963 * Object type identifier 7964 */ 7965 object?: "chat.completion"; 7966 /** 7967 * Unix timestamp of when the completion was created 7968 */ 7969 created?: number; 7970 /** 7971 * Model used for the completion 7972 */ 7973 model?: string; 7974 /** 7975 * List of completion choices 7976 */ 7977 choices?: { 7978 /** 7979 * Index of the choice in the list 7980 */ 7981 index?: number; 7982 /** 7983 * The message generated by the model 7984 */ 7985 message?: { 7986 /** 7987 * Role of the message author 7988 */ 7989 role: string; 7990 /** 7991 * The content of the message 7992 */ 7993 content: string; 7994 /** 7995 * Internal reasoning content (if available) 7996 */ 7997 reasoning_content?: string; 7998 /** 7999 * Tool calls made by the assistant 8000 */ 8001 tool_calls?: { 8002 /** 8003 * Unique identifier for the tool call 8004 */ 8005 id: string; 8006 /** 8007 * Type of tool call 8008 */ 8009 type: "function"; 8010 function: { 8011 /** 8012 * Name of the function to call 8013 */ 8014 name: string; 8015 /** 8016 * JSON string of arguments for the function 8017 */ 8018 arguments: string; 8019 }; 8020 }[]; 8021 }; 8022 /** 8023 * Reason why the model stopped generating 8024 */ 8025 finish_reason?: string; 8026 /** 8027 * Stop reason (may be null) 8028 */ 8029 stop_reason?: string | null; 8030 /** 8031 * Log probabilities (if requested) 8032 */ 8033 logprobs?: {} | null; 8034 }[]; 8035 /** 8036 * Usage statistics for the inference request 8037 */ 8038 usage?: { 8039 /** 8040 * Total number of tokens in input 8041 */ 8042 prompt_tokens?: number; 8043 /** 8044 * Total number of tokens in output 8045 */ 8046 completion_tokens?: number; 8047 /** 8048 * Total number of input and output tokens 8049 */ 8050 total_tokens?: number; 8051 }; 8052 /** 8053 * Log probabilities for the prompt (if requested) 8054 */ 8055 prompt_logprobs?: {} | null; 8056} 8057interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response { 8058 /** 8059 * Unique identifier for the completion 8060 */ 8061 id?: string; 8062 /** 8063 * Object type identifier 8064 */ 8065 object?: "text_completion"; 8066 /** 8067 * Unix timestamp of when the completion was created 8068 */ 8069 created?: number; 8070 /** 8071 * Model used for the completion 8072 */ 8073 model?: string; 8074 /** 8075 * List of completion choices 8076 */ 8077 choices?: { 8078 /** 8079 * Index of the choice in the list 8080 */ 8081 index: number; 8082 /** 8083 * The generated text completion 8084 */ 8085 text: string; 8086 /** 8087 * Reason why the model stopped generating 8088 */ 8089 finish_reason: string; 8090 /** 8091 * Stop reason (may be null) 8092 */ 8093 stop_reason?: string | null; 8094 /** 8095 * Log probabilities (if requested) 8096 */ 8097 logprobs?: {} | null; 8098 /** 8099 * Log probabilities for the prompt (if requested) 8100 */ 8101 prompt_logprobs?: {} | null; 8102 }[]; 8103 /** 8104 * Usage statistics for the inference request 8105 */ 8106 usage?: { 8107 /** 8108 * Total number of tokens in input 8109 */ 8110 prompt_tokens?: number; 8111 /** 8112 * Total number of tokens in output 8113 */ 8114 completion_tokens?: number; 8115 /** 8116 * Total number of input and output tokens 8117 */ 8118 total_tokens?: number; 8119 }; 8120} 8121interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse { 8122 /** 8123 * The async request id that can be used to obtain the results. 8124 */ 8125 request_id?: string; 8126} 8127declare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 { 8128 inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input; 8129 postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output; 8130} 8131interface Ai_Cf_Deepgram_Nova_3_Input { 8132 audio: { 8133 body: object; 8134 contentType: string; 8135 }; 8136 /** 8137 * 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. 8138 */ 8139 custom_topic_mode?: "extended" | "strict"; 8140 /** 8141 * Custom topics you want the model to detect within your input audio or text if present Submit up to 100 8142 */ 8143 custom_topic?: string; 8144 /** 8145 * 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 param 8146 */ 8147 custom_intent_mode?: "extended" | "strict"; 8148 /** 8149 * Custom intents you want the model to detect within your input audio if present 8150 */ 8151 custom_intent?: string; 8152 /** 8153 * Identifies and extracts key entities from content in submitted audio 8154 */ 8155 detect_entities?: boolean; 8156 /** 8157 * Identifies the dominant language spoken in submitted audio 8158 */ 8159 detect_language?: boolean; 8160 /** 8161 * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0 8162 */ 8163 diarize?: boolean; 8164 /** 8165 * Identify and extract key entities from content in submitted audio 8166 */ 8167 dictation?: boolean; 8168 /** 8169 * Specify the expected encoding of your submitted audio 8170 */ 8171 encoding?: "linear16" | "flac" | "mulaw" | "amr-nb" | "amr-wb" | "opus" | "speex" | "g729"; 8172 /** 8173 * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing 8174 */ 8175 extra?: string; 8176 /** 8177 * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um' 8178 */ 8179 filler_words?: boolean; 8180 /** 8181 * Key term prompting can boost or suppress specialized terminology and brands. 8182 */ 8183 keyterm?: string; 8184 /** 8185 * Keywords can boost or suppress specialized terminology and brands. 8186 */ 8187 keywords?: string; 8188 /** 8189 * 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. 8190 */ 8191 language?: string; 8192 /** 8193 * Spoken measurements will be converted to their corresponding abbreviations. 8194 */ 8195 measurements?: boolean; 8196 /** 8197 * 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. 8198 */ 8199 mip_opt_out?: boolean; 8200 /** 8201 * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio 8202 */ 8203 mode?: "general" | "medical" | "finance"; 8204 /** 8205 * Transcribe each audio channel independently. 8206 */ 8207 multichannel?: boolean; 8208 /** 8209 * Numerals converts numbers from written format to numerical format. 8210 */ 8211 numerals?: boolean; 8212 /** 8213 * Splits audio into paragraphs to improve transcript readability. 8214 */ 8215 paragraphs?: boolean; 8216 /** 8217 * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely. 8218 */ 8219 profanity_filter?: boolean; 8220 /** 8221 * Add punctuation and capitalization to the transcript. 8222 */ 8223 punctuate?: boolean; 8224 /** 8225 * Redaction removes sensitive information from your transcripts. 8226 */ 8227 redact?: string; 8228 /** 8229 * Search for terms or phrases in submitted audio and replaces them. 8230 */ 8231 replace?: string; 8232 /** 8233 * Search for terms or phrases in submitted audio. 8234 */ 8235 search?: string; 8236 /** 8237 * Recognizes the sentiment throughout a transcript or text. 8238 */ 8239 sentiment?: boolean; 8240 /** 8241 * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability. 8242 */ 8243 smart_format?: boolean; 8244 /** 8245 * Detect topics throughout a transcript or text. 8246 */ 8247 topics?: boolean; 8248 /** 8249 * Segments speech into meaningful semantic units. 8250 */ 8251 utterances?: boolean; 8252 /** 8253 * Seconds to wait before detecting a pause between words in submitted audio. 8254 */ 8255 utt_split?: number; 8256 /** 8257 * The number of channels in the submitted audio 8258 */ 8259 channels?: number; 8260 /** 8261 * 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. 8262 */ 8263 interim_results?: boolean; 8264 /** 8265 * 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 endpointing 8266 */ 8267 endpointing?: string; 8268 /** 8269 * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets. 8270 */ 8271 vad_events?: boolean; 8272 /** 8273 * 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. 8274 */ 8275 utterance_end_ms?: boolean; 8276} 8277interface Ai_Cf_Deepgram_Nova_3_Output { 8278 results?: { 8279 channels?: { 8280 alternatives?: { 8281 confidence?: number; 8282 transcript?: string; 8283 words?: { 8284 confidence?: number; 8285 end?: number; 8286 start?: number; 8287 word?: string; 8288 }[]; 8289 }[]; 8290 }[]; 8291 summary?: { 8292 result?: string; 8293 short?: string; 8294 }; 8295 sentiments?: { 8296 segments?: { 8297 text?: string; 8298 start_word?: number; 8299 end_word?: number; 8300 sentiment?: string; 8301 sentiment_score?: number; 8302 }[]; 8303 average?: { 8304 sentiment?: string; 8305 sentiment_score?: number; 8306 }; 8307 }; 8308 }; 8309} 8310declare abstract class Base_Ai_Cf_Deepgram_Nova_3 { 8311 inputs: Ai_Cf_Deepgram_Nova_3_Input; 8312 postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output; 8313} 8314interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input { 8315 queries?: string | string[]; 8316 /** 8317 * Optional instruction for the task 8318 */ 8319 instruction?: string; 8320 documents?: string | string[]; 8321 text?: string | string[]; 8322} 8323interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output { 8324 data?: number[][]; 8325 shape?: number[]; 8326} 8327declare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B { 8328 inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input; 8329 postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output; 8330} 8331type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = { 8332 /** 8333 * readable stream with audio data and content-type specified for that data 8334 */ 8335 audio: { 8336 body: object; 8337 contentType: string; 8338 }; 8339 /** 8340 * type of data PCM data that's sent to the inference server as raw array 8341 */ 8342 dtype?: "uint8" | "float32" | "float64"; 8343} | { 8344 /** 8345 * base64 encoded audio data 8346 */ 8347 audio: string; 8348 /** 8349 * type of data PCM data that's sent to the inference server as raw array 8350 */ 8351 dtype?: "uint8" | "float32" | "float64"; 8352}; 8353interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output { 8354 /** 8355 * if true, end-of-turn was detected 8356 */ 8357 is_complete?: boolean; 8358 /** 8359 * probability of the end-of-turn detection 8360 */ 8361 probability?: number; 8362} 8363declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { 8364 inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; 8365 postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; 8366} 8367declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { 8368 inputs: XOR<ResponsesInput, ChatCompletionsInput>; 8369 postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>; 8370} 8371declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { 8372 inputs: XOR<ResponsesInput, ChatCompletionsInput>; 8373 postProcessedOutputs: XOR<ResponsesOutput, ChatCompletionsOutput>; 8374} 8375interface Ai_Cf_Leonardo_Phoenix_1_0_Input { 8376 /** 8377 * A text description of the image you want to generate. 8378 */ 8379 prompt: string; 8380 /** 8381 * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt 8382 */ 8383 guidance?: number; 8384 /** 8385 * Random seed for reproducibility of the image generation 8386 */ 8387 seed?: number; 8388 /** 8389 * The height of the generated image in pixels 8390 */ 8391 height?: number; 8392 /** 8393 * The width of the generated image in pixels 8394 */ 8395 width?: number; 8396 /** 8397 * The number of diffusion steps; higher values can improve quality but take longer 8398 */ 8399 num_steps?: number; 8400 /** 8401 * Specify what to exclude from the generated images 8402 */ 8403 negative_prompt?: string; 8404} 8405/** 8406 * The generated image in JPEG format 8407 */ 8408type Ai_Cf_Leonardo_Phoenix_1_0_Output = string; 8409declare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 { 8410 inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input; 8411 postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output; 8412} 8413interface Ai_Cf_Leonardo_Lucid_Origin_Input { 8414 /** 8415 * A text description of the image you want to generate. 8416 */ 8417 prompt: string; 8418 /** 8419 * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt 8420 */ 8421 guidance?: number; 8422 /** 8423 * Random seed for reproducibility of the image generation 8424 */ 8425 seed?: number; 8426 /** 8427 * The height of the generated image in pixels 8428 */ 8429 height?: number; 8430 /** 8431 * The width of the generated image in pixels 8432 */ 8433 width?: number; 8434 /** 8435 * The number of diffusion steps; higher values can improve quality but take longer 8436 */ 8437 num_steps?: number; 8438 /** 8439 * The number of diffusion steps; higher values can improve quality but take longer 8440 */ 8441 steps?: number; 8442} 8443interface Ai_Cf_Leonardo_Lucid_Origin_Output { 8444 /** 8445 * The generated image in Base64 format. 8446 */ 8447 image?: string; 8448} 8449declare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin { 8450 inputs: Ai_Cf_Leonardo_Lucid_Origin_Input; 8451 postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output; 8452} 8453interface Ai_Cf_Deepgram_Aura_1_Input { 8454 /** 8455 * Speaker used to produce the audio. 8456 */ 8457 speaker?: "angus" | "asteria" | "arcas" | "orion" | "orpheus" | "athena" | "luna" | "zeus" | "perseus" | "helios" | "hera" | "stella"; 8458 /** 8459 * Encoding of the output audio. 8460 */ 8461 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac"; 8462 /** 8463 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.. 8464 */ 8465 container?: "none" | "wav" | "ogg"; 8466 /** 8467 * The text content to be converted to speech 8468 */ 8469 text: string; 8470 /** 8471 * 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 configurable 8472 */ 8473 sample_rate?: number; 8474 /** 8475 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. 8476 */ 8477 bit_rate?: number; 8478} 8479/** 8480 * The generated audio in MP3 format 8481 */ 8482type Ai_Cf_Deepgram_Aura_1_Output = string; 8483declare abstract class Base_Ai_Cf_Deepgram_Aura_1 { 8484 inputs: Ai_Cf_Deepgram_Aura_1_Input; 8485 postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output; 8486} 8487interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input { 8488 /** 8489 * Input text to translate. Can be a single string or a list of strings. 8490 */ 8491 text: string | string[]; 8492 /** 8493 * Target langauge to translate to 8494 */ 8495 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"; 8496} 8497interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output { 8498 /** 8499 * Translated texts 8500 */ 8501 translations: string[]; 8502} 8503declare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B { 8504 inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input; 8505 postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output; 8506} 8507type 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; 8508interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt { 8509 /** 8510 * The input text prompt for the model to generate a response. 8511 */ 8512 prompt: string; 8513 /** 8514 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 8515 */ 8516 lora?: string; 8517 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode; 8518 /** 8519 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 8520 */ 8521 raw?: boolean; 8522 /** 8523 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 8524 */ 8525 stream?: boolean; 8526 /** 8527 * The maximum number of tokens to generate in the response. 8528 */ 8529 max_tokens?: number; 8530 /** 8531 * Controls the randomness of the output; higher values produce more random results. 8532 */ 8533 temperature?: number; 8534 /** 8535 * 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. 8536 */ 8537 top_p?: number; 8538 /** 8539 * 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. 8540 */ 8541 top_k?: number; 8542 /** 8543 * Random seed for reproducibility of the generation. 8544 */ 8545 seed?: number; 8546 /** 8547 * Penalty for repeated tokens; higher values discourage repetition. 8548 */ 8549 repetition_penalty?: number; 8550 /** 8551 * Decreases the likelihood of the model repeating the same lines verbatim. 8552 */ 8553 frequency_penalty?: number; 8554 /** 8555 * Increases the likelihood of the model introducing new topics. 8556 */ 8557 presence_penalty?: number; 8558} 8559interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode { 8560 type?: "json_object" | "json_schema"; 8561 json_schema?: unknown; 8562} 8563interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages { 8564 /** 8565 * An array of message objects representing the conversation history. 8566 */ 8567 messages: { 8568 /** 8569 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 8570 */ 8571 role: string; 8572 content: string | { 8573 /** 8574 * Type of the content (text) 8575 */ 8576 type?: string; 8577 /** 8578 * Text content 8579 */ 8580 text?: string; 8581 }[]; 8582 }[]; 8583 functions?: { 8584 name: string; 8585 code: string; 8586 }[]; 8587 /** 8588 * A list of tools available for the assistant to use. 8589 */ 8590 tools?: ({ 8591 /** 8592 * The name of the tool. More descriptive the better. 8593 */ 8594 name: string; 8595 /** 8596 * A brief description of what the tool does. 8597 */ 8598 description: string; 8599 /** 8600 * Schema defining the parameters accepted by the tool. 8601 */ 8602 parameters: { 8603 /** 8604 * The type of the parameters object (usually 'object'). 8605 */ 8606 type: string; 8607 /** 8608 * List of required parameter names. 8609 */ 8610 required?: string[]; 8611 /** 8612 * Definitions of each parameter. 8613 */ 8614 properties: { 8615 [k: string]: { 8616 /** 8617 * The data type of the parameter. 8618 */ 8619 type: string; 8620 /** 8621 * A description of the expected parameter. 8622 */ 8623 description: string; 8624 }; 8625 }; 8626 }; 8627 } | { 8628 /** 8629 * Specifies the type of tool (e.g., 'function'). 8630 */ 8631 type: string; 8632 /** 8633 * Details of the function tool. 8634 */ 8635 function: { 8636 /** 8637 * The name of the function. 8638 */ 8639 name: string; 8640 /** 8641 * A brief description of what the function does. 8642 */ 8643 description: string; 8644 /** 8645 * Schema defining the parameters accepted by the function. 8646 */ 8647 parameters: { 8648 /** 8649 * The type of the parameters object (usually 'object'). 8650 */ 8651 type: string; 8652 /** 8653 * List of required parameter names. 8654 */ 8655 required?: string[]; 8656 /** 8657 * Definitions of each parameter. 8658 */ 8659 properties: { 8660 [k: string]: { 8661 /** 8662 * The data type of the parameter. 8663 */ 8664 type: string; 8665 /** 8666 * A description of the expected parameter. 8667 */ 8668 description: string; 8669 }; 8670 }; 8671 }; 8672 }; 8673 })[]; 8674 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1; 8675 /** 8676 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 8677 */ 8678 raw?: boolean; 8679 /** 8680 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 8681 */ 8682 stream?: boolean; 8683 /** 8684 * The maximum number of tokens to generate in the response. 8685 */ 8686 max_tokens?: number; 8687 /** 8688 * Controls the randomness of the output; higher values produce more random results. 8689 */ 8690 temperature?: number; 8691 /** 8692 * 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. 8693 */ 8694 top_p?: number; 8695 /** 8696 * 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. 8697 */ 8698 top_k?: number; 8699 /** 8700 * Random seed for reproducibility of the generation. 8701 */ 8702 seed?: number; 8703 /** 8704 * Penalty for repeated tokens; higher values discourage repetition. 8705 */ 8706 repetition_penalty?: number; 8707 /** 8708 * Decreases the likelihood of the model repeating the same lines verbatim. 8709 */ 8710 frequency_penalty?: number; 8711 /** 8712 * Increases the likelihood of the model introducing new topics. 8713 */ 8714 presence_penalty?: number; 8715} 8716interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 { 8717 type?: "json_object" | "json_schema"; 8718 json_schema?: unknown; 8719} 8720interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch { 8721 requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[]; 8722} 8723interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 { 8724 /** 8725 * The input text prompt for the model to generate a response. 8726 */ 8727 prompt: string; 8728 /** 8729 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 8730 */ 8731 lora?: string; 8732 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2; 8733 /** 8734 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 8735 */ 8736 raw?: boolean; 8737 /** 8738 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 8739 */ 8740 stream?: boolean; 8741 /** 8742 * The maximum number of tokens to generate in the response. 8743 */ 8744 max_tokens?: number; 8745 /** 8746 * Controls the randomness of the output; higher values produce more random results. 8747 */ 8748 temperature?: number; 8749 /** 8750 * 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. 8751 */ 8752 top_p?: number; 8753 /** 8754 * 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. 8755 */ 8756 top_k?: number; 8757 /** 8758 * Random seed for reproducibility of the generation. 8759 */ 8760 seed?: number; 8761 /** 8762 * Penalty for repeated tokens; higher values discourage repetition. 8763 */ 8764 repetition_penalty?: number; 8765 /** 8766 * Decreases the likelihood of the model repeating the same lines verbatim. 8767 */ 8768 frequency_penalty?: number; 8769 /** 8770 * Increases the likelihood of the model introducing new topics. 8771 */ 8772 presence_penalty?: number; 8773} 8774interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 { 8775 type?: "json_object" | "json_schema"; 8776 json_schema?: unknown; 8777} 8778interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 { 8779 /** 8780 * An array of message objects representing the conversation history. 8781 */ 8782 messages: { 8783 /** 8784 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 8785 */ 8786 role: string; 8787 content: string | { 8788 /** 8789 * Type of the content (text) 8790 */ 8791 type?: string; 8792 /** 8793 * Text content 8794 */ 8795 text?: string; 8796 }[]; 8797 }[]; 8798 functions?: { 8799 name: string; 8800 code: string; 8801 }[]; 8802 /** 8803 * A list of tools available for the assistant to use. 8804 */ 8805 tools?: ({ 8806 /** 8807 * The name of the tool. More descriptive the better. 8808 */ 8809 name: string; 8810 /** 8811 * A brief description of what the tool does. 8812 */ 8813 description: string; 8814 /** 8815 * Schema defining the parameters accepted by the tool. 8816 */ 8817 parameters: { 8818 /** 8819 * The type of the parameters object (usually 'object'). 8820 */ 8821 type: string; 8822 /** 8823 * List of required parameter names. 8824 */ 8825 required?: string[]; 8826 /** 8827 * Definitions of each parameter. 8828 */ 8829 properties: { 8830 [k: string]: { 8831 /** 8832 * The data type of the parameter. 8833 */ 8834 type: string; 8835 /** 8836 * A description of the expected parameter. 8837 */ 8838 description: string; 8839 }; 8840 }; 8841 }; 8842 } | { 8843 /** 8844 * Specifies the type of tool (e.g., 'function'). 8845 */ 8846 type: string; 8847 /** 8848 * Details of the function tool. 8849 */ 8850 function: { 8851 /** 8852 * The name of the function. 8853 */ 8854 name: string; 8855 /** 8856 * A brief description of what the function does. 8857 */ 8858 description: string; 8859 /** 8860 * Schema defining the parameters accepted by the function. 8861 */ 8862 parameters: { 8863 /** 8864 * The type of the parameters object (usually 'object'). 8865 */ 8866 type: string; 8867 /** 8868 * List of required parameter names. 8869 */ 8870 required?: string[]; 8871 /** 8872 * Definitions of each parameter. 8873 */ 8874 properties: { 8875 [k: string]: { 8876 /** 8877 * The data type of the parameter. 8878 */ 8879 type: string; 8880 /** 8881 * A description of the expected parameter. 8882 */ 8883 description: string; 8884 }; 8885 }; 8886 }; 8887 }; 8888 })[]; 8889 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3; 8890 /** 8891 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 8892 */ 8893 raw?: boolean; 8894 /** 8895 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 8896 */ 8897 stream?: boolean; 8898 /** 8899 * The maximum number of tokens to generate in the response. 8900 */ 8901 max_tokens?: number; 8902 /** 8903 * Controls the randomness of the output; higher values produce more random results. 8904 */ 8905 temperature?: number; 8906 /** 8907 * 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. 8908 */ 8909 top_p?: number; 8910 /** 8911 * 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. 8912 */ 8913 top_k?: number; 8914 /** 8915 * Random seed for reproducibility of the generation. 8916 */ 8917 seed?: number; 8918 /** 8919 * Penalty for repeated tokens; higher values discourage repetition. 8920 */ 8921 repetition_penalty?: number; 8922 /** 8923 * Decreases the likelihood of the model repeating the same lines verbatim. 8924 */ 8925 frequency_penalty?: number; 8926 /** 8927 * Increases the likelihood of the model introducing new topics. 8928 */ 8929 presence_penalty?: number; 8930} 8931interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 { 8932 type?: "json_object" | "json_schema"; 8933 json_schema?: unknown; 8934} 8935type 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; 8936interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response { 8937 /** 8938 * Unique identifier for the completion 8939 */ 8940 id?: string; 8941 /** 8942 * Object type identifier 8943 */ 8944 object?: "chat.completion"; 8945 /** 8946 * Unix timestamp of when the completion was created 8947 */ 8948 created?: number; 8949 /** 8950 * Model used for the completion 8951 */ 8952 model?: string; 8953 /** 8954 * List of completion choices 8955 */ 8956 choices?: { 8957 /** 8958 * Index of the choice in the list 8959 */ 8960 index?: number; 8961 /** 8962 * The message generated by the model 8963 */ 8964 message?: { 8965 /** 8966 * Role of the message author 8967 */ 8968 role: string; 8969 /** 8970 * The content of the message 8971 */ 8972 content: string; 8973 /** 8974 * Internal reasoning content (if available) 8975 */ 8976 reasoning_content?: string; 8977 /** 8978 * Tool calls made by the assistant 8979 */ 8980 tool_calls?: { 8981 /** 8982 * Unique identifier for the tool call 8983 */ 8984 id: string; 8985 /** 8986 * Type of tool call 8987 */ 8988 type: "function"; 8989 function: { 8990 /** 8991 * Name of the function to call 8992 */ 8993 name: string; 8994 /** 8995 * JSON string of arguments for the function 8996 */ 8997 arguments: string; 8998 }; 8999 }[]; 9000 }; 9001 /** 9002 * Reason why the model stopped generating 9003 */ 9004 finish_reason?: string; 9005 /** 9006 * Stop reason (may be null) 9007 */ 9008 stop_reason?: string | null; 9009 /** 9010 * Log probabilities (if requested) 9011 */ 9012 logprobs?: {} | null; 9013 }[]; 9014 /** 9015 * Usage statistics for the inference request 9016 */ 9017 usage?: { 9018 /** 9019 * Total number of tokens in input 9020 */ 9021 prompt_tokens?: number; 9022 /** 9023 * Total number of tokens in output 9024 */ 9025 completion_tokens?: number; 9026 /** 9027 * Total number of input and output tokens 9028 */ 9029 total_tokens?: number; 9030 }; 9031 /** 9032 * Log probabilities for the prompt (if requested) 9033 */ 9034 prompt_logprobs?: {} | null; 9035} 9036interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response { 9037 /** 9038 * Unique identifier for the completion 9039 */ 9040 id?: string; 9041 /** 9042 * Object type identifier 9043 */ 9044 object?: "text_completion"; 9045 /** 9046 * Unix timestamp of when the completion was created 9047 */ 9048 created?: number; 9049 /** 9050 * Model used for the completion 9051 */ 9052 model?: string; 9053 /** 9054 * List of completion choices 9055 */ 9056 choices?: { 9057 /** 9058 * Index of the choice in the list 9059 */ 9060 index: number; 9061 /** 9062 * The generated text completion 9063 */ 9064 text: string; 9065 /** 9066 * Reason why the model stopped generating 9067 */ 9068 finish_reason: string; 9069 /** 9070 * Stop reason (may be null) 9071 */ 9072 stop_reason?: string | null; 9073 /** 9074 * Log probabilities (if requested) 9075 */ 9076 logprobs?: {} | null; 9077 /** 9078 * Log probabilities for the prompt (if requested) 9079 */ 9080 prompt_logprobs?: {} | null; 9081 }[]; 9082 /** 9083 * Usage statistics for the inference request 9084 */ 9085 usage?: { 9086 /** 9087 * Total number of tokens in input 9088 */ 9089 prompt_tokens?: number; 9090 /** 9091 * Total number of tokens in output 9092 */ 9093 completion_tokens?: number; 9094 /** 9095 * Total number of input and output tokens 9096 */ 9097 total_tokens?: number; 9098 }; 9099} 9100interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse { 9101 /** 9102 * The async request id that can be used to obtain the results. 9103 */ 9104 request_id?: string; 9105} 9106declare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It { 9107 inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input; 9108 postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output; 9109} 9110interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input { 9111 /** 9112 * Input text to embed. Can be a single string or a list of strings. 9113 */ 9114 text: string | string[]; 9115} 9116interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output { 9117 /** 9118 * Embedding vectors, where each vector is a list of floats. 9119 */ 9120 data: number[][]; 9121 /** 9122 * Shape of the embedding data as [number_of_embeddings, embedding_dimension]. 9123 * 9124 * @minItems 2 9125 * @maxItems 2 9126 */ 9127 shape: [ 9128 number, 9129 number 9130 ]; 9131} 9132declare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B { 9133 inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input; 9134 postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output; 9135} 9136interface Ai_Cf_Deepgram_Flux_Input { 9137 /** 9138 * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM. 9139 */ 9140 encoding: "linear16"; 9141 /** 9142 * Sample rate of the audio stream in Hz. 9143 */ 9144 sample_rate: string; 9145 /** 9146 * 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. 9147 */ 9148 eager_eot_threshold?: string; 9149 /** 9150 * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9. 9151 */ 9152 eot_threshold?: string; 9153 /** 9154 * A turn will be finished when this much time has passed after speech, regardless of EOT confidence. 9155 */ 9156 eot_timeout_ms?: string; 9157 /** 9158 * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms. 9159 */ 9160 keyterm?: string; 9161 /** 9162 * 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-mip 9163 */ 9164 mip_opt_out?: "true" | "false"; 9165 /** 9166 * Label your requests for the purpose of identification during usage reporting 9167 */ 9168 tag?: string; 9169} 9170/** 9171 * Output will be returned as websocket messages. 9172 */ 9173interface Ai_Cf_Deepgram_Flux_Output { 9174 /** 9175 * The unique identifier of the request (uuid) 9176 */ 9177 request_id?: string; 9178 /** 9179 * Starts at 0 and increments for each message the server sends to the client. 9180 */ 9181 sequence_id?: number; 9182 /** 9183 * The type of event being reported. 9184 */ 9185 event?: "Update" | "StartOfTurn" | "EagerEndOfTurn" | "TurnResumed" | "EndOfTurn"; 9186 /** 9187 * The index of the current turn 9188 */ 9189 turn_index?: number; 9190 /** 9191 * Start time in seconds of the audio range that was transcribed 9192 */ 9193 audio_window_start?: number; 9194 /** 9195 * End time in seconds of the audio range that was transcribed 9196 */ 9197 audio_window_end?: number; 9198 /** 9199 * Text that was said over the course of the current turn 9200 */ 9201 transcript?: string; 9202 /** 9203 * The words in the transcript 9204 */ 9205 words?: { 9206 /** 9207 * The individual punctuated, properly-cased word from the transcript 9208 */ 9209 word: string; 9210 /** 9211 * Confidence that this word was transcribed correctly 9212 */ 9213 confidence: number; 9214 }[]; 9215 /** 9216 * Confidence that no more speech is coming in this turn 9217 */ 9218 end_of_turn_confidence?: number; 9219} 9220declare abstract class Base_Ai_Cf_Deepgram_Flux { 9221 inputs: Ai_Cf_Deepgram_Flux_Input; 9222 postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output; 9223} 9224interface Ai_Cf_Deepgram_Aura_2_En_Input { 9225 /** 9226 * Speaker used to produce the audio. 9227 */ 9228 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"; 9229 /** 9230 * Encoding of the output audio. 9231 */ 9232 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac"; 9233 /** 9234 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.. 9235 */ 9236 container?: "none" | "wav" | "ogg"; 9237 /** 9238 * The text content to be converted to speech 9239 */ 9240 text: string; 9241 /** 9242 * 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 configurable 9243 */ 9244 sample_rate?: number; 9245 /** 9246 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. 9247 */ 9248 bit_rate?: number; 9249} 9250/** 9251 * The generated audio in MP3 format 9252 */ 9253type Ai_Cf_Deepgram_Aura_2_En_Output = string; 9254declare abstract class Base_Ai_Cf_Deepgram_Aura_2_En { 9255 inputs: Ai_Cf_Deepgram_Aura_2_En_Input; 9256 postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output; 9257} 9258interface Ai_Cf_Deepgram_Aura_2_Es_Input { 9259 /** 9260 * Speaker used to produce the audio. 9261 */ 9262 speaker?: "sirio" | "nestor" | "carina" | "celeste" | "alvaro" | "diana" | "aquila" | "selena" | "estrella" | "javier"; 9263 /** 9264 * Encoding of the output audio. 9265 */ 9266 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac"; 9267 /** 9268 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.. 9269 */ 9270 container?: "none" | "wav" | "ogg"; 9271 /** 9272 * The text content to be converted to speech 9273 */ 9274 text: string; 9275 /** 9276 * 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 configurable 9277 */ 9278 sample_rate?: number; 9279 /** 9280 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. 9281 */ 9282 bit_rate?: number; 9283} 9284/** 9285 * The generated audio in MP3 format 9286 */ 9287type Ai_Cf_Deepgram_Aura_2_Es_Output = string; 9288declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es { 9289 inputs: Ai_Cf_Deepgram_Aura_2_Es_Input; 9290 postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output; 9291} 9292interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input { 9293 multipart: { 9294 body?: object; 9295 contentType?: string; 9296 }; 9297} 9298interface Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output { 9299 /** 9300 * Generated image as Base64 string. 9301 */ 9302 image?: string; 9303} 9304declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev { 9305 inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Input; 9306 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Dev_Output; 9307} 9308interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input { 9309 multipart: { 9310 body?: object; 9311 contentType?: string; 9312 }; 9313} 9314interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output { 9315 /** 9316 * Generated image as Base64 string. 9317 */ 9318 image?: string; 9319} 9320declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B { 9321 inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Input; 9322 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B_Output; 9323} 9324interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input { 9325 multipart: { 9326 body?: object; 9327 contentType?: string; 9328 }; 9329} 9330interface Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output { 9331 /** 9332 * Generated image as Base64 string. 9333 */ 9334 image?: string; 9335} 9336declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B { 9337 inputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Input; 9338 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B_Output; 9339} 9340declare abstract class Base_Ai_Cf_Zai_Org_Glm_4_7_Flash { 9341 inputs: ChatCompletionsInput; 9342 postProcessedOutputs: ChatCompletionsOutput; 9343} 9344declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_5 { 9345 inputs: ChatCompletionsInput; 9346 postProcessedOutputs: ChatCompletionsOutput; 9347} 9348declare abstract class Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B { 9349 inputs: ChatCompletionsInput; 9350 postProcessedOutputs: ChatCompletionsOutput; 9351} 9352interface AiModels { 9353 "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification; 9354 "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage; 9355 "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage; 9356 "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage; 9357 "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage; 9358 "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage; 9359 "@cf/myshell-ai/melotts": BaseAiTextToSpeech; 9360 "@cf/google/embeddinggemma-300m": BaseAiTextEmbeddings; 9361 "@cf/microsoft/resnet-50": BaseAiImageClassification; 9362 "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration; 9363 "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration; 9364 "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration; 9365 "@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration; 9366 "@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration; 9367 "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration; 9368 "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration; 9369 "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration; 9370 "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration; 9371 "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration; 9372 "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration; 9373 "@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration; 9374 "@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration; 9375 "@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration; 9376 "@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration; 9377 "@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration; 9378 "@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration; 9379 "@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration; 9380 "@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration; 9381 "@cf/microsoft/phi-2": BaseAiTextGeneration; 9382 "@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration; 9383 "@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration; 9384 "@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration; 9385 "@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration; 9386 "@hf/google/gemma-7b-it": BaseAiTextGeneration; 9387 "@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration; 9388 "@cf/google/gemma-2b-it-lora": BaseAiTextGeneration; 9389 "@cf/google/gemma-7b-it-lora": BaseAiTextGeneration; 9390 "@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration; 9391 "@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration; 9392 "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration; 9393 "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration; 9394 "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration; 9395 "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration; 9396 "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration; 9397 "@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration; 9398 "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b": BaseAiTextGeneration; 9399 "@cf/ibm-granite/granite-4.0-h-micro": BaseAiTextGeneration; 9400 "@cf/facebook/bart-large-cnn": BaseAiSummarization; 9401 "@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText; 9402 "@cf/baai/bge-base-en-v1.5": Base_Ai_Cf_Baai_Bge_Base_En_V1_5; 9403 "@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper; 9404 "@cf/meta/m2m100-1.2b": Base_Ai_Cf_Meta_M2M100_1_2B; 9405 "@cf/baai/bge-small-en-v1.5": Base_Ai_Cf_Baai_Bge_Small_En_V1_5; 9406 "@cf/baai/bge-large-en-v1.5": Base_Ai_Cf_Baai_Bge_Large_En_V1_5; 9407 "@cf/unum/uform-gen2-qwen-500m": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M; 9408 "@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En; 9409 "@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo; 9410 "@cf/baai/bge-m3": Base_Ai_Cf_Baai_Bge_M3; 9411 "@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell; 9412 "@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct; 9413 "@cf/meta/llama-3.3-70b-instruct-fp8-fast": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast; 9414 "@cf/meta/llama-guard-3-8b": Base_Ai_Cf_Meta_Llama_Guard_3_8B; 9415 "@cf/baai/bge-reranker-base": Base_Ai_Cf_Baai_Bge_Reranker_Base; 9416 "@cf/qwen/qwen2.5-coder-32b-instruct": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct; 9417 "@cf/qwen/qwq-32b": Base_Ai_Cf_Qwen_Qwq_32B; 9418 "@cf/mistralai/mistral-small-3.1-24b-instruct": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct; 9419 "@cf/google/gemma-3-12b-it": Base_Ai_Cf_Google_Gemma_3_12B_It; 9420 "@cf/meta/llama-4-scout-17b-16e-instruct": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct; 9421 "@cf/qwen/qwen3-30b-a3b-fp8": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8; 9422 "@cf/deepgram/nova-3": Base_Ai_Cf_Deepgram_Nova_3; 9423 "@cf/qwen/qwen3-embedding-0.6b": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B; 9424 "@cf/pipecat-ai/smart-turn-v2": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2; 9425 "@cf/openai/gpt-oss-120b": Base_Ai_Cf_Openai_Gpt_Oss_120B; 9426 "@cf/openai/gpt-oss-20b": Base_Ai_Cf_Openai_Gpt_Oss_20B; 9427 "@cf/leonardo/phoenix-1.0": Base_Ai_Cf_Leonardo_Phoenix_1_0; 9428 "@cf/leonardo/lucid-origin": Base_Ai_Cf_Leonardo_Lucid_Origin; 9429 "@cf/deepgram/aura-1": Base_Ai_Cf_Deepgram_Aura_1; 9430 "@cf/ai4bharat/indictrans2-en-indic-1B": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B; 9431 "@cf/aisingapore/gemma-sea-lion-v4-27b-it": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It; 9432 "@cf/pfnet/plamo-embedding-1b": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B; 9433 "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux; 9434 "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En; 9435 "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es; 9436 "@cf/black-forest-labs/flux-2-dev": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Dev; 9437 "@cf/black-forest-labs/flux-2-klein-4b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_4B; 9438 "@cf/black-forest-labs/flux-2-klein-9b": Base_Ai_Cf_Black_Forest_Labs_Flux_2_Klein_9B; 9439 "@cf/zai-org/glm-4.7-flash": Base_Ai_Cf_Zai_Org_Glm_4_7_Flash; 9440 "@cf/moonshotai/kimi-k2.5": Base_Ai_Cf_Moonshotai_Kimi_K2_5; 9441 "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; 9442} 9443type AiOptions = { 9444 /** 9445 * Send requests as an asynchronous batch job, only works for supported models 9446 * https://developers.cloudflare.com/workers-ai/features/batch-api 9447 */ 9448 queueRequest?: boolean; 9449 /** 9450 * Establish websocket connections, only works for supported models 9451 */ 9452 websocket?: boolean; 9453 /** 9454 * Tag your requests to group and view them in Cloudflare dashboard. 9455 * 9456 * Rules: 9457 * Tags must only contain letters, numbers, and the symbols: : - . / @ 9458 * Each tag can have maximum 50 characters. 9459 * Maximum 5 tags are allowed each request. 9460 * Duplicate tags will removed. 9461 */ 9462 tags?: string[]; 9463 gateway?: GatewayOptions; 9464 returnRawResponse?: boolean; 9465 prefix?: string; 9466 extraHeaders?: object; 9467 signal?: AbortSignal; 9468}; 9469type AiModelsSearchParams = { 9470 author?: string; 9471 hide_experimental?: boolean; 9472 page?: number; 9473 per_page?: number; 9474 search?: string; 9475 source?: number; 9476 task?: string; 9477}; 9478type AiModelsSearchObject = { 9479 id: string; 9480 source: number; 9481 name: string; 9482 description: string; 9483 task: { 9484 id: string; 9485 name: string; 9486 description: string; 9487 }; 9488 tags: string[]; 9489 properties: { 9490 property_id: string; 9491 value: string; 9492 }[]; 9493}; 9494type ChatCompletionsBase = XOR<ChatCompletionsPromptInput, ChatCompletionsMessagesInput>; 9495type ChatCompletionsInput = XOR<ChatCompletionsBase, { 9496 requests: ChatCompletionsBase[]; 9497}>; 9498interface InferenceUpstreamError extends Error { 9499} 9500interface AiInternalError extends Error { 9501} 9502type AiModelListType = Record<string, any>; 9503declare abstract class Ai<AiModelList extends AiModelListType = AiModels> { 9504 aiGatewayLogId: string | null; 9505 gateway(gatewayId: string): AiGateway; 9506 /** 9507 * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead. 9508 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9509 */ 9510 aiSearch(): AiSearchNamespace; 9511 /** 9512 * @deprecated AutoRAG has been replaced by AI Search. 9513 * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead. 9514 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9515 * 9516 * @param autoragId Instance ID 9517 */ 9518 autorag(autoragId: string): AutoRAG; 9519 run<Name extends keyof AiModelList, Options extends AiOptions, InputOptions extends AiModelList[Name]["inputs"]>(model: Name, inputs: InputOptions, options?: Options): Promise<Options extends { 9520 returnRawResponse: true; 9521 } | { 9522 websocket: true; 9523 } ? Response : InputOptions extends { 9524 stream: true; 9525 } ? ReadableStream : AiModelList[Name]["postProcessedOutputs"]>; 9526 models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>; 9527 toMarkdown(): ToMarkdownService; 9528 toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>; 9529 toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>; 9530} 9531type GatewayRetries = { 9532 maxAttempts?: 1 | 2 | 3 | 4 | 5; 9533 retryDelayMs?: number; 9534 backoff?: 'constant' | 'linear' | 'exponential'; 9535}; 9536type GatewayOptions = { 9537 id: string; 9538 cacheKey?: string; 9539 cacheTtl?: number; 9540 skipCache?: boolean; 9541 metadata?: Record<string, number | string | boolean | null | bigint>; 9542 collectLog?: boolean; 9543 eventId?: string; 9544 requestTimeoutMs?: number; 9545 retries?: GatewayRetries; 9546}; 9547type UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & { 9548 /** 9549 ** @deprecated 9550 */ 9551 id?: string; 9552}; 9553type AiGatewayPatchLog = { 9554 score?: number | null; 9555 feedback?: -1 | 1 | null; 9556 metadata?: Record<string, number | string | boolean | null | bigint> | null; 9557}; 9558type AiGatewayLog = { 9559 id: string; 9560 provider: string; 9561 model: string; 9562 model_type?: string; 9563 path: string; 9564 duration: number; 9565 request_type?: string; 9566 request_content_type?: string; 9567 status_code: number; 9568 response_content_type?: string; 9569 success: boolean; 9570 cached: boolean; 9571 tokens_in?: number; 9572 tokens_out?: number; 9573 metadata?: Record<string, number | string | boolean | null | bigint>; 9574 step?: number; 9575 cost?: number; 9576 custom_cost?: boolean; 9577 request_size: number; 9578 request_head?: string; 9579 request_head_complete: boolean; 9580 response_size: number; 9581 response_head?: string; 9582 response_head_complete: boolean; 9583 created_at: Date; 9584}; 9585type 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'; 9586type AIGatewayHeaders = { 9587 'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string; 9588 'cf-aig-custom-cost': { 9589 per_token_in?: number; 9590 per_token_out?: number; 9591 } | { 9592 total_cost?: number; 9593 } | string; 9594 'cf-aig-cache-ttl': number | string; 9595 'cf-aig-skip-cache': boolean | string; 9596 'cf-aig-cache-key': string; 9597 'cf-aig-event-id': string; 9598 'cf-aig-request-timeout': number | string; 9599 'cf-aig-max-attempts': number | string; 9600 'cf-aig-retry-delay': number | string; 9601 'cf-aig-backoff': string; 9602 'cf-aig-collect-log': boolean | string; 9603 Authorization: string; 9604 'Content-Type': string; 9605 [key: string]: string | number | boolean | object; 9606}; 9607type AIGatewayUniversalRequest = { 9608 provider: AIGatewayProviders | string; // eslint-disable-line 9609 endpoint: string; 9610 headers: Partial<AIGatewayHeaders>; 9611 query: unknown; 9612}; 9613interface AiGatewayInternalError extends Error { 9614} 9615interface AiGatewayLogNotFound extends Error { 9616} 9617declare abstract class AiGateway { 9618 patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>; 9619 getLog(logId: string): Promise<AiGatewayLog>; 9620 run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: { 9621 gateway?: UniversalGatewayOptions; 9622 extraHeaders?: object; 9623 }): Promise<Response>; 9624 getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line 9625} 9626/** 9627 * @deprecated Use the standalone AI Search Workers binding instead. 9628 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9629 */ 9630interface AutoRAGInternalError extends Error { 9631} 9632/** 9633 * @deprecated Use the standalone AI Search Workers binding instead. 9634 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9635 */ 9636interface AutoRAGNotFoundError extends Error { 9637} 9638/** 9639 * @deprecated Use the standalone AI Search Workers binding instead. 9640 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9641 */ 9642interface AutoRAGUnauthorizedError extends Error { 9643} 9644/** 9645 * @deprecated Use the standalone AI Search Workers binding instead. 9646 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9647 */ 9648interface AutoRAGNameNotSetError extends Error { 9649} 9650type ComparisonFilter = { 9651 key: string; 9652 type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte'; 9653 value: string | number | boolean; 9654}; 9655type CompoundFilter = { 9656 type: 'and' | 'or'; 9657 filters: ComparisonFilter[]; 9658}; 9659/** 9660 * @deprecated Use the standalone AI Search Workers binding instead. 9661 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9662 */ 9663type AutoRagSearchRequest = { 9664 query: string; 9665 filters?: CompoundFilter | ComparisonFilter; 9666 max_num_results?: number; 9667 ranking_options?: { 9668 ranker?: string; 9669 score_threshold?: number; 9670 }; 9671 reranking?: { 9672 enabled?: boolean; 9673 model?: string; 9674 }; 9675 rewrite_query?: boolean; 9676}; 9677/** 9678 * @deprecated Use the standalone AI Search Workers binding instead. 9679 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9680 */ 9681type AutoRagAiSearchRequest = AutoRagSearchRequest & { 9682 stream?: boolean; 9683 system_prompt?: string; 9684}; 9685/** 9686 * @deprecated Use the standalone AI Search Workers binding instead. 9687 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9688 */ 9689type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & { 9690 stream: true; 9691}; 9692/** 9693 * @deprecated Use the standalone AI Search Workers binding instead. 9694 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9695 */ 9696type AutoRagSearchResponse = { 9697 object: 'vector_store.search_results.page'; 9698 search_query: string; 9699 data: { 9700 file_id: string; 9701 filename: string; 9702 score: number; 9703 attributes: Record<string, string | number | boolean | null>; 9704 content: { 9705 type: 'text'; 9706 text: string; 9707 }[]; 9708 }[]; 9709 has_more: boolean; 9710 next_page: string | null; 9711}; 9712/** 9713 * @deprecated Use the standalone AI Search Workers binding instead. 9714 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9715 */ 9716type AutoRagListResponse = { 9717 id: string; 9718 enable: boolean; 9719 type: string; 9720 source: string; 9721 vectorize_name: string; 9722 paused: boolean; 9723 status: string; 9724}[]; 9725/** 9726 * @deprecated Use the standalone AI Search Workers binding instead. 9727 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9728 */ 9729type AutoRagAiSearchResponse = AutoRagSearchResponse & { 9730 response: string; 9731}; 9732/** 9733 * @deprecated Use the standalone AI Search Workers binding instead. 9734 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9735 */ 9736declare abstract class AutoRAG { 9737 /** 9738 * @deprecated Use the standalone AI Search Workers binding instead. 9739 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9740 */ 9741 list(): Promise<AutoRagListResponse>; 9742 /** 9743 * @deprecated Use the standalone AI Search Workers binding instead. 9744 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9745 */ 9746 search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>; 9747 /** 9748 * @deprecated Use the standalone AI Search Workers binding instead. 9749 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9750 */ 9751 aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>; 9752 /** 9753 * @deprecated Use the standalone AI Search Workers binding instead. 9754 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9755 */ 9756 aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>; 9757 /** 9758 * @deprecated Use the standalone AI Search Workers binding instead. 9759 * See https://developers.cloudflare.com/ai-search/usage/workers-binding/ 9760 */ 9761 aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>; 9762} 9763interface BasicImageTransformations { 9764 /** 9765 * Maximum width in image pixels. The value must be an integer. 9766 */ 9767 width?: number; 9768 /** 9769 * Maximum height in image pixels. The value must be an integer. 9770 */ 9771 height?: number; 9772 /** 9773 * Resizing mode as a string. It affects interpretation of width and height 9774 * options: 9775 * - scale-down: Similar to contain, but the image is never enlarged. If 9776 * the image is larger than given width or height, it will be resized. 9777 * Otherwise its original size will be kept. 9778 * - contain: Resizes to maximum size that fits within the given width and 9779 * height. If only a single dimension is given (e.g. only width), the 9780 * image will be shrunk or enlarged to exactly match that dimension. 9781 * Aspect ratio is always preserved. 9782 * - cover: Resizes (shrinks or enlarges) to fill the entire area of width 9783 * and height. If the image has an aspect ratio different from the ratio 9784 * of width and height, it will be cropped to fit. 9785 * - crop: The image will be shrunk and cropped to fit within the area 9786 * specified by width and height. The image will not be enlarged. For images 9787 * smaller than the given dimensions it's the same as scale-down. For 9788 * images larger than the given dimensions, it's the same as cover. 9789 * See also trim. 9790 * - pad: Resizes to the maximum size that fits within the given width and 9791 * height, and then fills the remaining area with a background color 9792 * (white by default). Use of this mode is not recommended, as the same 9793 * effect can be more efficiently achieved with the contain mode and the 9794 * CSS object-fit: contain property. 9795 * - squeeze: Stretches and deforms to the width and height given, even if it 9796 * breaks aspect ratio 9797 */ 9798 fit?: "scale-down" | "contain" | "cover" | "crop" | "pad" | "squeeze"; 9799 /** 9800 * Image segmentation using artificial intelligence models. Sets pixels not 9801 * within selected segment area to transparent e.g "foreground" sets every 9802 * background pixel as transparent. 9803 */ 9804 segment?: "foreground"; 9805 /** 9806 * When cropping with fit: "cover", this defines the side or point that should 9807 * be left uncropped. The value is either a string 9808 * "left", "right", "top", "bottom", "auto", or "center" (the default), 9809 * or an object {x, y} containing focal point coordinates in the original 9810 * image expressed as fractions ranging from 0.0 (top or left) to 1.0 9811 * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will 9812 * crop bottom or left and right sides as necessary, but won’t crop anything 9813 * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to 9814 * preserve as much as possible around a point at 20% of the height of the 9815 * source image. 9816 */ 9817 gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates; 9818 /** 9819 * Background color to add underneath the image. Applies only to images with 9820 * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), 9821 * hsl(…), etc.) 9822 */ 9823 background?: string; 9824 /** 9825 * Number of degrees (90, 180, 270) to rotate the image by. width and height 9826 * options refer to axes after rotation. 9827 */ 9828 rotate?: 0 | 90 | 180 | 270 | 360; 9829} 9830interface BasicImageTransformationsGravityCoordinates { 9831 x?: number; 9832 y?: number; 9833 mode?: 'remainder' | 'box-center'; 9834} 9835/** 9836 * In addition to the properties you can set in the RequestInit dict 9837 * that you pass as an argument to the Request constructor, you can 9838 * set certain properties of a `cf` object to control how Cloudflare 9839 * features are applied to that new Request. 9840 * 9841 * Note: Currently, these properties cannot be tested in the 9842 * playground. 9843 */ 9844interface RequestInitCfProperties extends Record<string, unknown> { 9845 cacheEverything?: boolean; 9846 /** 9847 * A request's cache key is what determines if two requests are 9848 * "the same" for caching purposes. If a request has the same cache key 9849 * as some previous request, then we can serve the same cached response for 9850 * both. (e.g. 'some-key') 9851 * 9852 * Only available for Enterprise customers. 9853 */ 9854 cacheKey?: string; 9855 /** 9856 * This allows you to append additional Cache-Tag response headers 9857 * to the origin response without modifications to the origin server. 9858 * This will allow for greater control over the Purge by Cache Tag feature 9859 * utilizing changes only in the Workers process. 9860 * 9861 * Only available for Enterprise customers. 9862 */ 9863 cacheTags?: string[]; 9864 /** 9865 * Force response to be cached for a given number of seconds. (e.g. 300) 9866 */ 9867 cacheTtl?: number; 9868 /** 9869 * Force response to be cached for a given number of seconds based on the Origin status code. 9870 * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) 9871 */ 9872 cacheTtlByStatus?: Record<string, number>; 9873 /** 9874 * Explicit Cache-Control header value to set on the response stored in cache. 9875 * This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400'). 9876 * 9877 * Cannot be used together with `cacheTtl` or the `cache` request option (`no-store`/`no-cache`), 9878 * as these are mutually exclusive cache control mechanisms. Setting both will throw a TypeError. 9879 * 9880 * Can be used together with `cacheTtlByStatus`. 9881 */ 9882 cacheControl?: string; 9883 /** 9884 * Whether the response should be eligible for Cache Reserve storage. 9885 */ 9886 cacheReserveEligible?: boolean; 9887 /** 9888 * Whether to respect strong ETags (as opposed to weak ETags) from the origin. 9889 */ 9890 respectStrongEtag?: boolean; 9891 /** 9892 * Whether to strip ETag headers from the origin response before caching. 9893 */ 9894 stripEtags?: boolean; 9895 /** 9896 * Whether to strip Last-Modified headers from the origin response before caching. 9897 */ 9898 stripLastModified?: boolean; 9899 /** 9900 * Whether to enable Cache Deception Armor, which protects against web cache 9901 * deception attacks by verifying the Content-Type matches the URL extension. 9902 */ 9903 cacheDeceptionArmor?: boolean; 9904 /** 9905 * Minimum file size in bytes for a response to be eligible for Cache Reserve storage. 9906 */ 9907 cacheReserveMinimumFileSize?: number; 9908 scrapeShield?: boolean; 9909 apps?: boolean; 9910 image?: RequestInitCfPropertiesImage; 9911 minify?: RequestInitCfPropertiesImageMinify; 9912 mirage?: boolean; 9913 polish?: "lossy" | "lossless" | "off"; 9914 r2?: RequestInitCfPropertiesR2; 9915 /** 9916 * Redirects the request to an alternate origin server. You can use this, 9917 * for example, to implement load balancing across several origins. 9918 * (e.g.us-east.example.com) 9919 * 9920 * Note - For security reasons, the hostname set in resolveOverride must 9921 * be proxied on the same Cloudflare zone of the incoming request. 9922 * Otherwise, the setting is ignored. CNAME hosts are allowed, so to 9923 * resolve to a host under a different domain or a DNS only domain first 9924 * declare a CNAME record within your own zone’s DNS mapping to the 9925 * external hostname, set proxy on Cloudflare, then set resolveOverride 9926 * to point to that CNAME record. 9927 */ 9928 resolveOverride?: string; 9929} 9930interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations { 9931 /** 9932 * Absolute URL of the image file to use for the drawing. It can be any of 9933 * the supported file formats. For drawing of watermarks or non-rectangular 9934 * overlays we recommend using PNG or WebP images. 9935 */ 9936 url: string; 9937 /** 9938 * Floating-point number between 0 (transparent) and 1 (opaque). 9939 * For example, opacity: 0.5 makes overlay semitransparent. 9940 */ 9941 opacity?: number; 9942 /** 9943 * - If set to true, the overlay image will be tiled to cover the entire 9944 * area. This is useful for stock-photo-like watermarks. 9945 * - If set to "x", the overlay image will be tiled horizontally only 9946 * (form a line). 9947 * - If set to "y", the overlay image will be tiled vertically only 9948 * (form a line). 9949 */ 9950 repeat?: true | "x" | "y"; 9951 /** 9952 * Position of the overlay image relative to a given edge. Each property is 9953 * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 9954 * positions left side of the overlay 10 pixels from the left edge of the 9955 * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom 9956 * of the background image. 9957 * 9958 * Setting both left & right, or both top & bottom is an error. 9959 * 9960 * If no position is specified, the image will be centered. 9961 */ 9962 top?: number; 9963 left?: number; 9964 bottom?: number; 9965 right?: number; 9966} 9967interface RequestInitCfPropertiesImage extends BasicImageTransformations { 9968 /** 9969 * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it 9970 * easier to specify higher-DPI sizes in <img srcset>. 9971 */ 9972 dpr?: number; 9973 /** 9974 * Allows you to trim your image. Takes dpr into account and is performed before 9975 * resizing or rotation. 9976 * 9977 * It can be used as: 9978 * - left, top, right, bottom - it will specify the number of pixels to cut 9979 * off each side 9980 * - width, height - the width/height you'd like to end up with - can be used 9981 * in combination with the properties above 9982 * - border - this will automatically trim the surroundings of an image based on 9983 * it's color. It consists of three properties: 9984 * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit) 9985 * - tolerance: difference from color to treat as color 9986 * - keep: the number of pixels of border to keep 9987 */ 9988 trim?: "border" | { 9989 top?: number; 9990 bottom?: number; 9991 left?: number; 9992 right?: number; 9993 width?: number; 9994 height?: number; 9995 border?: boolean | { 9996 color?: string; 9997 tolerance?: number; 9998 keep?: number; 9999 }; 10000 }; 10001 /** 10002 * Quality setting from 1-100 (useful values are in 60-90 range). Lower values 10003 * make images look worse, but load faster. The default is 85. It applies only 10004 * to JPEG and WebP images. It doesn’t have any effect on PNG. 10005 */ 10006 quality?: number | "low" | "medium-low" | "medium-high" | "high"; 10007 /** 10008 * Output format to generate. It can be: 10009 * - avif: generate images in AVIF format. 10010 * - webp: generate images in Google WebP format. Set quality to 100 to get 10011 * the WebP-lossless format. 10012 * - json: instead of generating an image, outputs information about the 10013 * image, in JSON format. The JSON object will contain image size 10014 * (before and after resizing), source image’s MIME type, file size, etc. 10015 * - jpeg: generate images in JPEG format. 10016 * - png: generate images in PNG format. 10017 */ 10018 format?: "avif" | "webp" | "json" | "jpeg" | "png" | "baseline-jpeg" | "png-force" | "svg"; 10019 /** 10020 * Whether to preserve animation frames from input files. Default is true. 10021 * Setting it to false reduces animations to still images. This setting is 10022 * recommended when enlarging images or processing arbitrary user content, 10023 * because large GIF animations can weigh tens or even hundreds of megabytes. 10024 * It is also useful to set anim:false when using format:"json" to get the 10025 * response quicker without the number of frames. 10026 */ 10027 anim?: boolean; 10028 /** 10029 * What EXIF data should be preserved in the output image. Note that EXIF 10030 * rotation and embedded color profiles are always applied ("baked in" into 10031 * the image), and aren't affected by this option. Note that if the Polish 10032 * feature is enabled, all metadata may have been removed already and this 10033 * option may have no effect. 10034 * - keep: Preserve most of EXIF metadata, including GPS location if there's 10035 * any. 10036 * - copyright: Only keep the copyright tag, and discard everything else. 10037 * This is the default behavior for JPEG files. 10038 * - none: Discard all invisible EXIF metadata. Currently WebP and PNG 10039 * output formats always discard metadata. 10040 */ 10041 metadata?: "keep" | "copyright" | "none"; 10042 /** 10043 * Strength of sharpening filter to apply to the image. Floating-point 10044 * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a 10045 * recommended value for downscaled images. 10046 */ 10047 sharpen?: number; 10048 /** 10049 * Radius of a blur filter (approximate gaussian). Maximum supported radius 10050 * is 250. 10051 */ 10052 blur?: number; 10053 /** 10054 * Overlays are drawn in the order they appear in the array (last array 10055 * entry is the topmost layer). 10056 */ 10057 draw?: RequestInitCfPropertiesImageDraw[]; 10058 /** 10059 * Fetching image from authenticated origin. Setting this property will 10060 * pass authentication headers (Authorization, Cookie, etc.) through to 10061 * the origin. 10062 */ 10063 "origin-auth"?: "share-publicly"; 10064 /** 10065 * Adds a border around the image. The border is added after resizing. Border 10066 * width takes dpr into account, and can be specified either using a single 10067 * width property, or individually for each side. 10068 */ 10069 border?: { 10070 color: string; 10071 width: number; 10072 } | { 10073 color: string; 10074 top: number; 10075 right: number; 10076 bottom: number; 10077 left: number; 10078 }; 10079 /** 10080 * Increase brightness by a factor. A value of 1.0 equals no change, a value 10081 * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. 10082 * 0 is ignored. 10083 */ 10084 brightness?: number; 10085 /** 10086 * Increase contrast by a factor. A value of 1.0 equals no change, a value of 10087 * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is 10088 * ignored. 10089 */ 10090 contrast?: number; 10091 /** 10092 * Increase exposure by a factor. A value of 1.0 equals no change, a value of 10093 * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. 10094 */ 10095 gamma?: number; 10096 /** 10097 * Increase contrast by a factor. A value of 1.0 equals no change, a value of 10098 * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is 10099 * ignored. 10100 */ 10101 saturation?: number; 10102 /** 10103 * Flips the images horizontally, vertically, or both. Flipping is applied before 10104 * rotation, so if you apply flip=h,rotate=90 then the image will be flipped 10105 * horizontally, then rotated by 90 degrees. 10106 */ 10107 flip?: 'h' | 'v' | 'hv'; 10108 /** 10109 * Slightly reduces latency on a cache miss by selecting a 10110 * quickest-to-compress file format, at a cost of increased file size and 10111 * lower image quality. It will usually override the format option and choose 10112 * JPEG over WebP or AVIF. We do not recommend using this option, except in 10113 * unusual circumstances like resizing uncacheable dynamically-generated 10114 * images. 10115 */ 10116 compression?: "fast"; 10117} 10118interface RequestInitCfPropertiesImageMinify { 10119 javascript?: boolean; 10120 css?: boolean; 10121 html?: boolean; 10122} 10123interface RequestInitCfPropertiesR2 { 10124 /** 10125 * Colo id of bucket that an object is stored in 10126 */ 10127 bucketColoId?: number; 10128} 10129/** 10130 * Request metadata provided by Cloudflare's edge. 10131 */ 10132type IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield; 10133interface IncomingRequestCfPropertiesBase extends Record<string, unknown> { 10134 /** 10135 * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. 10136 * 10137 * @example 395747 10138 */ 10139 asn?: number; 10140 /** 10141 * The organization which owns the ASN of the incoming request. 10142 * 10143 * @example "Google Cloud" 10144 */ 10145 asOrganization?: string; 10146 /** 10147 * The original value of the `Accept-Encoding` header if Cloudflare modified it. 10148 * 10149 * @example "gzip, deflate, br" 10150 */ 10151 clientAcceptEncoding?: string; 10152 /** 10153 * The number of milliseconds it took for the request to reach your worker. 10154 * 10155 * @example 22 10156 */ 10157 clientTcpRtt?: number; 10158 /** 10159 * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) 10160 * airport code of the data center that the request hit. 10161 * 10162 * @example "DFW" 10163 */ 10164 colo: string; 10165 /** 10166 * Represents the upstream's response to a 10167 * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) 10168 * from cloudflare. 10169 * 10170 * For workers with no upstream, this will always be `1`. 10171 * 10172 * @example 3 10173 */ 10174 edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; 10175 /** 10176 * The HTTP Protocol the request used. 10177 * 10178 * @example "HTTP/2" 10179 */ 10180 httpProtocol: string; 10181 /** 10182 * The browser-requested prioritization information in the request object. 10183 * 10184 * If no information was set, defaults to the empty string `""` 10185 * 10186 * @example "weight=192;exclusive=0;group=3;group-weight=127" 10187 * @default "" 10188 */ 10189 requestPriority: string; 10190 /** 10191 * The TLS version of the connection to Cloudflare. 10192 * In requests served over plaintext (without TLS), this property is the empty string `""`. 10193 * 10194 * @example "TLSv1.3" 10195 */ 10196 tlsVersion: string; 10197 /** 10198 * The cipher for the connection to Cloudflare. 10199 * In requests served over plaintext (without TLS), this property is the empty string `""`. 10200 * 10201 * @example "AEAD-AES128-GCM-SHA256" 10202 */ 10203 tlsCipher: string; 10204 /** 10205 * 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. 10206 * 10207 * If the incoming request was served over plaintext (without TLS) this field is undefined. 10208 */ 10209 tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; 10210} 10211interface IncomingRequestCfPropertiesBotManagementBase { 10212 /** 10213 * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, 10214 * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human). 10215 * 10216 * @example 54 10217 */ 10218 score: number; 10219 /** 10220 * A boolean value that is true if the request comes from a good bot, like Google or Bing. 10221 * 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). 10222 */ 10223 verifiedBot: boolean; 10224 /** 10225 * A boolean value that is true if the request originates from a 10226 * Cloudflare-verified proxy service. 10227 */ 10228 corporateProxy: boolean; 10229 /** 10230 * 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. 10231 */ 10232 staticResource: boolean; 10233 /** 10234 * 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). 10235 */ 10236 detectionIds: number[]; 10237} 10238interface IncomingRequestCfPropertiesBotManagement { 10239 /** 10240 * Results of Cloudflare's Bot Management analysis 10241 */ 10242 botManagement: IncomingRequestCfPropertiesBotManagementBase; 10243 /** 10244 * Duplicate of `botManagement.score`. 10245 * 10246 * @deprecated 10247 */ 10248 clientTrustScore: number; 10249} 10250interface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement { 10251 /** 10252 * Results of Cloudflare's Bot Management analysis 10253 */ 10254 botManagement: IncomingRequestCfPropertiesBotManagementBase & { 10255 /** 10256 * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients 10257 * across different destination IPs, Ports, and X509 certificates. 10258 */ 10259 ja3Hash: string; 10260 }; 10261} 10262interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> { 10263 /** 10264 * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). 10265 * 10266 * This field is only present if you have Cloudflare for SaaS enabled on your account 10267 * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). 10268 */ 10269 hostMetadata?: HostMetadata; 10270} 10271interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { 10272 /** 10273 * Information about the client certificate presented to Cloudflare. 10274 * 10275 * This is populated when the incoming request is served over TLS using 10276 * either Cloudflare Access or API Shield (mTLS) 10277 * and the presented SSL certificate has a valid 10278 * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) 10279 * (i.e., not `null` or `""`). 10280 * 10281 * Otherwise, a set of placeholder values are used. 10282 * 10283 * The property `certPresented` will be set to `"1"` when 10284 * the object is populated (i.e. the above conditions were met). 10285 */ 10286 tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; 10287} 10288/** 10289 * Metadata about the request's TLS handshake 10290 */ 10291interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { 10292 /** 10293 * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal 10294 * 10295 * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" 10296 */ 10297 clientHandshake: string; 10298 /** 10299 * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal 10300 * 10301 * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" 10302 */ 10303 serverHandshake: string; 10304 /** 10305 * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal 10306 * 10307 * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" 10308 */ 10309 clientFinished: string; 10310 /** 10311 * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal 10312 * 10313 * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" 10314 */ 10315 serverFinished: string; 10316} 10317/** 10318 * Geographic data about the request's origin. 10319 */ 10320interface IncomingRequestCfPropertiesGeographicInformation { 10321 /** 10322 * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. 10323 * 10324 * 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. 10325 * 10326 * If Cloudflare is unable to determine where the request originated this property is omitted. 10327 * 10328 * The country code `"T1"` is used for requests originating on TOR. 10329 * 10330 * @example "GB" 10331 */ 10332 country?: Iso3166Alpha2Code | "T1"; 10333 /** 10334 * If present, this property indicates that the request originated in the EU 10335 * 10336 * @example "1" 10337 */ 10338 isEUCountry?: "1"; 10339 /** 10340 * A two-letter code indicating the continent the request originated from. 10341 * 10342 * @example "AN" 10343 */ 10344 continent?: ContinentCode; 10345 /** 10346 * The city the request originated from 10347 * 10348 * @example "Austin" 10349 */ 10350 city?: string; 10351 /** 10352 * Postal code of the incoming request 10353 * 10354 * @example "78701" 10355 */ 10356 postalCode?: string; 10357 /** 10358 * Latitude of the incoming request 10359 * 10360 * @example "30.27130" 10361 */ 10362 latitude?: string; 10363 /** 10364 * Longitude of the incoming request 10365 * 10366 * @example "-97.74260" 10367 */ 10368 longitude?: string; 10369 /** 10370 * Timezone of the incoming request 10371 * 10372 * @example "America/Chicago" 10373 */ 10374 timezone?: string; 10375 /** 10376 * If known, the ISO 3166-2 name for the first level region associated with 10377 * the IP address of the incoming request 10378 * 10379 * @example "Texas" 10380 */ 10381 region?: string; 10382 /** 10383 * If known, the ISO 3166-2 code for the first-level region associated with 10384 * the IP address of the incoming request 10385 * 10386 * @example "TX" 10387 */ 10388 regionCode?: string; 10389 /** 10390 * Metro code (DMA) of the incoming request 10391 * 10392 * @example "635" 10393 */ 10394 metroCode?: string; 10395} 10396/** Data about the incoming request's TLS certificate */ 10397interface IncomingRequestCfPropertiesTLSClientAuth { 10398 /** Always `"1"`, indicating that the certificate was presented */ 10399 certPresented: "1"; 10400 /** 10401 * Result of certificate verification. 10402 * 10403 * @example "FAILED:self signed certificate" 10404 */ 10405 certVerified: Exclude<CertVerificationStatus, "NONE">; 10406 /** The presented certificate's revokation status. 10407 * 10408 * - A value of `"1"` indicates the certificate has been revoked 10409 * - A value of `"0"` indicates the certificate has not been revoked 10410 */ 10411 certRevoked: "1" | "0"; 10412 /** 10413 * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) 10414 * 10415 * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" 10416 */ 10417 certIssuerDN: string; 10418 /** 10419 * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) 10420 * 10421 * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" 10422 */ 10423 certSubjectDN: string; 10424 /** 10425 * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) 10426 * 10427 * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" 10428 */ 10429 certIssuerDNRFC2253: string; 10430 /** 10431 * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) 10432 * 10433 * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" 10434 */ 10435 certSubjectDNRFC2253: string; 10436 /** The certificate issuer's distinguished name (legacy policies) */ 10437 certIssuerDNLegacy: string; 10438 /** The certificate subject's distinguished name (legacy policies) */ 10439 certSubjectDNLegacy: string; 10440 /** 10441 * The certificate's serial number 10442 * 10443 * @example "00936EACBE07F201DF" 10444 */ 10445 certSerial: string; 10446 /** 10447 * The certificate issuer's serial number 10448 * 10449 * @example "2489002934BDFEA34" 10450 */ 10451 certIssuerSerial: string; 10452 /** 10453 * The certificate's Subject Key Identifier 10454 * 10455 * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" 10456 */ 10457 certSKI: string; 10458 /** 10459 * The certificate issuer's Subject Key Identifier 10460 * 10461 * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" 10462 */ 10463 certIssuerSKI: string; 10464 /** 10465 * The certificate's SHA-1 fingerprint 10466 * 10467 * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" 10468 */ 10469 certFingerprintSHA1: string; 10470 /** 10471 * The certificate's SHA-256 fingerprint 10472 * 10473 * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" 10474 */ 10475 certFingerprintSHA256: string; 10476 /** 10477 * The effective starting date of the certificate 10478 * 10479 * @example "Dec 22 19:39:00 2018 GMT" 10480 */ 10481 certNotBefore: string; 10482 /** 10483 * The effective expiration date of the certificate 10484 * 10485 * @example "Dec 22 19:39:00 2018 GMT" 10486 */ 10487 certNotAfter: string; 10488} 10489/** Placeholder values for TLS Client Authorization */ 10490interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { 10491 certPresented: "0"; 10492 certVerified: "NONE"; 10493 certRevoked: "0"; 10494 certIssuerDN: ""; 10495 certSubjectDN: ""; 10496 certIssuerDNRFC2253: ""; 10497 certSubjectDNRFC2253: ""; 10498 certIssuerDNLegacy: ""; 10499 certSubjectDNLegacy: ""; 10500 certSerial: ""; 10501 certIssuerSerial: ""; 10502 certSKI: ""; 10503 certIssuerSKI: ""; 10504 certFingerprintSHA1: ""; 10505 certFingerprintSHA256: ""; 10506 certNotBefore: ""; 10507 certNotAfter: ""; 10508} 10509/** Possible outcomes of TLS verification */ 10510declare type CertVerificationStatus = 10511/** Authentication succeeded */ 10512"SUCCESS" 10513/** No certificate was presented */ 10514 | "NONE" 10515/** Failed because the certificate was self-signed */ 10516 | "FAILED:self signed certificate" 10517/** Failed because the certificate failed a trust chain check */ 10518 | "FAILED:unable to verify the first certificate" 10519/** Failed because the certificate not yet valid */ 10520 | "FAILED:certificate is not yet valid" 10521/** Failed because the certificate is expired */ 10522 | "FAILED:certificate has expired" 10523/** Failed for another unspecified reason */ 10524 | "FAILED"; 10525/** 10526 * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. 10527 */ 10528declare 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 */ 10529/** ISO 3166-1 Alpha-2 codes */ 10530declare 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"; 10531/** The 2-letter continent codes Cloudflare uses */ 10532declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; 10533type CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties; 10534interface D1Meta { 10535 duration: number; 10536 size_after: number; 10537 rows_read: number; 10538 rows_written: number; 10539 last_row_id: number; 10540 changed_db: boolean; 10541 changes: number; 10542 /** 10543 * The region of the database instance that executed the query. 10544 */ 10545 served_by_region?: string; 10546 /** 10547 * The three letters airport code of the colo that executed the query. 10548 */ 10549 served_by_colo?: string; 10550 /** 10551 * True if-and-only-if the database instance that executed the query was the primary. 10552 */ 10553 served_by_primary?: boolean; 10554 timings?: { 10555 /** 10556 * The duration of the SQL query execution by the database instance. It doesn't include any network time. 10557 */ 10558 sql_duration_ms: number; 10559 }; 10560 /** 10561 * Number of total attempts to execute the query, due to automatic retries. 10562 * Note: All other fields in the response like `timings` only apply to the last attempt. 10563 */ 10564 total_attempts?: number; 10565} 10566interface D1Response { 10567 success: true; 10568 meta: D1Meta & Record<string, unknown>; 10569 error?: never; 10570} 10571type D1Result<T = unknown> = D1Response & { 10572 results: T[]; 10573}; 10574interface D1ExecResult { 10575 count: number; 10576 duration: number; 10577} 10578type D1SessionConstraint = 10579// Indicates that the first query should go to the primary, and the rest queries 10580// using the same D1DatabaseSession will go to any replica that is consistent with 10581// the bookmark maintained by the session (returned by the first query). 10582'first-primary' 10583// Indicates that the first query can go anywhere (primary or replica), and the rest queries 10584// using the same D1DatabaseSession will go to any replica that is consistent with 10585// the bookmark maintained by the session (returned by the first query). 10586 | 'first-unconstrained'; 10587type D1SessionBookmark = string; 10588declare abstract class D1Database { 10589 prepare(query: string): D1PreparedStatement; 10590 batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>; 10591 exec(query: string): Promise<D1ExecResult>; 10592 /** 10593 * Creates a new D1 Session anchored at the given constraint or the bookmark. 10594 * All queries executed using the created session will have sequential consistency, 10595 * meaning that all writes done through the session will be visible in subsequent reads. 10596 * 10597 * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session. 10598 */ 10599 withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession; 10600 /** 10601 * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases. 10602 */ 10603 dump(): Promise<ArrayBuffer>; 10604} 10605declare abstract class D1DatabaseSession { 10606 prepare(query: string): D1PreparedStatement; 10607 batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>; 10608 /** 10609 * @returns The latest session bookmark across all executed queries on the session. 10610 * If no query has been executed yet, `null` is returned. 10611 */ 10612 getBookmark(): D1SessionBookmark | null; 10613} 10614declare abstract class D1PreparedStatement { 10615 bind(...values: unknown[]): D1PreparedStatement; 10616 first<T = unknown>(colName: string): Promise<T | null>; 10617 first<T = Record<string, unknown>>(): Promise<T | null>; 10618 run<T = Record<string, unknown>>(): Promise<D1Result<T>>; 10619 all<T = Record<string, unknown>>(): Promise<D1Result<T>>; 10620 raw<T = unknown[]>(options: { 10621 columnNames: true; 10622 }): Promise<[ 10623 string[], 10624 ...T[] 10625 ]>; 10626 raw<T = unknown[]>(options?: { 10627 columnNames?: false; 10628 }): Promise<T[]>; 10629} 10630// `Disposable` was added to TypeScript's standard lib types in version 5.2. 10631// To support older TypeScript versions, define an empty `Disposable` interface. 10632// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2, 10633// but this will ensure type checking on older versions still passes. 10634// TypeScript's interface merging will ensure our empty interface is effectively 10635// ignored when `Disposable` is included in the standard lib. 10636interface Disposable { 10637} 10638/** 10639 * The returned data after sending an email 10640 */ 10641interface EmailSendResult { 10642 /** 10643 * The Email Message ID 10644 */ 10645 messageId: string; 10646} 10647/** 10648 * An email message that can be sent from a Worker. 10649 */ 10650interface EmailMessage { 10651 /** 10652 * Envelope From attribute of the email message. 10653 */ 10654 readonly from: string; 10655 /** 10656 * Envelope To attribute of the email message. 10657 */ 10658 readonly to: string; 10659} 10660/** 10661 * An email message that is sent to a consumer Worker and can be rejected/forwarded. 10662 */ 10663interface ForwardableEmailMessage extends EmailMessage { 10664 /** 10665 * Stream of the email message content. 10666 */ 10667 readonly raw: ReadableStream<Uint8Array>; 10668 /** 10669 * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). 10670 */ 10671 readonly headers: Headers; 10672 /** 10673 * Size of the email message content. 10674 */ 10675 readonly rawSize: number; 10676 /** 10677 * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. 10678 * @param reason The reject reason. 10679 * @returns void 10680 */ 10681 setReject(reason: string): void; 10682 /** 10683 * Forward this email message to a verified destination address of the account. 10684 * @param rcptTo Verified destination address. 10685 * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). 10686 * @returns A promise that resolves when the email message is forwarded. 10687 */ 10688 forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>; 10689 /** 10690 * Reply to the sender of this email message with a new EmailMessage object. 10691 * @param message The reply message. 10692 * @returns A promise that resolves when the email message is replied. 10693 */ 10694 reply(message: EmailMessage): Promise<EmailSendResult>; 10695} 10696/** A file attachment for an email message */ 10697type EmailAttachment = { 10698 disposition: 'inline'; 10699 contentId: string; 10700 filename: string; 10701 type: string; 10702 content: string | ArrayBuffer | ArrayBufferView; 10703} | { 10704 disposition: 'attachment'; 10705 contentId?: undefined; 10706 filename: string; 10707 type: string; 10708 content: string | ArrayBuffer | ArrayBufferView; 10709}; 10710/** An Email Address */ 10711interface EmailAddress { 10712 name: string; 10713 email: string; 10714} 10715/** 10716 * A binding that allows a Worker to send email messages. 10717 */ 10718interface SendEmail { 10719 send(message: EmailMessage): Promise<EmailSendResult>; 10720 send(builder: { 10721 from: string | EmailAddress; 10722 to: string | string[]; 10723 subject: string; 10724 replyTo?: string | EmailAddress; 10725 cc?: string | string[]; 10726 bcc?: string | string[]; 10727 headers?: Record<string, string>; 10728 text?: string; 10729 html?: string; 10730 attachments?: EmailAttachment[]; 10731 }): Promise<EmailSendResult>; 10732} 10733declare abstract class EmailEvent extends ExtendableEvent { 10734 readonly message: ForwardableEmailMessage; 10735} 10736declare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>; 10737declare module "cloudflare:email" { 10738 let _EmailMessage: { 10739 prototype: EmailMessage; 10740 new (from: string, to: string, raw: ReadableStream | string): EmailMessage; 10741 }; 10742 export { _EmailMessage as EmailMessage }; 10743} 10744/** 10745 * Hello World binding to serve as an explanatory example. DO NOT USE 10746 */ 10747interface HelloWorldBinding { 10748 /** 10749 * Retrieve the current stored value 10750 */ 10751 get(): Promise<{ 10752 value: string; 10753 ms?: number; 10754 }>; 10755 /** 10756 * Set a new stored value 10757 */ 10758 set(value: string): Promise<void>; 10759} 10760interface Hyperdrive { 10761 /** 10762 * Connect directly to Hyperdrive as if it's your database, returning a TCP socket. 10763 * 10764 * Calling this method returns an identical socket to if you call 10765 * `connect("host:port")` using the `host` and `port` fields from this object. 10766 * Pick whichever approach works better with your preferred DB client library. 10767 * 10768 * Note that this socket is not yet authenticated -- it's expected that your 10769 * code (or preferably, the client library of your choice) will authenticate 10770 * using the information in this class's readonly fields. 10771 */ 10772 connect(): Socket; 10773 /** 10774 * A valid DB connection string that can be passed straight into the typical 10775 * client library/driver/ORM. This will typically be the easiest way to use 10776 * Hyperdrive. 10777 */ 10778 readonly connectionString: string; 10779 /* 10780 * A randomly generated hostname that is only valid within the context of the 10781 * currently running Worker which, when passed into `connect()` function from 10782 * the "cloudflare:sockets" module, will connect to the Hyperdrive instance 10783 * for your database. 10784 */ 10785 readonly host: string; 10786 /* 10787 * The port that must be paired the the host field when connecting. 10788 */ 10789 readonly port: number; 10790 /* 10791 * The username to use when authenticating to your database via Hyperdrive. 10792 * Unlike the host and password, this will be the same every time 10793 */ 10794 readonly user: string; 10795 /* 10796 * The randomly generated password to use when authenticating to your 10797 * database via Hyperdrive. Like the host field, this password is only valid 10798 * within the context of the currently running Worker instance from which 10799 * it's read. 10800 */ 10801 readonly password: string; 10802 /* 10803 * The name of the database to connect to. 10804 */ 10805 readonly database: string; 10806} 10807// Copyright (c) 2024 Cloudflare, Inc. 10808// Licensed under the Apache 2.0 license found in the LICENSE file or at: 10809// https://opensource.org/licenses/Apache-2.0 10810type ImageInfoResponse = { 10811 format: 'image/svg+xml'; 10812} | { 10813 format: string; 10814 fileSize: number; 10815 width: number; 10816 height: number; 10817}; 10818type ImageTransform = { 10819 width?: number; 10820 height?: number; 10821 background?: string; 10822 blur?: number; 10823 border?: { 10824 color?: string; 10825 width?: number; 10826 } | { 10827 top?: number; 10828 bottom?: number; 10829 left?: number; 10830 right?: number; 10831 }; 10832 brightness?: number; 10833 contrast?: number; 10834 fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop'; 10835 flip?: 'h' | 'v' | 'hv'; 10836 gamma?: number; 10837 segment?: 'foreground'; 10838 gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | { 10839 x?: number; 10840 y?: number; 10841 mode: 'remainder' | 'box-center'; 10842 }; 10843 rotate?: 0 | 90 | 180 | 270; 10844 saturation?: number; 10845 sharpen?: number; 10846 trim?: 'border' | { 10847 top?: number; 10848 bottom?: number; 10849 left?: number; 10850 right?: number; 10851 width?: number; 10852 height?: number; 10853 border?: boolean | { 10854 color?: string; 10855 tolerance?: number; 10856 keep?: number; 10857 }; 10858 }; 10859}; 10860type ImageDrawOptions = { 10861 opacity?: number; 10862 repeat?: boolean | string; 10863 top?: number; 10864 left?: number; 10865 bottom?: number; 10866 right?: number; 10867}; 10868type ImageInputOptions = { 10869 encoding?: 'base64'; 10870}; 10871type ImageOutputOptions = { 10872 format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba'; 10873 quality?: number; 10874 background?: string; 10875 anim?: boolean; 10876}; 10877interface ImageMetadata { 10878 id: string; 10879 filename?: string; 10880 uploaded?: string; 10881 requireSignedURLs: boolean; 10882 meta?: Record<string, unknown>; 10883 variants: string[]; 10884 draft?: boolean; 10885 creator?: string; 10886} 10887interface ImageUploadOptions { 10888 id?: string; 10889 filename?: string; 10890 requireSignedURLs?: boolean; 10891 metadata?: Record<string, unknown>; 10892 creator?: string; 10893 encoding?: 'base64'; 10894} 10895interface ImageUpdateOptions { 10896 requireSignedURLs?: boolean; 10897 metadata?: Record<string, unknown>; 10898 creator?: string; 10899} 10900interface ImageListOptions { 10901 limit?: number; 10902 cursor?: string; 10903 sortOrder?: 'asc' | 'desc'; 10904 creator?: string; 10905} 10906interface ImageList { 10907 images: ImageMetadata[]; 10908 cursor?: string; 10909 listComplete: boolean; 10910} 10911interface HostedImagesBinding { 10912 /** 10913 * Get detailed metadata for a hosted image 10914 * @param imageId The ID of the image (UUID or custom ID) 10915 * @returns Image metadata, or null if not found 10916 */ 10917 details(imageId: string): Promise<ImageMetadata | null>; 10918 /** 10919 * Get the raw image data for a hosted image 10920 * @param imageId The ID of the image (UUID or custom ID) 10921 * @returns ReadableStream of image bytes, or null if not found 10922 */ 10923 image(imageId: string): Promise<ReadableStream<Uint8Array> | null>; 10924 /** 10925 * Upload a new hosted image 10926 * @param image The image file to upload 10927 * @param options Upload configuration 10928 * @returns Metadata for the uploaded image 10929 * @throws {@link ImagesError} if upload fails 10930 */ 10931 upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>; 10932 /** 10933 * Update hosted image metadata 10934 * @param imageId The ID of the image 10935 * @param options Properties to update 10936 * @returns Updated image metadata 10937 * @throws {@link ImagesError} if update fails 10938 */ 10939 update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>; 10940 /** 10941 * Delete a hosted image 10942 * @param imageId The ID of the image 10943 * @returns True if deleted, false if not found 10944 */ 10945 delete(imageId: string): Promise<boolean>; 10946 /** 10947 * List hosted images with pagination 10948 * @param options List configuration 10949 * @returns List of images with pagination info 10950 * @throws {@link ImagesError} if list fails 10951 */ 10952 list(options?: ImageListOptions): Promise<ImageList>; 10953} 10954interface ImagesBinding { 10955 /** 10956 * Get image metadata (type, width and height) 10957 * @throws {@link ImagesError} with code 9412 if input is not an image 10958 * @param stream The image bytes 10959 */ 10960 info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>; 10961 /** 10962 * Begin applying a series of transformations to an image 10963 * @param stream The image bytes 10964 * @returns A transform handle 10965 */ 10966 input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer; 10967 /** 10968 * Access hosted images CRUD operations 10969 */ 10970 readonly hosted: HostedImagesBinding; 10971} 10972interface ImageTransformer { 10973 /** 10974 * Apply transform next, returning a transform handle. 10975 * You can then apply more transformations, draw, or retrieve the output. 10976 * @param transform 10977 */ 10978 transform(transform: ImageTransform): ImageTransformer; 10979 /** 10980 * Draw an image on this transformer, returning a transform handle. 10981 * You can then apply more transformations, draw, or retrieve the output. 10982 * @param image The image (or transformer that will give the image) to draw 10983 * @param options The options configuring how to draw the image 10984 */ 10985 draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer; 10986 /** 10987 * Retrieve the image that results from applying the transforms to the 10988 * provided input 10989 * @param options Options that apply to the output e.g. output format 10990 */ 10991 output(options: ImageOutputOptions): Promise<ImageTransformationResult>; 10992} 10993type ImageTransformationOutputOptions = { 10994 encoding?: 'base64'; 10995}; 10996interface ImageTransformationResult { 10997 /** 10998 * The image as a response, ready to store in cache or return to users 10999 */ 11000 response(): Response; 11001 /** 11002 * The content type of the returned image 11003 */ 11004 contentType(): string; 11005 /** 11006 * The bytes of the response 11007 */ 11008 image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>; 11009} 11010interface ImagesError extends Error { 11011 readonly code: number; 11012 readonly message: string; 11013 readonly stack?: string; 11014} 11015/** 11016 * Media binding for transforming media streams. 11017 * Provides the entry point for media transformation operations. 11018 */ 11019interface MediaBinding { 11020 /** 11021 * Creates a media transformer from an input stream. 11022 * @param media - The input media bytes 11023 * @returns A MediaTransformer instance for applying transformations 11024 */ 11025 input(media: ReadableStream<Uint8Array>): MediaTransformer; 11026} 11027/** 11028 * Media transformer for applying transformation operations to media content. 11029 * Handles sizing, fitting, and other input transformation parameters. 11030 */ 11031interface MediaTransformer { 11032 /** 11033 * Applies transformation options to the media content. 11034 * @param transform - Configuration for how the media should be transformed 11035 * @returns A generator for producing the transformed media output 11036 */ 11037 transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator; 11038 /** 11039 * Generates the final media output with specified options. 11040 * @param output - Configuration for the output format and parameters 11041 * @returns The final transformation result containing the transformed media 11042 */ 11043 output(output?: MediaTransformationOutputOptions): MediaTransformationResult; 11044} 11045/** 11046 * Generator for producing media transformation results. 11047 * Configures the output format and parameters for the transformed media. 11048 */ 11049interface MediaTransformationGenerator { 11050 /** 11051 * Generates the final media output with specified options. 11052 * @param output - Configuration for the output format and parameters 11053 * @returns The final transformation result containing the transformed media 11054 */ 11055 output(output?: MediaTransformationOutputOptions): MediaTransformationResult; 11056} 11057/** 11058 * Result of a media transformation operation. 11059 * Provides multiple ways to access the transformed media content. 11060 */ 11061interface MediaTransformationResult { 11062 /** 11063 * Returns the transformed media as a readable stream of bytes. 11064 * @returns A promise containing a readable stream with the transformed media 11065 */ 11066 media(): Promise<ReadableStream<Uint8Array>>; 11067 /** 11068 * Returns the transformed media as an HTTP response object. 11069 * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users 11070 */ 11071 response(): Promise<Response>; 11072 /** 11073 * Returns the MIME type of the transformed media. 11074 * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4') 11075 */ 11076 contentType(): Promise<string>; 11077} 11078/** 11079 * Configuration options for transforming media input. 11080 * Controls how the media should be resized and fitted. 11081 */ 11082type MediaTransformationInputOptions = { 11083 /** How the media should be resized to fit the specified dimensions */ 11084 fit?: 'contain' | 'cover' | 'scale-down'; 11085 /** Target width in pixels */ 11086 width?: number; 11087 /** Target height in pixels */ 11088 height?: number; 11089}; 11090/** 11091 * Configuration options for Media Transformations output. 11092 * Controls the format, timing, and type of the generated output. 11093 */ 11094type MediaTransformationOutputOptions = { 11095 /** 11096 * Output mode determining the type of media to generate 11097 */ 11098 mode?: 'video' | 'spritesheet' | 'frame' | 'audio'; 11099 /** Whether to include audio in the output */ 11100 audio?: boolean; 11101 /** 11102 * Starting timestamp for frame extraction or start time for clips. (e.g. '2s'). 11103 */ 11104 time?: string; 11105 /** 11106 * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s'). 11107 */ 11108 duration?: string; 11109 /** 11110 * Number of frames in the spritesheet. 11111 */ 11112 imageCount?: number; 11113 /** 11114 * Output format for the generated media. 11115 */ 11116 format?: 'jpg' | 'png' | 'm4a'; 11117}; 11118/** 11119 * Error object for media transformation operations. 11120 * Extends the standard Error interface with additional media-specific information. 11121 */ 11122interface MediaError extends Error { 11123 readonly code: number; 11124 readonly message: string; 11125 readonly stack?: string; 11126} 11127declare module 'cloudflare:node' { 11128 interface NodeStyleServer { 11129 listen(...args: unknown[]): this; 11130 address(): { 11131 port?: number | null | undefined; 11132 }; 11133 } 11134 export function httpServerHandler(port: number): ExportedHandler; 11135 export function httpServerHandler(options: { 11136 port: number; 11137 }): ExportedHandler; 11138 export function httpServerHandler(server: NodeStyleServer): ExportedHandler; 11139} 11140type Params<P extends string = any> = Record<P, string | string[]>; 11141type EventContext<Env, P extends string, Data> = { 11142 request: Request<unknown, IncomingRequestCfProperties<unknown>>; 11143 functionPath: string; 11144 waitUntil: (promise: Promise<any>) => void; 11145 passThroughOnException: () => void; 11146 next: (input?: Request | string, init?: RequestInit) => Promise<Response>; 11147 env: Env & { 11148 ASSETS: { 11149 fetch: typeof fetch; 11150 }; 11151 }; 11152 params: Params<P>; 11153 data: Data; 11154}; 11155type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>; 11156type EventPluginContext<Env, P extends string, Data, PluginArgs> = { 11157 request: Request<unknown, IncomingRequestCfProperties<unknown>>; 11158 functionPath: string; 11159 waitUntil: (promise: Promise<any>) => void; 11160 passThroughOnException: () => void; 11161 next: (input?: Request | string, init?: RequestInit) => Promise<Response>; 11162 env: Env & { 11163 ASSETS: { 11164 fetch: typeof fetch; 11165 }; 11166 }; 11167 params: Params<P>; 11168 data: Data; 11169 pluginArgs: PluginArgs; 11170}; 11171type 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>; 11172declare module "assets:*" { 11173 export const onRequest: PagesFunction; 11174} 11175// Copyright (c) 2022-2023 Cloudflare, Inc. 11176// Licensed under the Apache 2.0 license found in the LICENSE file or at: 11177// https://opensource.org/licenses/Apache-2.0 11178declare module "cloudflare:pipelines" { 11179 export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> { 11180 protected env: Env; 11181 protected ctx: ExecutionContext; 11182 constructor(ctx: ExecutionContext, env: Env); 11183 /** 11184 * run receives an array of PipelineRecord which can be 11185 * transformed and returned to the pipeline 11186 * @param records Incoming records from the pipeline to be transformed 11187 * @param metadata Information about the specific pipeline calling the transformation entrypoint 11188 * @returns A promise containing the transformed PipelineRecord array 11189 */ 11190 public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>; 11191 } 11192 export type PipelineRecord = Record<string, unknown>; 11193 export type PipelineBatchMetadata = { 11194 pipelineId: string; 11195 pipelineName: string; 11196 }; 11197 export interface Pipeline<T extends PipelineRecord = PipelineRecord> { 11198 /** 11199 * The Pipeline interface represents the type of a binding to a Pipeline 11200 * 11201 * @param records The records to send to the pipeline 11202 */ 11203 send(records: T[]): Promise<void>; 11204 } 11205} 11206// PubSubMessage represents an incoming PubSub message. 11207// The message includes metadata about the broker, the client, and the payload 11208// itself. 11209// https://developers.cloudflare.com/pub-sub/ 11210interface PubSubMessage { 11211 // Message ID 11212 readonly mid: number; 11213 // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT 11214 readonly broker: string; 11215 // The MQTT topic the message was sent on. 11216 readonly topic: string; 11217 // The client ID of the client that published this message. 11218 readonly clientId: string; 11219 // The unique identifier (JWT ID) used by the client to authenticate, if token 11220 // auth was used. 11221 readonly jti?: string; 11222 // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker 11223 // received the message from the client. 11224 readonly receivedAt: number; 11225 // An (optional) string with the MIME type of the payload, if set by the 11226 // client. 11227 readonly contentType: string; 11228 // Set to 1 when the payload is a UTF-8 string 11229 // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 11230 readonly payloadFormatIndicator: number; 11231 // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. 11232 // You can use payloadFormatIndicator to inspect this before decoding. 11233 payload: string | Uint8Array; 11234} 11235// JsonWebKey extended by kid parameter 11236interface JsonWebKeyWithKid extends JsonWebKey { 11237 // Key Identifier of the JWK 11238 readonly kid: string; 11239} 11240interface RateLimitOptions { 11241 key: string; 11242} 11243interface RateLimitOutcome { 11244 success: boolean; 11245} 11246interface RateLimit { 11247 /** 11248 * Rate limit a request based on the provided options. 11249 * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/ 11250 * @returns A promise that resolves with the outcome of the rate limit. 11251 */ 11252 limit(options: RateLimitOptions): Promise<RateLimitOutcome>; 11253} 11254// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need 11255// to referenced by `Fetcher`. This is included in the "importable" version of the types which 11256// strips all `module` blocks. 11257declare namespace Rpc { 11258 // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s. 11259 // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`. 11260 // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to 11261 // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape) 11262 export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND'; 11263 export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND'; 11264 export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND'; 11265 export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND'; 11266 export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND'; 11267 export interface RpcTargetBranded { 11268 [__RPC_TARGET_BRAND]: never; 11269 } 11270 export interface WorkerEntrypointBranded { 11271 [__WORKER_ENTRYPOINT_BRAND]: never; 11272 } 11273 export interface DurableObjectBranded { 11274 [__DURABLE_OBJECT_BRAND]: never; 11275 } 11276 export interface WorkflowEntrypointBranded { 11277 [__WORKFLOW_ENTRYPOINT_BRAND]: never; 11278 } 11279 export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded; 11280 // Types that can be used through `Stub`s 11281 export type Stubable = RpcTargetBranded | ((...args: any[]) => any); 11282 // Types that can be passed over RPC 11283 // The reason for using a generic type here is to build a serializable subset of structured 11284 // cloneable composite types. This allows types defined with the "interface" keyword to pass the 11285 // serializable check as well. Otherwise, only types defined with the "type" keyword would pass. 11286 type Serializable<T> = 11287 // Structured cloneables 11288 BaseType 11289 // Structured cloneable composites 11290 | 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> | { 11291 [K in keyof T]: K extends number | string ? Serializable<T[K]> : never; 11292 } 11293 // Special types 11294 | Stub<Stubable> 11295 // Serialized as stubs, see `Stubify` 11296 | Stubable; 11297 // Base type for all RPC stubs, including common memory management methods. 11298 // `T` is used as a marker type for unwrapping `Stub`s later. 11299 interface StubBase<T extends Stubable> extends Disposable { 11300 [__RPC_STUB_BRAND]: T; 11301 dup(): this; 11302 } 11303 export type Stub<T extends Stubable> = Provider<T> & StubBase<T>; 11304 // This represents all the types that can be sent as-is over an RPC boundary 11305 type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers; 11306 // Recursively rewrite all `Stubable` types with `Stub`s 11307 // prettier-ignore 11308 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 { 11309 [key: string | number]: any; 11310 } ? { 11311 [K in keyof T]: Stubify<T[K]>; 11312 } : T; 11313 // Recursively rewrite all `Stub<T>`s with the corresponding `T`s. 11314 // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies: 11315 // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`. 11316 // prettier-ignore 11317 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 { 11318 [key: string | number]: unknown; 11319 } ? { 11320 [K in keyof T]: Unstubify<T[K]>; 11321 } : T; 11322 type UnstubifyAll<A extends any[]> = { 11323 [I in keyof A]: Unstubify<A[I]>; 11324 }; 11325 // Utility type for adding `Provider`/`Disposable`s to `object` types only. 11326 // Note `unknown & T` is equivalent to `T`. 11327 type MaybeProvider<T> = T extends object ? Provider<T> : unknown; 11328 type MaybeDisposable<T> = T extends object ? Disposable : unknown; 11329 // Type for method return or property on an RPC interface. 11330 // - Stubable types are replaced by stubs. 11331 // - Serializable types are passed by value, with stubable types replaced by stubs 11332 // and a top-level `Disposer`. 11333 // Everything else can't be passed over PRC. 11334 // Technically, we use custom thenables here, but they quack like `Promise`s. 11335 // Intersecting with `(Maybe)Provider` allows pipelining. 11336 // prettier-ignore 11337 type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never; 11338 // Type for method or property on an RPC interface. 11339 // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s. 11340 // Unwrapping `Stub`s allows calling with `Stubable` arguments. 11341 // For properties, rewrite types to be `Result`s. 11342 // In each case, unwrap `Promise`s. 11343 type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>; 11344 // Type for the callable part of an `Provider` if `T` is callable. 11345 // This is intersected with methods/properties. 11346 type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown; 11347 // Base type for all other types providing RPC-like interfaces. 11348 // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types. 11349 // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC. 11350 export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{ 11351 [K in keyof T]: MethodOrProperty<T[K]>; 11352 }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>; 11353} 11354declare namespace Cloudflare { 11355 // Type of `env`. 11356 // 11357 // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript 11358 // will merge all declarations. 11359 // 11360 // You can use `wrangler types` to generate the `Env` type automatically. 11361 interface Env { 11362 } 11363 // Project-specific parameters used to inform types. 11364 // 11365 // This interface is, again, intended to be declared in project-specific files, and then that 11366 // declaration will be merged with this one. 11367 // 11368 // A project should have a declaration like this: 11369 // 11370 // interface GlobalProps { 11371 // // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type 11372 // // of `ctx.exports`. 11373 // mainModule: typeof import("my-main-module"); 11374 // 11375 // // Declares which of the main module's exports are configured with durable storage, and 11376 // // thus should behave as Durable Object namsepace bindings. 11377 // durableNamespaces: "MyDurableObject" | "AnotherDurableObject"; 11378 // } 11379 // 11380 // You can use `wrangler types` to generate `GlobalProps` automatically. 11381 interface GlobalProps { 11382 } 11383 // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not 11384 // present. 11385 type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default; 11386 // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the 11387 // `mainModule` property. 11388 type MainModule = GlobalProp<"mainModule", {}>; 11389 // The type of ctx.exports, which contains loopback bindings for all top-level exports. 11390 type Exports = { 11391 [K in keyof MainModule]: LoopbackForExport<MainModule[K]> 11392 // If the export is listed in `durableNamespaces`, then it is also a 11393 // DurableObjectNamespace. 11394 & (K extends GlobalProp<"durableNamespaces", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {}); 11395 }; 11396} 11397declare namespace CloudflareWorkersModule { 11398 export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>; 11399 export const RpcStub: { 11400 new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>; 11401 }; 11402 export abstract class RpcTarget implements Rpc.RpcTargetBranded { 11403 [Rpc.__RPC_TARGET_BRAND]: never; 11404 } 11405 // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC 11406 export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded { 11407 [Rpc.__WORKER_ENTRYPOINT_BRAND]: never; 11408 protected ctx: ExecutionContext<Props>; 11409 protected env: Env; 11410 constructor(ctx: ExecutionContext, env: Env); 11411 email?(message: ForwardableEmailMessage): void | Promise<void>; 11412 fetch?(request: Request): Response | Promise<Response>; 11413 connect?(socket: Socket): void | Promise<void>; 11414 queue?(batch: MessageBatch<unknown>): void | Promise<void>; 11415 scheduled?(controller: ScheduledController): void | Promise<void>; 11416 tail?(events: TraceItem[]): void | Promise<void>; 11417 tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>; 11418 test?(controller: TestController): void | Promise<void>; 11419 trace?(traces: TraceItem[]): void | Promise<void>; 11420 } 11421 export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded { 11422 [Rpc.__DURABLE_OBJECT_BRAND]: never; 11423 protected ctx: DurableObjectState<Props>; 11424 protected env: Env; 11425 constructor(ctx: DurableObjectState, env: Env); 11426 alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>; 11427 fetch?(request: Request): Response | Promise<Response>; 11428 connect?(socket: Socket): void | Promise<void>; 11429 webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>; 11430 webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>; 11431 webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>; 11432 } 11433 export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; 11434 export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number; 11435 export type WorkflowDelayDuration = WorkflowSleepDuration; 11436 export type WorkflowTimeoutDuration = WorkflowSleepDuration; 11437 export type WorkflowRetentionDuration = WorkflowSleepDuration; 11438 export type WorkflowBackoff = 'constant' | 'linear' | 'exponential'; 11439 export type WorkflowStepConfig = { 11440 retries?: { 11441 limit: number; 11442 delay: WorkflowDelayDuration | number; 11443 backoff?: WorkflowBackoff; 11444 }; 11445 timeout?: WorkflowTimeoutDuration | number; 11446 }; 11447 export type WorkflowEvent<T> = { 11448 payload: Readonly<T>; 11449 timestamp: Date; 11450 instanceId: string; 11451 }; 11452 export type WorkflowStepEvent<T> = { 11453 payload: Readonly<T>; 11454 timestamp: Date; 11455 type: string; 11456 }; 11457 export type WorkflowStepContext = { 11458 attempt: number; 11459 }; 11460 export abstract class WorkflowStep { 11461 do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>; 11462 do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>; 11463 sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>; 11464 sleepUntil: (name: string, timestamp: Date | number) => Promise<void>; 11465 waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: { 11466 type: string; 11467 timeout?: WorkflowTimeoutDuration | number; 11468 }): Promise<WorkflowStepEvent<T>>; 11469 } 11470 export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown'; 11471 export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded { 11472 [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never; 11473 protected ctx: ExecutionContext; 11474 protected env: Env; 11475 constructor(ctx: ExecutionContext, env: Env); 11476 run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>; 11477 } 11478 export function waitUntil(promise: Promise<unknown>): void; 11479 export function withEnv(newEnv: unknown, fn: () => unknown): unknown; 11480 export function withExports(newExports: unknown, fn: () => unknown): unknown; 11481 export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown; 11482 export const env: Cloudflare.Env; 11483 export const exports: Cloudflare.Exports; 11484} 11485declare module 'cloudflare:workers' { 11486 export = CloudflareWorkersModule; 11487} 11488interface SecretsStoreSecret { 11489 /** 11490 * Get a secret from the Secrets Store, returning a string of the secret value 11491 * if it exists, or throws an error if it does not exist 11492 */ 11493 get(): Promise<string>; 11494} 11495declare module "cloudflare:sockets" { 11496 function _connect(address: string | SocketAddress, options?: SocketOptions): Socket; 11497 export { _connect as connect }; 11498} 11499/** 11500 * Binding entrypoint for Cloudflare Stream. 11501 * 11502 * Usage: 11503 * - Binding-level operations: 11504 * `await env.STREAM.videos.upload` 11505 * `await env.STREAM.videos.createDirectUpload` 11506 * `await env.STREAM.videos.*` 11507 * `await env.STREAM.watermarks.*` 11508 * - Per-video operations: 11509 * `await env.STREAM.video(id).downloads.*` 11510 * `await env.STREAM.video(id).captions.*` 11511 * 11512 * Example usage: 11513 * ```ts 11514 * await env.STREAM.video(id).downloads.generate(); 11515 * 11516 * const video = env.STREAM.video(id) 11517 * const captions = video.captions.list(); 11518 * const videoDetails = video.details() 11519 * ``` 11520 */ 11521interface StreamBinding { 11522 /** 11523 * Returns a handle scoped to a single video for per-video operations. 11524 * @param id The unique identifier for the video. 11525 * @returns A handle for per-video operations. 11526 */ 11527 video(id: string): StreamVideoHandle; 11528 /** 11529 * Uploads a new video from a provided URL. 11530 * @param url The URL to upload from. 11531 * @param params Optional upload parameters. 11532 * @returns The uploaded video details. 11533 * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid 11534 * @throws {QuotaReachedError} if the account storage capacity is exceeded 11535 * @throws {MaxFileSizeError} if the file size is too large 11536 * @throws {RateLimitedError} if the server received too many requests 11537 * @throws {AlreadyUploadedError} if a video was already uploaded to this URL 11538 * @throws {InternalError} if an unexpected error occurs 11539 */ 11540 upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>; 11541 /** 11542 * Creates a direct upload that allows video uploads without an API key. 11543 * @param params Parameters for the direct upload 11544 * @returns The direct upload details. 11545 * @throws {BadRequestError} if the parameters are invalid 11546 * @throws {RateLimitedError} if the server received too many requests 11547 * @throws {InternalError} if an unexpected error occurs 11548 */ 11549 createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>; 11550 videos: StreamVideos; 11551 watermarks: StreamWatermarks; 11552} 11553/** 11554 * Handle for operations scoped to a single Stream video. 11555 */ 11556interface StreamVideoHandle { 11557 /** 11558 * The unique identifier for the video. 11559 */ 11560 id: string; 11561 /** 11562 * Get a full videos details 11563 * @returns The full video details. 11564 * @throws {NotFoundError} if the video is not found 11565 * @throws {InternalError} if an unexpected error occurs 11566 */ 11567 details(): Promise<StreamVideo>; 11568 /** 11569 * Update details for a single video. 11570 * @param params The fields to update for the video. 11571 * @returns The updated video details. 11572 * @throws {NotFoundError} if the video is not found 11573 * @throws {BadRequestError} if the parameters are invalid 11574 * @throws {InternalError} if an unexpected error occurs 11575 */ 11576 update(params: StreamUpdateVideoParams): Promise<StreamVideo>; 11577 /** 11578 * Deletes a video and its copies from Cloudflare Stream. 11579 * @returns A promise that resolves when deletion completes. 11580 * @throws {NotFoundError} if the video is not found 11581 * @throws {InternalError} if an unexpected error occurs 11582 */ 11583 delete(): Promise<void>; 11584 /** 11585 * Creates a signed URL token for a video. 11586 * @returns The signed token that was created. 11587 * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed 11588 */ 11589 generateToken(): Promise<string>; 11590 downloads: StreamScopedDownloads; 11591 captions: StreamScopedCaptions; 11592} 11593interface StreamVideo { 11594 /** 11595 * The unique identifier for the video. 11596 */ 11597 id: string; 11598 /** 11599 * A user-defined identifier for the media creator. 11600 */ 11601 creator: string | null; 11602 /** 11603 * The thumbnail URL for the video. 11604 */ 11605 thumbnail: string; 11606 /** 11607 * The thumbnail timestamp percentage. 11608 */ 11609 thumbnailTimestampPct: number; 11610 /** 11611 * Indicates whether the video is ready to stream. 11612 */ 11613 readyToStream: boolean; 11614 /** 11615 * The date and time the video became ready to stream. 11616 */ 11617 readyToStreamAt: string | null; 11618 /** 11619 * Processing status information. 11620 */ 11621 status: StreamVideoStatus; 11622 /** 11623 * A user modifiable key-value store. 11624 */ 11625 meta: Record<string, string>; 11626 /** 11627 * The date and time the video was created. 11628 */ 11629 created: string; 11630 /** 11631 * The date and time the video was last modified. 11632 */ 11633 modified: string; 11634 /** 11635 * The date and time at which the video will be deleted. 11636 */ 11637 scheduledDeletion: string | null; 11638 /** 11639 * The size of the video in bytes. 11640 */ 11641 size: number; 11642 /** 11643 * The preview URL for the video. 11644 */ 11645 preview?: string; 11646 /** 11647 * Origins allowed to display the video. 11648 */ 11649 allowedOrigins: Array<string>; 11650 /** 11651 * Indicates whether signed URLs are required. 11652 */ 11653 requireSignedURLs: boolean | null; 11654 /** 11655 * The date and time the video was uploaded. 11656 */ 11657 uploaded: string | null; 11658 /** 11659 * The date and time when the upload URL expires. 11660 */ 11661 uploadExpiry: string | null; 11662 /** 11663 * The maximum size in bytes for direct uploads. 11664 */ 11665 maxSizeBytes: number | null; 11666 /** 11667 * The maximum duration in seconds for direct uploads. 11668 */ 11669 maxDurationSeconds: number | null; 11670 /** 11671 * The video duration in seconds. -1 indicates unknown. 11672 */ 11673 duration: number; 11674 /** 11675 * Input metadata for the original upload. 11676 */ 11677 input: StreamVideoInput; 11678 /** 11679 * Playback URLs for the video. 11680 */ 11681 hlsPlaybackUrl: string; 11682 dashPlaybackUrl: string; 11683 /** 11684 * The watermark applied to the video, if any. 11685 */ 11686 watermark: StreamWatermark | null; 11687 /** 11688 * The live input id associated with the video, if any. 11689 */ 11690 liveInputId?: string | null; 11691 /** 11692 * The source video id if this is a clip. 11693 */ 11694 clippedFromId: string | null; 11695 /** 11696 * Public details associated with the video. 11697 */ 11698 publicDetails: StreamPublicDetails | null; 11699} 11700type StreamVideoStatus = { 11701 /** 11702 * The current processing state. 11703 */ 11704 state: string; 11705 /** 11706 * The current processing step. 11707 */ 11708 step?: string; 11709 /** 11710 * The percent complete as a string. 11711 */ 11712 pctComplete?: string; 11713 /** 11714 * An error reason code, if applicable. 11715 */ 11716 errorReasonCode: string; 11717 /** 11718 * An error reason text, if applicable. 11719 */ 11720 errorReasonText: string; 11721}; 11722type StreamVideoInput = { 11723 /** 11724 * The input width in pixels. 11725 */ 11726 width: number; 11727 /** 11728 * The input height in pixels. 11729 */ 11730 height: number; 11731}; 11732type StreamPublicDetails = { 11733 /** 11734 * The public title for the video. 11735 */ 11736 title: string | null; 11737 /** 11738 * The public share link. 11739 */ 11740 share_link: string | null; 11741 /** 11742 * The public channel link. 11743 */ 11744 channel_link: string | null; 11745 /** 11746 * The public logo URL. 11747 */ 11748 logo: string | null; 11749}; 11750type StreamDirectUpload = { 11751 /** 11752 * The URL an unauthenticated upload can use for a single multipart request. 11753 */ 11754 uploadURL: string; 11755 /** 11756 * A Cloudflare-generated unique identifier for a media item. 11757 */ 11758 id: string; 11759 /** 11760 * The watermark profile applied to the upload. 11761 */ 11762 watermark: StreamWatermark | null; 11763 /** 11764 * The scheduled deletion time, if any. 11765 */ 11766 scheduledDeletion: string | null; 11767}; 11768type StreamDirectUploadCreateParams = { 11769 /** 11770 * The maximum duration in seconds for a video upload. 11771 */ 11772 maxDurationSeconds: number; 11773 /** 11774 * The date and time after upload when videos will not be accepted. 11775 */ 11776 expiry?: string; 11777 /** 11778 * A user-defined identifier for the media creator. 11779 */ 11780 creator?: string; 11781 /** 11782 * A user modifiable key-value store used to reference other systems of record for 11783 * managing videos. 11784 */ 11785 meta?: Record<string, string>; 11786 /** 11787 * Lists the origins allowed to display the video. 11788 */ 11789 allowedOrigins?: Array<string>; 11790 /** 11791 * Indicates whether the video can be accessed using the id. When set to `true`, 11792 * a signed token must be generated with a signing key to view the video. 11793 */ 11794 requireSignedURLs?: boolean; 11795 /** 11796 * The thumbnail timestamp percentage. 11797 */ 11798 thumbnailTimestampPct?: number; 11799 /** 11800 * The date and time at which the video will be deleted. Include `null` to remove 11801 * a scheduled deletion. 11802 */ 11803 scheduledDeletion?: string | null; 11804 /** 11805 * The watermark profile to apply. 11806 */ 11807 watermark?: StreamDirectUploadWatermark; 11808}; 11809type StreamDirectUploadWatermark = { 11810 /** 11811 * The unique identifier for the watermark profile. 11812 */ 11813 id: string; 11814}; 11815type StreamUrlUploadParams = { 11816 /** 11817 * Lists the origins allowed to display the video. Enter allowed origin 11818 * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the 11819 * video to be viewed on any origin. 11820 */ 11821 allowedOrigins?: Array<string>; 11822 /** 11823 * A user-defined identifier for the media creator. 11824 */ 11825 creator?: string; 11826 /** 11827 * A user modifiable key-value store used to reference other systems of 11828 * record for managing videos. 11829 */ 11830 meta?: Record<string, string>; 11831 /** 11832 * Indicates whether the video can be a accessed using the id. When 11833 * set to `true`, a signed token must be generated with a signing key to view the 11834 * video. 11835 */ 11836 requireSignedURLs?: boolean; 11837 /** 11838 * Indicates the date and time at which the video will be deleted. Omit 11839 * the field to indicate no change, or include with a `null` value to remove an 11840 * existing scheduled deletion. If specified, must be at least 30 days from upload 11841 * time. 11842 */ 11843 scheduledDeletion?: string | null; 11844 /** 11845 * The timestamp for a thumbnail image calculated as a percentage value 11846 * of the video's duration. To convert from a second-wise timestamp to a 11847 * percentage, divide the desired timestamp by the total duration of the video. If 11848 * this value is not set, the default thumbnail image is taken from 0s of the 11849 * video. 11850 */ 11851 thumbnailTimestampPct?: number; 11852 /** 11853 * The identifier for the watermark profile 11854 */ 11855 watermarkId?: string; 11856}; 11857interface StreamScopedCaptions { 11858 /** 11859 * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language. 11860 * One caption or subtitle file per language is allowed. 11861 * @param language The BCP 47 language tag for the caption or subtitle. 11862 * @param input The caption or subtitle stream to upload. 11863 * @returns The created caption entry. 11864 * @throws {NotFoundError} if the video is not found 11865 * @throws {BadRequestError} if the language or file is invalid 11866 * @throws {InternalError} if an unexpected error occurs 11867 */ 11868 upload(language: string, input: ReadableStream): Promise<StreamCaption>; 11869 /** 11870 * Generate captions or subtitles for the provided language via AI. 11871 * @param language The BCP 47 language tag to generate. 11872 * @returns The generated caption entry. 11873 * @throws {NotFoundError} if the video is not found 11874 * @throws {BadRequestError} if the language is invalid 11875 * @throws {StreamError} if a generated caption already exists 11876 * @throws {StreamError} if the video duration is too long 11877 * @throws {StreamError} if the video is missing audio 11878 * @throws {StreamError} if the requested language is not supported 11879 * @throws {InternalError} if an unexpected error occurs 11880 */ 11881 generate(language: string): Promise<StreamCaption>; 11882 /** 11883 * Lists the captions or subtitles. 11884 * Use the language parameter to filter by a specific language. 11885 * @param language The optional BCP 47 language tag to filter by. 11886 * @returns The list of captions or subtitles. 11887 * @throws {NotFoundError} if the video or caption is not found 11888 * @throws {InternalError} if an unexpected error occurs 11889 */ 11890 list(language?: string): Promise<StreamCaption[]>; 11891 /** 11892 * Removes the captions or subtitles from a video. 11893 * @param language The BCP 47 language tag to remove. 11894 * @returns A promise that resolves when deletion completes. 11895 * @throws {NotFoundError} if the video or caption is not found 11896 * @throws {InternalError} if an unexpected error occurs 11897 */ 11898 delete(language: string): Promise<void>; 11899} 11900interface StreamScopedDownloads { 11901 /** 11902 * Generates a download for a video when a video is ready to view. Available 11903 * types are `default` and `audio`. Defaults to `default` when omitted. 11904 * @param downloadType The download type to create. 11905 * @returns The current downloads for the video. 11906 * @throws {NotFoundError} if the video is not found 11907 * @throws {BadRequestError} if the download type is invalid 11908 * @throws {StreamError} if the video duration is too long to generate a download 11909 * @throws {StreamError} if the video is not ready to stream 11910 * @throws {InternalError} if an unexpected error occurs 11911 */ 11912 generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>; 11913 /** 11914 * Lists the downloads created for a video. 11915 * @returns The current downloads for the video. 11916 * @throws {NotFoundError} if the video or downloads are not found 11917 * @throws {InternalError} if an unexpected error occurs 11918 */ 11919 get(): Promise<StreamDownloadGetResponse>; 11920 /** 11921 * Delete the downloads for a video. Available types are `default` and `audio`. 11922 * Defaults to `default` when omitted. 11923 * @param downloadType The download type to delete. 11924 * @returns A promise that resolves when deletion completes. 11925 * @throws {NotFoundError} if the video or downloads are not found 11926 * @throws {InternalError} if an unexpected error occurs 11927 */ 11928 delete(downloadType?: StreamDownloadType): Promise<void>; 11929} 11930interface StreamVideos { 11931 /** 11932 * Lists all videos in a users account. 11933 * @returns The list of videos. 11934 * @throws {BadRequestError} if the parameters are invalid 11935 * @throws {InternalError} if an unexpected error occurs 11936 */ 11937 list(params?: StreamVideosListParams): Promise<StreamVideo[]>; 11938} 11939interface StreamWatermarks { 11940 /** 11941 * Generate a new watermark profile 11942 * @param input The image stream to upload 11943 * @param params The watermark creation parameters. 11944 * @returns The created watermark profile. 11945 * @throws {BadRequestError} if the parameters are invalid 11946 * @throws {InvalidURLError} if the URL is invalid 11947 * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached 11948 * @throws {InternalError} if an unexpected error occurs 11949 */ 11950 generate(input: ReadableStream, params: StreamWatermarkCreateParams): Promise<StreamWatermark>; 11951 /** 11952 * Generate a new watermark profile 11953 * @param url The image url to upload 11954 * @param params The watermark creation parameters. 11955 * @returns The created watermark profile. 11956 * @throws {BadRequestError} if the parameters are invalid 11957 * @throws {InvalidURLError} if the URL is invalid 11958 * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached 11959 * @throws {InternalError} if an unexpected error occurs 11960 */ 11961 generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>; 11962 /** 11963 * Lists all watermark profiles for an account. 11964 * @returns The list of watermark profiles. 11965 * @throws {InternalError} if an unexpected error occurs 11966 */ 11967 list(): Promise<StreamWatermark[]>; 11968 /** 11969 * Retrieves details for a single watermark profile. 11970 * @param watermarkId The watermark profile identifier. 11971 * @returns The watermark profile details. 11972 * @throws {NotFoundError} if the watermark is not found 11973 * @throws {InternalError} if an unexpected error occurs 11974 */ 11975 get(watermarkId: string): Promise<StreamWatermark>; 11976 /** 11977 * Deletes a watermark profile. 11978 * @param watermarkId The watermark profile identifier. 11979 * @returns A promise that resolves when deletion completes. 11980 * @throws {NotFoundError} if the watermark is not found 11981 * @throws {InternalError} if an unexpected error occurs 11982 */ 11983 delete(watermarkId: string): Promise<void>; 11984} 11985type StreamUpdateVideoParams = { 11986 /** 11987 * Lists the origins allowed to display the video. Enter allowed origin 11988 * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the 11989 * video to be viewed on any origin. 11990 */ 11991 allowedOrigins?: Array<string>; 11992 /** 11993 * A user-defined identifier for the media creator. 11994 */ 11995 creator?: string; 11996 /** 11997 * The maximum duration in seconds for a video upload. Can be set for a 11998 * video that is not yet uploaded to limit its duration. Uploads that exceed the 11999 * specified duration will fail during processing. A value of `-1` means the value 12000 * is unknown. 12001 */ 12002 maxDurationSeconds?: number; 12003 /** 12004 * A user modifiable key-value store used to reference other systems of 12005 * record for managing videos. 12006 */ 12007 meta?: Record<string, string>; 12008 /** 12009 * Indicates whether the video can be a accessed using the id. When 12010 * set to `true`, a signed token must be generated with a signing key to view the 12011 * video. 12012 */ 12013 requireSignedURLs?: boolean; 12014 /** 12015 * Indicates the date and time at which the video will be deleted. Omit 12016 * the field to indicate no change, or include with a `null` value to remove an 12017 * existing scheduled deletion. If specified, must be at least 30 days from upload 12018 * time. 12019 */ 12020 scheduledDeletion?: string | null; 12021 /** 12022 * The timestamp for a thumbnail image calculated as a percentage value 12023 * of the video's duration. To convert from a second-wise timestamp to a 12024 * percentage, divide the desired timestamp by the total duration of the video. If 12025 * this value is not set, the default thumbnail image is taken from 0s of the 12026 * video. 12027 */ 12028 thumbnailTimestampPct?: number; 12029}; 12030type StreamCaption = { 12031 /** 12032 * Whether the caption was generated via AI. 12033 */ 12034 generated?: boolean; 12035 /** 12036 * The language label displayed in the native language to users. 12037 */ 12038 label: string; 12039 /** 12040 * The language tag in BCP 47 format. 12041 */ 12042 language: string; 12043 /** 12044 * The status of a generated caption. 12045 */ 12046 status?: 'ready' | 'inprogress' | 'error'; 12047}; 12048type StreamDownloadStatus = 'ready' | 'inprogress' | 'error'; 12049type StreamDownloadType = 'default' | 'audio'; 12050type StreamDownload = { 12051 /** 12052 * Indicates the progress as a percentage between 0 and 100. 12053 */ 12054 percentComplete: number; 12055 /** 12056 * The status of a generated download. 12057 */ 12058 status: StreamDownloadStatus; 12059 /** 12060 * The URL to access the generated download. 12061 */ 12062 url?: string; 12063}; 12064/** 12065 * An object with download type keys. Each key is optional and only present if that 12066 * download type has been created. 12067 */ 12068type StreamDownloadGetResponse = { 12069 /** 12070 * The audio-only download. Only present if this download type has been created. 12071 */ 12072 audio?: StreamDownload; 12073 /** 12074 * The default video download. Only present if this download type has been created. 12075 */ 12076 default?: StreamDownload; 12077}; 12078type StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center'; 12079type StreamWatermark = { 12080 /** 12081 * The unique identifier for a watermark profile. 12082 */ 12083 id: string; 12084 /** 12085 * The size of the image in bytes. 12086 */ 12087 size: number; 12088 /** 12089 * The height of the image in pixels. 12090 */ 12091 height: number; 12092 /** 12093 * The width of the image in pixels. 12094 */ 12095 width: number; 12096 /** 12097 * The date and a time a watermark profile was created. 12098 */ 12099 created: string; 12100 /** 12101 * The source URL for a downloaded image. If the watermark profile was created via 12102 * direct upload, this field is null. 12103 */ 12104 downloadedFrom: string | null; 12105 /** 12106 * A short description of the watermark profile. 12107 */ 12108 name: string; 12109 /** 12110 * The translucency of the image. A value of `0.0` makes the image completely 12111 * transparent, and `1.0` makes the image completely opaque. Note that if the image 12112 * is already semi-transparent, setting this to `1.0` will not make the image 12113 * completely opaque. 12114 */ 12115 opacity: number; 12116 /** 12117 * The whitespace between the adjacent edges (determined by position) of the video 12118 * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded 12119 * video width or length, as determined by the algorithm. 12120 */ 12121 padding: number; 12122 /** 12123 * The size of the image relative to the overall size of the video. This parameter 12124 * will adapt to horizontal and vertical videos automatically. `0.0` indicates no 12125 * scaling (use the size of the image as-is), and `1.0 `fills the entire video. 12126 */ 12127 scale: number; 12128 /** 12129 * The location of the image. Valid positions are: `upperRight`, `upperLeft`, 12130 * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the 12131 * `padding` parameter. 12132 */ 12133 position: StreamWatermarkPosition; 12134}; 12135type StreamWatermarkCreateParams = { 12136 /** 12137 * A short description of the watermark profile. 12138 */ 12139 name?: string; 12140 /** 12141 * The translucency of the image. A value of `0.0` makes the image completely 12142 * transparent, and `1.0` makes the image completely opaque. Note that if the 12143 * image is already semi-transparent, setting this to `1.0` will not make the 12144 * image completely opaque. 12145 */ 12146 opacity?: number; 12147 /** 12148 * The whitespace between the adjacent edges (determined by position) of the 12149 * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully 12150 * padded video width or length, as determined by the algorithm. 12151 */ 12152 padding?: number; 12153 /** 12154 * The size of the image relative to the overall size of the video. This 12155 * parameter will adapt to horizontal and vertical videos automatically. `0.0` 12156 * indicates no scaling (use the size of the image as-is), and `1.0 `fills the 12157 * entire video. 12158 */ 12159 scale?: number; 12160 /** 12161 * The location of the image. 12162 */ 12163 position?: StreamWatermarkPosition; 12164}; 12165type StreamVideosListParams = { 12166 /** 12167 * The maximum number of videos to return. 12168 */ 12169 limit?: number; 12170 /** 12171 * Return videos created before this timestamp. 12172 * (RFC3339/RFC3339Nano) 12173 */ 12174 before?: string; 12175 /** 12176 * Comparison operator for the `before` field. 12177 * @default 'lt' 12178 */ 12179 beforeComp?: StreamPaginationComparison; 12180 /** 12181 * Return videos created after this timestamp. 12182 * (RFC3339/RFC3339Nano) 12183 */ 12184 after?: string; 12185 /** 12186 * Comparison operator for the `after` field. 12187 * @default 'gte' 12188 */ 12189 afterComp?: StreamPaginationComparison; 12190}; 12191type StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte'; 12192/** 12193 * Error object for Stream binding operations. 12194 */ 12195interface StreamError extends Error { 12196 readonly code: number; 12197 readonly statusCode: number; 12198 readonly message: string; 12199 readonly stack?: string; 12200} 12201interface InternalError extends StreamError { 12202 name: 'InternalError'; 12203} 12204interface BadRequestError extends StreamError { 12205 name: 'BadRequestError'; 12206} 12207interface NotFoundError extends StreamError { 12208 name: 'NotFoundError'; 12209} 12210interface ForbiddenError extends StreamError { 12211 name: 'ForbiddenError'; 12212} 12213interface RateLimitedError extends StreamError { 12214 name: 'RateLimitedError'; 12215} 12216interface QuotaReachedError extends StreamError { 12217 name: 'QuotaReachedError'; 12218} 12219interface MaxFileSizeError extends StreamError { 12220 name: 'MaxFileSizeError'; 12221} 12222interface InvalidURLError extends StreamError { 12223 name: 'InvalidURLError'; 12224} 12225interface AlreadyUploadedError extends StreamError { 12226 name: 'AlreadyUploadedError'; 12227} 12228interface TooManyWatermarksError extends StreamError { 12229 name: 'TooManyWatermarksError'; 12230} 12231type MarkdownDocument = { 12232 name: string; 12233 blob: Blob; 12234}; 12235type ConversionResponse = { 12236 id: string; 12237 name: string; 12238 mimeType: string; 12239 format: 'markdown'; 12240 tokens: number; 12241 data: string; 12242} | { 12243 id: string; 12244 name: string; 12245 mimeType: string; 12246 format: 'error'; 12247 error: string; 12248}; 12249type ImageConversionOptions = { 12250 descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de'; 12251}; 12252type EmbeddedImageConversionOptions = ImageConversionOptions & { 12253 convert?: boolean; 12254 maxConvertedImages?: number; 12255}; 12256type ConversionOptions = { 12257 html?: { 12258 images?: EmbeddedImageConversionOptions & { 12259 convertOGImage?: boolean; 12260 }; 12261 hostname?: string; 12262 cssSelector?: string; 12263 }; 12264 docx?: { 12265 images?: EmbeddedImageConversionOptions; 12266 }; 12267 image?: ImageConversionOptions; 12268 pdf?: { 12269 images?: EmbeddedImageConversionOptions; 12270 metadata?: boolean; 12271 }; 12272}; 12273type ConversionRequestOptions = { 12274 gateway?: GatewayOptions; 12275 extraHeaders?: object; 12276 conversionOptions?: ConversionOptions; 12277}; 12278type SupportedFileFormat = { 12279 mimeType: string; 12280 extension: string; 12281}; 12282declare abstract class ToMarkdownService { 12283 transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>; 12284 transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>; 12285 supported(): Promise<SupportedFileFormat[]>; 12286} 12287declare namespace TailStream { 12288 interface Header { 12289 readonly name: string; 12290 readonly value: string; 12291 } 12292 interface FetchEventInfo { 12293 readonly type: "fetch"; 12294 readonly method: string; 12295 readonly url: string; 12296 readonly cfJson?: object; 12297 readonly headers: Header[]; 12298 } 12299 interface JsRpcEventInfo { 12300 readonly type: "jsrpc"; 12301 } 12302 interface ScheduledEventInfo { 12303 readonly type: "scheduled"; 12304 readonly scheduledTime: Date; 12305 readonly cron: string; 12306 } 12307 interface AlarmEventInfo { 12308 readonly type: "alarm"; 12309 readonly scheduledTime: Date; 12310 } 12311 interface QueueEventInfo { 12312 readonly type: "queue"; 12313 readonly queueName: string; 12314 readonly batchSize: number; 12315 } 12316 interface EmailEventInfo { 12317 readonly type: "email"; 12318 readonly mailFrom: string; 12319 readonly rcptTo: string; 12320 readonly rawSize: number; 12321 } 12322 interface TraceEventInfo { 12323 readonly type: "trace"; 12324 readonly traces: (string | null)[]; 12325 } 12326 interface HibernatableWebSocketEventInfoMessage { 12327 readonly type: "message"; 12328 } 12329 interface HibernatableWebSocketEventInfoError { 12330 readonly type: "error"; 12331 } 12332 interface HibernatableWebSocketEventInfoClose { 12333 readonly type: "close"; 12334 readonly code: number; 12335 readonly wasClean: boolean; 12336 } 12337 interface HibernatableWebSocketEventInfo { 12338 readonly type: "hibernatableWebSocket"; 12339 readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage; 12340 } 12341 interface CustomEventInfo { 12342 readonly type: "custom"; 12343 } 12344 interface FetchResponseInfo { 12345 readonly type: "fetch"; 12346 readonly statusCode: number; 12347 } 12348 interface ConnectEventInfo { 12349 readonly type: "connect"; 12350 } 12351 type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound"; 12352 interface ScriptVersion { 12353 readonly id: string; 12354 readonly tag?: string; 12355 readonly message?: string; 12356 } 12357 interface Onset { 12358 readonly type: "onset"; 12359 readonly attributes: Attribute[]; 12360 // id for the span being opened by this Onset event. 12361 readonly spanId: string; 12362 readonly dispatchNamespace?: string; 12363 readonly entrypoint?: string; 12364 readonly executionModel: string; 12365 readonly scriptName?: string; 12366 readonly scriptTags?: string[]; 12367 readonly scriptVersion?: ScriptVersion; 12368 readonly info: FetchEventInfo | ConnectEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo; 12369 } 12370 interface Outcome { 12371 readonly type: "outcome"; 12372 readonly outcome: EventOutcome; 12373 readonly cpuTime: number; 12374 readonly wallTime: number; 12375 } 12376 interface SpanOpen { 12377 readonly type: "spanOpen"; 12378 readonly name: string; 12379 // id for the span being opened by this SpanOpen event. 12380 readonly spanId: string; 12381 readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes; 12382 } 12383 interface SpanClose { 12384 readonly type: "spanClose"; 12385 readonly outcome: EventOutcome; 12386 } 12387 interface DiagnosticChannelEvent { 12388 readonly type: "diagnosticChannel"; 12389 readonly channel: string; 12390 readonly message: any; 12391 } 12392 interface Exception { 12393 readonly type: "exception"; 12394 readonly name: string; 12395 readonly message: string; 12396 readonly stack?: string; 12397 } 12398 interface Log { 12399 readonly type: "log"; 12400 readonly level: "debug" | "error" | "info" | "log" | "warn"; 12401 readonly message: object; 12402 } 12403 interface DroppedEventsDiagnostic { 12404 readonly diagnosticsType: "droppedEvents"; 12405 readonly count: number; 12406 } 12407 interface StreamDiagnostic { 12408 readonly type: 'streamDiagnostic'; 12409 // To add new diagnostic types, define a new interface and add it to this union type. 12410 readonly diagnostic: DroppedEventsDiagnostic; 12411 } 12412 // This marks the worker handler return information. 12413 // This is separate from Outcome because the worker invocation can live for a long time after 12414 // returning. For example - Websockets that return an http upgrade response but then continue 12415 // streaming information or SSE http connections. 12416 interface Return { 12417 readonly type: "return"; 12418 readonly info?: FetchResponseInfo; 12419 } 12420 interface Attribute { 12421 readonly name: string; 12422 readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[]; 12423 } 12424 interface Attributes { 12425 readonly type: "attributes"; 12426 readonly info: Attribute[]; 12427 } 12428 type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes; 12429 // Context in which this trace event lives. 12430 interface SpanContext { 12431 // Single id for the entire top-level invocation 12432 // This should be a new traceId for the first worker stage invoked in the eyeball request and then 12433 // same-account service-bindings should reuse the same traceId but cross-account service-bindings 12434 // should use a new traceId. 12435 readonly traceId: string; 12436 // spanId in which this event is handled 12437 // for Onset and SpanOpen events this would be the parent span id 12438 // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events 12439 // For Hibernate and Mark this would be the span under which they were emitted. 12440 // spanId is not set ONLY if: 12441 // 1. This is an Onset event 12442 // 2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation) 12443 readonly spanId?: string; 12444 } 12445 interface TailEvent<Event extends EventType> { 12446 // invocation id of the currently invoked worker stage. 12447 // invocation id will always be unique to every Onset event and will be the same until the Outcome event. 12448 readonly invocationId: string; 12449 // Inherited spanContext for this event. 12450 readonly spanContext: SpanContext; 12451 readonly timestamp: Date; 12452 readonly sequence: number; 12453 readonly event: Event; 12454 } 12455 type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>; 12456 type TailEventHandlerObject = { 12457 outcome?: TailEventHandler<Outcome>; 12458 spanOpen?: TailEventHandler<SpanOpen>; 12459 spanClose?: TailEventHandler<SpanClose>; 12460 diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>; 12461 exception?: TailEventHandler<Exception>; 12462 log?: TailEventHandler<Log>; 12463 return?: TailEventHandler<Return>; 12464 attributes?: TailEventHandler<Attributes>; 12465 }; 12466 type TailEventHandlerType = TailEventHandler | TailEventHandlerObject; 12467} 12468// Copyright (c) 2022-2023 Cloudflare, Inc. 12469// Licensed under the Apache 2.0 license found in the LICENSE file or at: 12470// https://opensource.org/licenses/Apache-2.0 12471/** 12472 * Data types supported for holding vector metadata. 12473 */ 12474type VectorizeVectorMetadataValue = string | number | boolean | string[]; 12475/** 12476 * Additional information to associate with a vector. 12477 */ 12478type VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>; 12479type VectorFloatArray = Float32Array | Float64Array; 12480interface VectorizeError { 12481 code?: number; 12482 error: string; 12483} 12484/** 12485 * Comparison logic/operation to use for metadata filtering. 12486 * 12487 * This list is expected to grow as support for more operations are released. 12488 */ 12489type VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte'; 12490type VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin'; 12491/** 12492 * Filter criteria for vector metadata used to limit the retrieved query result set. 12493 */ 12494type VectorizeVectorMetadataFilter = { 12495 [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | { 12496 [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null; 12497 } | { 12498 [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[]; 12499 }; 12500}; 12501/** 12502 * Supported distance metrics for an index. 12503 * Distance metrics determine how other "similar" vectors are determined. 12504 */ 12505type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product"; 12506/** 12507 * Metadata return levels for a Vectorize query. 12508 * 12509 * Default to "none". 12510 * 12511 * @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. 12512 * @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). 12513 * @property none No indexed metadata will be returned. 12514 */ 12515type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none"; 12516interface VectorizeQueryOptions { 12517 topK?: number; 12518 namespace?: string; 12519 returnValues?: boolean; 12520 returnMetadata?: boolean | VectorizeMetadataRetrievalLevel; 12521 filter?: VectorizeVectorMetadataFilter; 12522} 12523/** 12524 * Information about the configuration of an index. 12525 */ 12526type VectorizeIndexConfig = { 12527 dimensions: number; 12528 metric: VectorizeDistanceMetric; 12529} | { 12530 preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity 12531}; 12532/** 12533 * Metadata about an existing index. 12534 * 12535 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released. 12536 * See {@link VectorizeIndexInfo} for its post-beta equivalent. 12537 */ 12538interface VectorizeIndexDetails { 12539 /** The unique ID of the index */ 12540 readonly id: string; 12541 /** The name of the index. */ 12542 name: string; 12543 /** (optional) A human readable description for the index. */ 12544 description?: string; 12545 /** The index configuration, including the dimension size and distance metric. */ 12546 config: VectorizeIndexConfig; 12547 /** The number of records containing vectors within the index. */ 12548 vectorsCount: number; 12549} 12550/** 12551 * Metadata about an existing index. 12552 */ 12553interface VectorizeIndexInfo { 12554 /** The number of records containing vectors within the index. */ 12555 vectorCount: number; 12556 /** Number of dimensions the index has been configured for. */ 12557 dimensions: number; 12558 /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */ 12559 processedUpToDatetime: number; 12560 /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */ 12561 processedUpToMutation: number; 12562} 12563/** 12564 * Represents a single vector value set along with its associated metadata. 12565 */ 12566interface VectorizeVector { 12567 /** 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. */ 12568 id: string; 12569 /** The vector values */ 12570 values: VectorFloatArray | number[]; 12571 /** The namespace this vector belongs to. */ 12572 namespace?: string; 12573 /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */ 12574 metadata?: Record<string, VectorizeVectorMetadata>; 12575} 12576/** 12577 * Represents a matched vector for a query along with its score and (if specified) the matching vector information. 12578 */ 12579type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> & Omit<VectorizeVector, "values"> & { 12580 /** The score or rank for similarity, when returned as a result */ 12581 score: number; 12582}; 12583/** 12584 * A set of matching {@link VectorizeMatch} for a particular query. 12585 */ 12586interface VectorizeMatches { 12587 matches: VectorizeMatch[]; 12588 count: number; 12589} 12590/** 12591 * Results of an operation that performed a mutation on a set of vectors. 12592 * Here, `ids` is a list of vectors that were successfully processed. 12593 * 12594 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released. 12595 * See {@link VectorizeAsyncMutation} for its post-beta equivalent. 12596 */ 12597interface VectorizeVectorMutation { 12598 /* List of ids of vectors that were successfully processed. */ 12599 ids: string[]; 12600 /* Total count of the number of processed vectors. */ 12601 count: number; 12602} 12603/** 12604 * Result type indicating a mutation on the Vectorize Index. 12605 * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation. 12606 */ 12607interface VectorizeAsyncMutation { 12608 /** The unique identifier for the async mutation operation containing the changeset. */ 12609 mutationId: string; 12610} 12611/** 12612 * A Vectorize Vector Search Index for querying vectors/embeddings. 12613 * 12614 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released. 12615 * See {@link Vectorize} for its new implementation. 12616 */ 12617declare abstract class VectorizeIndex { 12618 /** 12619 * Get information about the currently bound index. 12620 * @returns A promise that resolves with information about the current index. 12621 */ 12622 public describe(): Promise<VectorizeIndexDetails>; 12623 /** 12624 * Use the provided vector to perform a similarity search across the index. 12625 * @param vector Input vector that will be used to drive the similarity search. 12626 * @param options Configuration options to massage the returned data. 12627 * @returns A promise that resolves with matched and scored vectors. 12628 */ 12629 public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>; 12630 /** 12631 * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown. 12632 * @param vectors List of vectors that will be inserted. 12633 * @returns A promise that resolves with the ids & count of records that were successfully processed. 12634 */ 12635 public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>; 12636 /** 12637 * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values. 12638 * @param vectors List of vectors that will be upserted. 12639 * @returns A promise that resolves with the ids & count of records that were successfully processed. 12640 */ 12641 public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>; 12642 /** 12643 * Delete a list of vectors with a matching id. 12644 * @param ids List of vector ids that should be deleted. 12645 * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted). 12646 */ 12647 public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>; 12648 /** 12649 * Get a list of vectors with a matching id. 12650 * @param ids List of vector ids that should be returned. 12651 * @returns A promise that resolves with the raw unscored vectors matching the id set. 12652 */ 12653 public getByIds(ids: string[]): Promise<VectorizeVector[]>; 12654} 12655/** 12656 * A Vectorize Vector Search Index for querying vectors/embeddings. 12657 * 12658 * Mutations in this version are async, returning a mutation id. 12659 */ 12660declare abstract class Vectorize { 12661 /** 12662 * Get information about the currently bound index. 12663 * @returns A promise that resolves with information about the current index. 12664 */ 12665 public describe(): Promise<VectorizeIndexInfo>; 12666 /** 12667 * Use the provided vector to perform a similarity search across the index. 12668 * @param vector Input vector that will be used to drive the similarity search. 12669 * @param options Configuration options to massage the returned data. 12670 * @returns A promise that resolves with matched and scored vectors. 12671 */ 12672 public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>; 12673 /** 12674 * Use the provided vector-id to perform a similarity search across the index. 12675 * @param vectorId Id for a vector in the index against which the index should be queried. 12676 * @param options Configuration options to massage the returned data. 12677 * @returns A promise that resolves with matched and scored vectors. 12678 */ 12679 public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>; 12680 /** 12681 * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown. 12682 * @param vectors List of vectors that will be inserted. 12683 * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset. 12684 */ 12685 public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>; 12686 /** 12687 * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values. 12688 * @param vectors List of vectors that will be upserted. 12689 * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset. 12690 */ 12691 public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>; 12692 /** 12693 * Delete a list of vectors with a matching id. 12694 * @param ids List of vector ids that should be deleted. 12695 * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset. 12696 */ 12697 public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>; 12698 /** 12699 * Get a list of vectors with a matching id. 12700 * @param ids List of vector ids that should be returned. 12701 * @returns A promise that resolves with the raw unscored vectors matching the id set. 12702 */ 12703 public getByIds(ids: string[]): Promise<VectorizeVector[]>; 12704} 12705/** 12706 * The interface for "version_metadata" binding 12707 * providing metadata about the Worker Version using this binding. 12708 */ 12709type WorkerVersionMetadata = { 12710 /** The ID of the Worker Version using this binding */ 12711 id: string; 12712 /** The tag of the Worker Version using this binding */ 12713 tag: string; 12714 /** The timestamp of when the Worker Version was uploaded */ 12715 timestamp: string; 12716}; 12717interface DynamicDispatchLimits { 12718 /** 12719 * Limit CPU time in milliseconds. 12720 */ 12721 cpuMs?: number; 12722 /** 12723 * Limit number of subrequests. 12724 */ 12725 subRequests?: number; 12726} 12727interface DynamicDispatchOptions { 12728 /** 12729 * Limit resources of invoked Worker script. 12730 */ 12731 limits?: DynamicDispatchLimits; 12732 /** 12733 * Arguments for outbound Worker script, if configured. 12734 */ 12735 outbound?: { 12736 [key: string]: any; 12737 }; 12738} 12739interface DispatchNamespace { 12740 /** 12741 * @param name Name of the Worker script. 12742 * @param args Arguments to Worker script. 12743 * @param options Options for Dynamic Dispatch invocation. 12744 * @returns A Fetcher object that allows you to send requests to the Worker script. 12745 * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown. 12746 */ 12747 get(name: string, args?: { 12748 [key: string]: any; 12749 }, options?: DynamicDispatchOptions): Fetcher; 12750} 12751declare module 'cloudflare:workflows' { 12752 /** 12753 * NonRetryableError allows for a user to throw a fatal error 12754 * that makes a Workflow instance fail immediately without triggering a retry 12755 */ 12756 export class NonRetryableError extends Error { 12757 public constructor(message: string, name?: string); 12758 } 12759} 12760declare abstract class Workflow<PARAMS = unknown> { 12761 /** 12762 * Get a handle to an existing instance of the Workflow. 12763 * @param id Id for the instance of this Workflow 12764 * @returns A promise that resolves with a handle for the Instance 12765 */ 12766 public get(id: string): Promise<WorkflowInstance>; 12767 /** 12768 * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown. 12769 * @param options Options when creating an instance including id and params 12770 * @returns A promise that resolves with a handle for the Instance 12771 */ 12772 public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>; 12773 /** 12774 * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown. 12775 * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached. 12776 * @param batch List of Options when creating an instance including name and params 12777 * @returns A promise that resolves with a list of handles for the created instances. 12778 */ 12779 public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>; 12780} 12781type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; 12782type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number; 12783type WorkflowRetentionDuration = WorkflowSleepDuration; 12784interface WorkflowInstanceCreateOptions<PARAMS = unknown> { 12785 /** 12786 * An id for your Workflow instance. Must be unique within the Workflow. 12787 */ 12788 id?: string; 12789 /** 12790 * The event payload the Workflow instance is triggered with 12791 */ 12792 params?: PARAMS; 12793 /** 12794 * The retention policy for Workflow instance. 12795 * Defaults to the maximum retention period available for the owner's account. 12796 */ 12797 retention?: { 12798 successRetention?: WorkflowRetentionDuration; 12799 errorRetention?: WorkflowRetentionDuration; 12800 }; 12801} 12802type InstanceStatus = { 12803 status: 'queued' // means that instance is waiting to be started (see concurrency limits) 12804 | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running 12805 | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish 12806 | 'waitingForPause' // instance is finishing the current work to pause 12807 | 'unknown'; 12808 error?: { 12809 name: string; 12810 message: string; 12811 }; 12812 output?: unknown; 12813}; 12814interface WorkflowError { 12815 code?: number; 12816 message: string; 12817} 12818declare abstract class WorkflowInstance { 12819 public id: string; 12820 /** 12821 * Pause the instance. 12822 */ 12823 public pause(): Promise<void>; 12824 /** 12825 * Resume the instance. If it is already running, an error will be thrown. 12826 */ 12827 public resume(): Promise<void>; 12828 /** 12829 * Terminate the instance. If it is errored, terminated or complete, an error will be thrown. 12830 */ 12831 public terminate(): Promise<void>; 12832 /** 12833 * Restart the instance. 12834 */ 12835 public restart(): Promise<void>; 12836 /** 12837 * Returns the current status of the instance. 12838 */ 12839 public status(): Promise<InstanceStatus>; 12840 /** 12841 * Send an event to this instance. 12842 */ 12843 public sendEvent({ type, payload, }: { 12844 type: string; 12845 payload: unknown; 12846 }): Promise<void>; 12847}