personal web client for Bluesky
typescript solidjs bluesky atcute
at trunk 411 kB view raw
1/* eslint-disable */ 2// Generated by Wrangler by running `wrangler types` (hash: eeaa8440f56ab30c6a4f65cb191015f2) 3// Runtime types generated with workerd@1.20251202.0 2025-08-16 4declare namespace Cloudflare { 5 interface GlobalProps { 6 mainModule: typeof import("./server/index"); 7 } 8 interface Env { 9 VITE_APP_NAME: string; 10 } 11} 12interface Env extends Cloudflare.Env {} 13 14// Begin runtime types 15/*! ***************************************************************************** 16Copyright (c) Cloudflare. All rights reserved. 17Copyright (c) Microsoft Corporation. All rights reserved. 18 19Licensed under the Apache License, Version 2.0 (the "License"); you may not use 20this file except in compliance with the License. You may obtain a copy of the 21License at http://www.apache.org/licenses/LICENSE-2.0 22THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 23KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 24WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 25MERCHANTABLITY OR NON-INFRINGEMENT. 26See the Apache Version 2.0 License for specific language governing permissions 27and limitations under the License. 28***************************************************************************** */ 29/* eslint-disable */ 30// noinspection JSUnusedGlobalSymbols 31declare var onmessage: never; 32/** 33 * 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. 34 * 35 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) 36 */ 37declare class DOMException extends Error { 38 constructor(message?: string, name?: string); 39 /** 40 * The **`message`** read-only property of the a message or description associated with the given error name. 41 * 42 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) 43 */ 44 readonly message: string; 45 /** 46 * The **`name`** read-only property of the one of the strings associated with an error name. 47 * 48 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) 49 */ 50 readonly name: string; 51 /** 52 * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match. 53 * @deprecated 54 * 55 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) 56 */ 57 readonly code: number; 58 static readonly INDEX_SIZE_ERR: number; 59 static readonly DOMSTRING_SIZE_ERR: number; 60 static readonly HIERARCHY_REQUEST_ERR: number; 61 static readonly WRONG_DOCUMENT_ERR: number; 62 static readonly INVALID_CHARACTER_ERR: number; 63 static readonly NO_DATA_ALLOWED_ERR: number; 64 static readonly NO_MODIFICATION_ALLOWED_ERR: number; 65 static readonly NOT_FOUND_ERR: number; 66 static readonly NOT_SUPPORTED_ERR: number; 67 static readonly INUSE_ATTRIBUTE_ERR: number; 68 static readonly INVALID_STATE_ERR: number; 69 static readonly SYNTAX_ERR: number; 70 static readonly INVALID_MODIFICATION_ERR: number; 71 static readonly NAMESPACE_ERR: number; 72 static readonly INVALID_ACCESS_ERR: number; 73 static readonly VALIDATION_ERR: number; 74 static readonly TYPE_MISMATCH_ERR: number; 75 static readonly SECURITY_ERR: number; 76 static readonly NETWORK_ERR: number; 77 static readonly ABORT_ERR: number; 78 static readonly URL_MISMATCH_ERR: number; 79 static readonly QUOTA_EXCEEDED_ERR: number; 80 static readonly TIMEOUT_ERR: number; 81 static readonly INVALID_NODE_TYPE_ERR: number; 82 static readonly DATA_CLONE_ERR: number; 83 get stack(): any; 84 set stack(value: any); 85} 86type WorkerGlobalScopeEventMap = { 87 fetch: FetchEvent; 88 scheduled: ScheduledEvent; 89 queue: QueueEvent; 90 unhandledrejection: PromiseRejectionEvent; 91 rejectionhandled: PromiseRejectionEvent; 92}; 93declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> { 94 EventTarget: typeof EventTarget; 95} 96/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). * 97 * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). 98 * 99 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) 100 */ 101interface Console { 102 "assert"(condition?: boolean, ...data: any[]): void; 103 /** 104 * The **`console.clear()`** static method clears the console if possible. 105 * 106 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) 107 */ 108 clear(): void; 109 /** 110 * The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called. 111 * 112 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) 113 */ 114 count(label?: string): void; 115 /** 116 * The **`console.countReset()`** static method resets counter used with console/count_static. 117 * 118 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) 119 */ 120 countReset(label?: string): void; 121 /** 122 * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level. 123 * 124 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) 125 */ 126 debug(...data: any[]): void; 127 /** 128 * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object. 129 * 130 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) 131 */ 132 dir(item?: any, options?: any): void; 133 /** 134 * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element. 135 * 136 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) 137 */ 138 dirxml(...data: any[]): void; 139 /** 140 * The **`console.error()`** static method outputs a message to the console at the 'error' log level. 141 * 142 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) 143 */ 144 error(...data: any[]): void; 145 /** 146 * 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. 147 * 148 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) 149 */ 150 group(...data: any[]): void; 151 /** 152 * The **`console.groupCollapsed()`** static method creates a new inline group in the console. 153 * 154 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) 155 */ 156 groupCollapsed(...data: any[]): void; 157 /** 158 * The **`console.groupEnd()`** static method exits the current inline group in the console. 159 * 160 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) 161 */ 162 groupEnd(): void; 163 /** 164 * The **`console.info()`** static method outputs a message to the console at the 'info' log level. 165 * 166 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) 167 */ 168 info(...data: any[]): void; 169 /** 170 * The **`console.log()`** static method outputs a message to the console. 171 * 172 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) 173 */ 174 log(...data: any[]): void; 175 /** 176 * The **`console.table()`** static method displays tabular data as a table. 177 * 178 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) 179 */ 180 table(tabularData?: any, properties?: string[]): void; 181 /** 182 * The **`console.time()`** static method starts a timer you can use to track how long an operation takes. 183 * 184 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) 185 */ 186 time(label?: string): void; 187 /** 188 * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static. 189 * 190 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) 191 */ 192 timeEnd(label?: string): void; 193 /** 194 * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static. 195 * 196 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) 197 */ 198 timeLog(label?: string, ...data: any[]): void; 199 timeStamp(label?: string): void; 200 /** 201 * The **`console.trace()`** static method outputs a stack trace to the console. 202 * 203 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) 204 */ 205 trace(...data: any[]): void; 206 /** 207 * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level. 208 * 209 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) 210 */ 211 warn(...data: any[]): void; 212} 213declare const console: Console; 214type BufferSource = ArrayBufferView | ArrayBuffer; 215type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; 216declare namespace WebAssembly { 217 class CompileError extends Error { 218 constructor(message?: string); 219 } 220 class RuntimeError extends Error { 221 constructor(message?: string); 222 } 223 type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128"; 224 interface GlobalDescriptor { 225 value: ValueType; 226 mutable?: boolean; 227 } 228 class Global { 229 constructor(descriptor: GlobalDescriptor, value?: any); 230 value: any; 231 valueOf(): any; 232 } 233 type ImportValue = ExportValue | number; 234 type ModuleImports = Record<string, ImportValue>; 235 type Imports = Record<string, ModuleImports>; 236 type ExportValue = Function | Global | Memory | Table; 237 type Exports = Record<string, ExportValue>; 238 class Instance { 239 constructor(module: Module, imports?: Imports); 240 readonly exports: Exports; 241 } 242 interface MemoryDescriptor { 243 initial: number; 244 maximum?: number; 245 shared?: boolean; 246 } 247 class Memory { 248 constructor(descriptor: MemoryDescriptor); 249 readonly buffer: ArrayBuffer; 250 grow(delta: number): number; 251 } 252 type ImportExportKind = "function" | "global" | "memory" | "table"; 253 interface ModuleExportDescriptor { 254 kind: ImportExportKind; 255 name: string; 256 } 257 interface ModuleImportDescriptor { 258 kind: ImportExportKind; 259 module: string; 260 name: string; 261 } 262 abstract class Module { 263 static customSections(module: Module, sectionName: string): ArrayBuffer[]; 264 static exports(module: Module): ModuleExportDescriptor[]; 265 static imports(module: Module): ModuleImportDescriptor[]; 266 } 267 type TableKind = "anyfunc" | "externref"; 268 interface TableDescriptor { 269 element: TableKind; 270 initial: number; 271 maximum?: number; 272 } 273 class Table { 274 constructor(descriptor: TableDescriptor, value?: any); 275 readonly length: number; 276 get(index: number): any; 277 grow(delta: number, value?: any): number; 278 set(index: number, value?: any): void; 279 } 280 function instantiate(module: Module, imports?: Imports): Promise<Instance>; 281 function validate(bytes: BufferSource): boolean; 282} 283/** 284 * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker. 285 * Available only in secure contexts. 286 * 287 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope) 288 */ 289interface ServiceWorkerGlobalScope extends WorkerGlobalScope { 290 DOMException: typeof DOMException; 291 WorkerGlobalScope: typeof WorkerGlobalScope; 292 btoa(data: string): string; 293 atob(data: string): string; 294 setTimeout(callback: (...args: any[]) => void, msDelay?: number): number; 295 setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; 296 clearTimeout(timeoutId: number | null): void; 297 setInterval(callback: (...args: any[]) => void, msDelay?: number): number; 298 setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; 299 clearInterval(timeoutId: number | null): void; 300 queueMicrotask(task: Function): void; 301 structuredClone<T>(value: T, options?: StructuredSerializeOptions): T; 302 reportError(error: any): void; 303 fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>; 304 self: ServiceWorkerGlobalScope; 305 crypto: Crypto; 306 caches: CacheStorage; 307 scheduler: Scheduler; 308 performance: Performance; 309 Cloudflare: Cloudflare; 310 readonly origin: string; 311 Event: typeof Event; 312 ExtendableEvent: typeof ExtendableEvent; 313 CustomEvent: typeof CustomEvent; 314 PromiseRejectionEvent: typeof PromiseRejectionEvent; 315 FetchEvent: typeof FetchEvent; 316 TailEvent: typeof TailEvent; 317 TraceEvent: typeof TailEvent; 318 ScheduledEvent: typeof ScheduledEvent; 319 MessageEvent: typeof MessageEvent; 320 CloseEvent: typeof CloseEvent; 321 ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader; 322 ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader; 323 ReadableStream: typeof ReadableStream; 324 WritableStream: typeof WritableStream; 325 WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter; 326 TransformStream: typeof TransformStream; 327 ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy; 328 CountQueuingStrategy: typeof CountQueuingStrategy; 329 ErrorEvent: typeof ErrorEvent; 330 MessageChannel: typeof MessageChannel; 331 MessagePort: typeof MessagePort; 332 EventSource: typeof EventSource; 333 ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest; 334 ReadableStreamDefaultController: typeof ReadableStreamDefaultController; 335 ReadableByteStreamController: typeof ReadableByteStreamController; 336 WritableStreamDefaultController: typeof WritableStreamDefaultController; 337 TransformStreamDefaultController: typeof TransformStreamDefaultController; 338 CompressionStream: typeof CompressionStream; 339 DecompressionStream: typeof DecompressionStream; 340 TextEncoderStream: typeof TextEncoderStream; 341 TextDecoderStream: typeof TextDecoderStream; 342 Headers: typeof Headers; 343 Body: typeof Body; 344 Request: typeof Request; 345 Response: typeof Response; 346 WebSocket: typeof WebSocket; 347 WebSocketPair: typeof WebSocketPair; 348 WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair; 349 AbortController: typeof AbortController; 350 AbortSignal: typeof AbortSignal; 351 TextDecoder: typeof TextDecoder; 352 TextEncoder: typeof TextEncoder; 353 navigator: Navigator; 354 Navigator: typeof Navigator; 355 URL: typeof URL; 356 URLSearchParams: typeof URLSearchParams; 357 URLPattern: typeof URLPattern; 358 Blob: typeof Blob; 359 File: typeof File; 360 FormData: typeof FormData; 361 Crypto: typeof Crypto; 362 SubtleCrypto: typeof SubtleCrypto; 363 CryptoKey: typeof CryptoKey; 364 CacheStorage: typeof CacheStorage; 365 Cache: typeof Cache; 366 FixedLengthStream: typeof FixedLengthStream; 367 IdentityTransformStream: typeof IdentityTransformStream; 368 HTMLRewriter: typeof HTMLRewriter; 369} 370declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void; 371declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void; 372/** 373 * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. 374 * 375 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) 376 */ 377declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean; 378/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */ 379declare function btoa(data: string): string; 380/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */ 381declare function atob(data: string): string; 382/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */ 383declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number; 384/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */ 385declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; 386/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */ 387declare function clearTimeout(timeoutId: number | null): void; 388/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */ 389declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number; 390/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */ 391declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; 392/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */ 393declare function clearInterval(timeoutId: number | null): void; 394/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */ 395declare function queueMicrotask(task: Function): void; 396/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */ 397declare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T; 398/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */ 399declare function reportError(error: any): void; 400/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */ 401declare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>; 402declare const self: ServiceWorkerGlobalScope; 403/** 404* The Web Crypto API provides a set of low-level functions for common cryptographic tasks. 405* The Workers runtime implements the full surface of this API, but with some differences in 406* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms) 407* compared to those implemented in most browsers. 408* 409* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/) 410*/ 411declare const crypto: Crypto; 412/** 413* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. 414* 415* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) 416*/ 417declare const caches: CacheStorage; 418declare const scheduler: Scheduler; 419/** 420* The Workers runtime supports a subset of the Performance API, used to measure timing and performance, 421* as well as timing of subrequests and other operations. 422* 423* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/) 424*/ 425declare const performance: Performance; 426declare const Cloudflare: Cloudflare; 427declare const origin: string; 428declare const navigator: Navigator; 429interface TestController { 430} 431interface ExecutionContext<Props = unknown> { 432 waitUntil(promise: Promise<any>): void; 433 passThroughOnException(): void; 434 readonly props: Props; 435} 436type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext) => Response | Promise<Response>; 437type ExportedHandlerTailHandler<Env = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise<void>; 438type ExportedHandlerTraceHandler<Env = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise<void>; 439type ExportedHandlerTailStreamHandler<Env = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>; 440type ExportedHandlerScheduledHandler<Env = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext) => void | Promise<void>; 441type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext) => void | Promise<void>; 442type ExportedHandlerTestHandler<Env = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext) => void | Promise<void>; 443interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown> { 444 fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>; 445 tail?: ExportedHandlerTailHandler<Env>; 446 trace?: ExportedHandlerTraceHandler<Env>; 447 tailStream?: ExportedHandlerTailStreamHandler<Env>; 448 scheduled?: ExportedHandlerScheduledHandler<Env>; 449 test?: ExportedHandlerTestHandler<Env>; 450 email?: EmailExportedHandler<Env>; 451 queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>; 452} 453interface StructuredSerializeOptions { 454 transfer?: any[]; 455} 456declare abstract class Navigator { 457 sendBeacon(url: string, body?: BodyInit): boolean; 458 readonly userAgent: string; 459 readonly hardwareConcurrency: number; 460 readonly language: string; 461 readonly languages: string[]; 462} 463interface AlarmInvocationInfo { 464 readonly isRetry: boolean; 465 readonly retryCount: number; 466} 467interface Cloudflare { 468 readonly compatibilityFlags: Record<string, boolean>; 469} 470interface DurableObject { 471 fetch(request: Request): Response | Promise<Response>; 472 alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>; 473 webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>; 474 webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>; 475 webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>; 476} 477type DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"> & { 478 readonly id: DurableObjectId; 479 readonly name?: string; 480}; 481interface DurableObjectId { 482 toString(): string; 483 equals(other: DurableObjectId): boolean; 484 readonly name?: string; 485} 486declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> { 487 newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId; 488 idFromName(name: string): DurableObjectId; 489 idFromString(id: string): DurableObjectId; 490 get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>; 491 getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>; 492 jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>; 493} 494type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high"; 495interface DurableObjectNamespaceNewUniqueIdOptions { 496 jurisdiction?: DurableObjectJurisdiction; 497} 498type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "oc" | "afr" | "me"; 499interface DurableObjectNamespaceGetDurableObjectOptions { 500 locationHint?: DurableObjectLocationHint; 501} 502interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> { 503} 504interface DurableObjectState<Props = unknown> { 505 waitUntil(promise: Promise<any>): void; 506 readonly props: Props; 507 readonly id: DurableObjectId; 508 readonly storage: DurableObjectStorage; 509 container?: Container; 510 blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>; 511 acceptWebSocket(ws: WebSocket, tags?: string[]): void; 512 getWebSockets(tag?: string): WebSocket[]; 513 setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void; 514 getWebSocketAutoResponse(): WebSocketRequestResponsePair | null; 515 getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null; 516 setHibernatableWebSocketEventTimeout(timeoutMs?: number): void; 517 getHibernatableWebSocketEventTimeout(): number | null; 518 getTags(ws: WebSocket): string[]; 519 abort(reason?: string): void; 520} 521interface DurableObjectTransaction { 522 get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>; 523 get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>; 524 list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>; 525 put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>; 526 put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>; 527 delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>; 528 delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>; 529 rollback(): void; 530 getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>; 531 setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>; 532 deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>; 533} 534interface DurableObjectStorage { 535 get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>; 536 get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>; 537 list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>; 538 put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>; 539 put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>; 540 delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>; 541 delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>; 542 deleteAll(options?: DurableObjectPutOptions): Promise<void>; 543 transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>; 544 getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>; 545 setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>; 546 deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>; 547 sync(): Promise<void>; 548 sql: SqlStorage; 549 kv: SyncKvStorage; 550 transactionSync<T>(closure: () => T): T; 551 getCurrentBookmark(): Promise<string>; 552 getBookmarkForTime(timestamp: number | Date): Promise<string>; 553 onNextSessionRestoreBookmark(bookmark: string): Promise<string>; 554} 555interface DurableObjectListOptions { 556 start?: string; 557 startAfter?: string; 558 end?: string; 559 prefix?: string; 560 reverse?: boolean; 561 limit?: number; 562 allowConcurrency?: boolean; 563 noCache?: boolean; 564} 565interface DurableObjectGetOptions { 566 allowConcurrency?: boolean; 567 noCache?: boolean; 568} 569interface DurableObjectGetAlarmOptions { 570 allowConcurrency?: boolean; 571} 572interface DurableObjectPutOptions { 573 allowConcurrency?: boolean; 574 allowUnconfirmed?: boolean; 575 noCache?: boolean; 576} 577interface DurableObjectSetAlarmOptions { 578 allowConcurrency?: boolean; 579 allowUnconfirmed?: boolean; 580} 581declare class WebSocketRequestResponsePair { 582 constructor(request: string, response: string); 583 get request(): string; 584 get response(): string; 585} 586interface AnalyticsEngineDataset { 587 writeDataPoint(event?: AnalyticsEngineDataPoint): void; 588} 589interface AnalyticsEngineDataPoint { 590 indexes?: ((ArrayBuffer | string) | null)[]; 591 doubles?: number[]; 592 blobs?: ((ArrayBuffer | string) | null)[]; 593} 594/** 595 * The **`Event`** interface represents an event which takes place on an `EventTarget`. 596 * 597 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event) 598 */ 599declare class Event { 600 constructor(type: string, init?: EventInit); 601 /** 602 * The **`type`** read-only property of the Event interface returns a string containing the event's type. 603 * 604 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type) 605 */ 606 get type(): string; 607 /** 608 * The **`eventPhase`** read-only property of the being evaluated. 609 * 610 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase) 611 */ 612 get eventPhase(): number; 613 /** 614 * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM. 615 * 616 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed) 617 */ 618 get composed(): boolean; 619 /** 620 * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not. 621 * 622 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles) 623 */ 624 get bubbles(): boolean; 625 /** 626 * 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. 627 * 628 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable) 629 */ 630 get cancelable(): boolean; 631 /** 632 * 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. 633 * 634 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented) 635 */ 636 get defaultPrevented(): boolean; 637 /** 638 * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not. 639 * @deprecated 640 * 641 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue) 642 */ 643 get returnValue(): boolean; 644 /** 645 * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached. 646 * 647 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget) 648 */ 649 get currentTarget(): EventTarget | undefined; 650 /** 651 * The read-only **`target`** property of the dispatched. 652 * 653 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target) 654 */ 655 get target(): EventTarget | undefined; 656 /** 657 * The deprecated **`Event.srcElement`** is an alias for the Event.target property. 658 * @deprecated 659 * 660 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement) 661 */ 662 get srcElement(): EventTarget | undefined; 663 /** 664 * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created. 665 * 666 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp) 667 */ 668 get timeStamp(): number; 669 /** 670 * 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. 671 * 672 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted) 673 */ 674 get isTrusted(): boolean; 675 /** 676 * The **`cancelBubble`** property of the Event interface is deprecated. 677 * @deprecated 678 * 679 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) 680 */ 681 get cancelBubble(): boolean; 682 /** 683 * The **`cancelBubble`** property of the Event interface is deprecated. 684 * @deprecated 685 * 686 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) 687 */ 688 set cancelBubble(value: boolean); 689 /** 690 * 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. 691 * 692 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation) 693 */ 694 stopImmediatePropagation(): void; 695 /** 696 * 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. 697 * 698 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault) 699 */ 700 preventDefault(): void; 701 /** 702 * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. 703 * 704 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation) 705 */ 706 stopPropagation(): void; 707 /** 708 * 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. 709 * 710 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath) 711 */ 712 composedPath(): EventTarget[]; 713 static readonly NONE: number; 714 static readonly CAPTURING_PHASE: number; 715 static readonly AT_TARGET: number; 716 static readonly BUBBLING_PHASE: number; 717} 718interface EventInit { 719 bubbles?: boolean; 720 cancelable?: boolean; 721 composed?: boolean; 722} 723type EventListener<EventType extends Event = Event> = (event: EventType) => void; 724interface EventListenerObject<EventType extends Event = Event> { 725 handleEvent(event: EventType): void; 726} 727type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>; 728/** 729 * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them. 730 * 731 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget) 732 */ 733declare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> { 734 constructor(); 735 /** 736 * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. 737 * 738 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) 739 */ 740 addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void; 741 /** 742 * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. 743 * 744 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) 745 */ 746 removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void; 747 /** 748 * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. 749 * 750 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) 751 */ 752 dispatchEvent(event: EventMap[keyof EventMap]): boolean; 753} 754interface EventTargetEventListenerOptions { 755 capture?: boolean; 756} 757interface EventTargetAddEventListenerOptions { 758 capture?: boolean; 759 passive?: boolean; 760 once?: boolean; 761 signal?: AbortSignal; 762} 763interface EventTargetHandlerObject { 764 handleEvent: (event: Event) => any | undefined; 765} 766/** 767 * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired. 768 * 769 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController) 770 */ 771declare class AbortController { 772 constructor(); 773 /** 774 * 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. 775 * 776 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal) 777 */ 778 get signal(): AbortSignal; 779 /** 780 * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed. 781 * 782 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort) 783 */ 784 abort(reason?: any): void; 785} 786/** 787 * 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. 788 * 789 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal) 790 */ 791declare abstract class AbortSignal extends EventTarget { 792 /** 793 * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event). 794 * 795 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) 796 */ 797 static abort(reason?: any): AbortSignal; 798 /** 799 * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time. 800 * 801 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) 802 */ 803 static timeout(delay: number): AbortSignal; 804 /** 805 * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal. 806 * 807 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) 808 */ 809 static any(signals: AbortSignal[]): AbortSignal; 810 /** 811 * 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`). 812 * 813 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) 814 */ 815 get aborted(): boolean; 816 /** 817 * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason. 818 * 819 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) 820 */ 821 get reason(): any; 822 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ 823 get onabort(): any | null; 824 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ 825 set onabort(value: any | null); 826 /** 827 * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing. 828 * 829 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) 830 */ 831 throwIfAborted(): void; 832} 833interface Scheduler { 834 wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>; 835} 836interface SchedulerWaitOptions { 837 signal?: AbortSignal; 838} 839/** 840 * The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle. 841 * 842 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent) 843 */ 844declare abstract class ExtendableEvent extends Event { 845 /** 846 * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. 847 * 848 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) 849 */ 850 waitUntil(promise: Promise<any>): void; 851} 852/** 853 * The **`CustomEvent`** interface represents events initialized by an application for any purpose. 854 * 855 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) 856 */ 857declare class CustomEvent<T = any> extends Event { 858 constructor(type: string, init?: CustomEventCustomEventInit); 859 /** 860 * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event. 861 * 862 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail) 863 */ 864 get detail(): T; 865} 866interface CustomEventCustomEventInit { 867 bubbles?: boolean; 868 cancelable?: boolean; 869 composed?: boolean; 870 detail?: any; 871} 872/** 873 * 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. 874 * 875 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob) 876 */ 877declare class Blob { 878 constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions); 879 /** 880 * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes. 881 * 882 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) 883 */ 884 get size(): number; 885 /** 886 * The **`type`** read-only property of the Blob interface returns the MIME type of the file. 887 * 888 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) 889 */ 890 get type(): string; 891 /** 892 * 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. 893 * 894 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) 895 */ 896 slice(start?: number, end?: number, type?: string): Blob; 897 /** 898 * 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. 899 * 900 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) 901 */ 902 arrayBuffer(): Promise<ArrayBuffer>; 903 /** 904 * 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. 905 * 906 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes) 907 */ 908 bytes(): Promise<Uint8Array>; 909 /** 910 * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8. 911 * 912 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) 913 */ 914 text(): Promise<string>; 915 /** 916 * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`. 917 * 918 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) 919 */ 920 stream(): ReadableStream; 921} 922interface BlobOptions { 923 type?: string; 924} 925/** 926 * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content. 927 * 928 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File) 929 */ 930declare class File extends Blob { 931 constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions); 932 /** 933 * The **`name`** read-only property of the File interface returns the name of the file represented by a File object. 934 * 935 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) 936 */ 937 get name(): string; 938 /** 939 * 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). 940 * 941 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) 942 */ 943 get lastModified(): number; 944} 945interface FileOptions { 946 type?: string; 947 lastModified?: number; 948} 949/** 950* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. 951* 952* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) 953*/ 954declare abstract class CacheStorage { 955 /** 956 * The **`open()`** method of the the Cache object matching the `cacheName`. 957 * 958 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) 959 */ 960 open(cacheName: string): Promise<Cache>; 961 readonly default: Cache; 962} 963/** 964* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. 965* 966* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) 967*/ 968declare abstract class Cache { 969 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */ 970 delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>; 971 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */ 972 match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>; 973 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */ 974 put(request: RequestInfo | URL, response: Response): Promise<void>; 975} 976interface CacheQueryOptions { 977 ignoreMethod?: boolean; 978} 979/** 980* The Web Crypto API provides a set of low-level functions for common cryptographic tasks. 981* The Workers runtime implements the full surface of this API, but with some differences in 982* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms) 983* compared to those implemented in most browsers. 984* 985* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/) 986*/ 987declare abstract class Crypto { 988 /** 989 * The **`Crypto.subtle`** read-only property returns a cryptographic operations. 990 * Available only in secure contexts. 991 * 992 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle) 993 */ 994 get subtle(): SubtleCrypto; 995 /** 996 * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values. 997 * 998 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) 999 */ 1000 getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T; 1001 /** 1002 * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator. 1003 * Available only in secure contexts. 1004 * 1005 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID) 1006 */ 1007 randomUUID(): string; 1008 DigestStream: typeof DigestStream; 1009} 1010/** 1011 * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions. 1012 * Available only in secure contexts. 1013 * 1014 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto) 1015 */ 1016declare abstract class SubtleCrypto { 1017 /** 1018 * The **`encrypt()`** method of the SubtleCrypto interface encrypts data. 1019 * 1020 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt) 1021 */ 1022 encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>; 1023 /** 1024 * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data. 1025 * 1026 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) 1027 */ 1028 decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>; 1029 /** 1030 * The **`sign()`** method of the SubtleCrypto interface generates a digital signature. 1031 * 1032 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign) 1033 */ 1034 sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>; 1035 /** 1036 * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature. 1037 * 1038 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify) 1039 */ 1040 verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>; 1041 /** 1042 * The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function. 1043 * 1044 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) 1045 */ 1046 digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>; 1047 /** 1048 * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms). 1049 * 1050 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) 1051 */ 1052 generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>; 1053 /** 1054 * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key. 1055 * 1056 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) 1057 */ 1058 deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>; 1059 /** 1060 * The **`deriveBits()`** method of the key. 1061 * 1062 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) 1063 */ 1064 deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>; 1065 /** 1066 * 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. 1067 * 1068 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) 1069 */ 1070 importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>; 1071 /** 1072 * 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. 1073 * 1074 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) 1075 */ 1076 exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>; 1077 /** 1078 * The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key. 1079 * 1080 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) 1081 */ 1082 wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>; 1083 /** 1084 * The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key. 1085 * 1086 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) 1087 */ 1088 unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>; 1089 timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean; 1090} 1091/** 1092 * 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. 1093 * Available only in secure contexts. 1094 * 1095 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey) 1096 */ 1097declare abstract class CryptoKey { 1098 /** 1099 * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object. 1100 * 1101 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) 1102 */ 1103 readonly type: string; 1104 /** 1105 * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`. 1106 * 1107 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) 1108 */ 1109 readonly extractable: boolean; 1110 /** 1111 * 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. 1112 * 1113 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) 1114 */ 1115 readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm; 1116 /** 1117 * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key. 1118 * 1119 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) 1120 */ 1121 readonly usages: string[]; 1122} 1123interface CryptoKeyPair { 1124 publicKey: CryptoKey; 1125 privateKey: CryptoKey; 1126} 1127interface JsonWebKey { 1128 kty: string; 1129 use?: string; 1130 key_ops?: string[]; 1131 alg?: string; 1132 ext?: boolean; 1133 crv?: string; 1134 x?: string; 1135 y?: string; 1136 d?: string; 1137 n?: string; 1138 e?: string; 1139 p?: string; 1140 q?: string; 1141 dp?: string; 1142 dq?: string; 1143 qi?: string; 1144 oth?: RsaOtherPrimesInfo[]; 1145 k?: string; 1146} 1147interface RsaOtherPrimesInfo { 1148 r?: string; 1149 d?: string; 1150 t?: string; 1151} 1152interface SubtleCryptoDeriveKeyAlgorithm { 1153 name: string; 1154 salt?: (ArrayBuffer | ArrayBufferView); 1155 iterations?: number; 1156 hash?: (string | SubtleCryptoHashAlgorithm); 1157 $public?: CryptoKey; 1158 info?: (ArrayBuffer | ArrayBufferView); 1159} 1160interface SubtleCryptoEncryptAlgorithm { 1161 name: string; 1162 iv?: (ArrayBuffer | ArrayBufferView); 1163 additionalData?: (ArrayBuffer | ArrayBufferView); 1164 tagLength?: number; 1165 counter?: (ArrayBuffer | ArrayBufferView); 1166 length?: number; 1167 label?: (ArrayBuffer | ArrayBufferView); 1168} 1169interface SubtleCryptoGenerateKeyAlgorithm { 1170 name: string; 1171 hash?: (string | SubtleCryptoHashAlgorithm); 1172 modulusLength?: number; 1173 publicExponent?: (ArrayBuffer | ArrayBufferView); 1174 length?: number; 1175 namedCurve?: string; 1176} 1177interface SubtleCryptoHashAlgorithm { 1178 name: string; 1179} 1180interface SubtleCryptoImportKeyAlgorithm { 1181 name: string; 1182 hash?: (string | SubtleCryptoHashAlgorithm); 1183 length?: number; 1184 namedCurve?: string; 1185 compressed?: boolean; 1186} 1187interface SubtleCryptoSignAlgorithm { 1188 name: string; 1189 hash?: (string | SubtleCryptoHashAlgorithm); 1190 dataLength?: number; 1191 saltLength?: number; 1192} 1193interface CryptoKeyKeyAlgorithm { 1194 name: string; 1195} 1196interface CryptoKeyAesKeyAlgorithm { 1197 name: string; 1198 length: number; 1199} 1200interface CryptoKeyHmacKeyAlgorithm { 1201 name: string; 1202 hash: CryptoKeyKeyAlgorithm; 1203 length: number; 1204} 1205interface CryptoKeyRsaKeyAlgorithm { 1206 name: string; 1207 modulusLength: number; 1208 publicExponent: ArrayBuffer | ArrayBufferView; 1209 hash?: CryptoKeyKeyAlgorithm; 1210} 1211interface CryptoKeyEllipticKeyAlgorithm { 1212 name: string; 1213 namedCurve: string; 1214} 1215interface CryptoKeyArbitraryKeyAlgorithm { 1216 name: string; 1217 hash?: CryptoKeyKeyAlgorithm; 1218 namedCurve?: string; 1219 length?: number; 1220} 1221declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> { 1222 constructor(algorithm: string | SubtleCryptoHashAlgorithm); 1223 readonly digest: Promise<ArrayBuffer>; 1224 get bytesWritten(): number | bigint; 1225} 1226/** 1227 * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc. 1228 * 1229 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder) 1230 */ 1231declare class TextDecoder { 1232 constructor(label?: string, options?: TextDecoderConstructorOptions); 1233 /** 1234 * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter. 1235 * 1236 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode) 1237 */ 1238 decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string; 1239 get encoding(): string; 1240 get fatal(): boolean; 1241 get ignoreBOM(): boolean; 1242} 1243/** 1244 * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes. 1245 * 1246 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder) 1247 */ 1248declare class TextEncoder { 1249 constructor(); 1250 /** 1251 * 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. 1252 * 1253 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode) 1254 */ 1255 encode(input?: string): Uint8Array; 1256 /** 1257 * 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. 1258 * 1259 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto) 1260 */ 1261 encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult; 1262 get encoding(): string; 1263} 1264interface TextDecoderConstructorOptions { 1265 fatal: boolean; 1266 ignoreBOM: boolean; 1267} 1268interface TextDecoderDecodeOptions { 1269 stream: boolean; 1270} 1271interface TextEncoderEncodeIntoResult { 1272 read: number; 1273 written: number; 1274} 1275/** 1276 * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files. 1277 * 1278 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent) 1279 */ 1280declare class ErrorEvent extends Event { 1281 constructor(type: string, init?: ErrorEventErrorEventInit); 1282 /** 1283 * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred. 1284 * 1285 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) 1286 */ 1287 get filename(): string; 1288 /** 1289 * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem. 1290 * 1291 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) 1292 */ 1293 get message(): string; 1294 /** 1295 * 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. 1296 * 1297 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) 1298 */ 1299 get lineno(): number; 1300 /** 1301 * 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. 1302 * 1303 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) 1304 */ 1305 get colno(): number; 1306 /** 1307 * 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. 1308 * 1309 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) 1310 */ 1311 get error(): any; 1312} 1313interface ErrorEventErrorEventInit { 1314 message?: string; 1315 filename?: string; 1316 lineno?: number; 1317 colno?: number; 1318 error?: any; 1319} 1320/** 1321 * The **`MessageEvent`** interface represents a message received by a target object. 1322 * 1323 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent) 1324 */ 1325declare class MessageEvent extends Event { 1326 constructor(type: string, initializer: MessageEventInit); 1327 /** 1328 * 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. 1329 * 1330 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data) 1331 */ 1332 readonly data: any; 1333 /** 1334 * The **`origin`** read-only property of the origin of the message emitter. 1335 * 1336 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin) 1337 */ 1338 readonly origin: string | null; 1339 /** 1340 * The **`lastEventId`** read-only property of the unique ID for the event. 1341 * 1342 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId) 1343 */ 1344 readonly lastEventId: string; 1345 /** 1346 * The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter. 1347 * 1348 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source) 1349 */ 1350 readonly source: MessagePort | null; 1351 /** 1352 * The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order. 1353 * 1354 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports) 1355 */ 1356 readonly ports: MessagePort[]; 1357} 1358interface MessageEventInit { 1359 data: ArrayBuffer | string; 1360} 1361/** 1362 * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected. 1363 * 1364 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent) 1365 */ 1366declare abstract class PromiseRejectionEvent extends Event { 1367 /** 1368 * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected. 1369 * 1370 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) 1371 */ 1372 readonly promise: Promise<any>; 1373 /** 1374 * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). 1375 * 1376 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) 1377 */ 1378 readonly reason: any; 1379} 1380/** 1381 * 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. 1382 * 1383 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData) 1384 */ 1385declare class FormData { 1386 constructor(); 1387 /** 1388 * 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. 1389 * 1390 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) 1391 */ 1392 append(name: string, value: string): void; 1393 /** 1394 * 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. 1395 * 1396 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) 1397 */ 1398 append(name: string, value: Blob, filename?: string): void; 1399 /** 1400 * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object. 1401 * 1402 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) 1403 */ 1404 delete(name: string): void; 1405 /** 1406 * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object. 1407 * 1408 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) 1409 */ 1410 get(name: string): (File | string) | null; 1411 /** 1412 * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object. 1413 * 1414 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) 1415 */ 1416 getAll(name: string): (File | string)[]; 1417 /** 1418 * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key. 1419 * 1420 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) 1421 */ 1422 has(name: string): boolean; 1423 /** 1424 * 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. 1425 * 1426 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) 1427 */ 1428 set(name: string, value: string): void; 1429 /** 1430 * 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. 1431 * 1432 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) 1433 */ 1434 set(name: string, value: Blob, filename?: string): void; 1435 /* Returns an array of key, value pairs for every entry in the list. */ 1436 entries(): IterableIterator<[ 1437 key: string, 1438 value: File | string 1439 ]>; 1440 /* Returns a list of keys in the list. */ 1441 keys(): IterableIterator<string>; 1442 /* Returns a list of values in the list. */ 1443 values(): IterableIterator<(File | string)>; 1444 forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void; 1445 [Symbol.iterator](): IterableIterator<[ 1446 key: string, 1447 value: File | string 1448 ]>; 1449} 1450interface ContentOptions { 1451 html?: boolean; 1452} 1453declare class HTMLRewriter { 1454 constructor(); 1455 on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter; 1456 onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; 1457 transform(response: Response): Response; 1458} 1459interface HTMLRewriterElementContentHandlers { 1460 element?(element: Element): void | Promise<void>; 1461 comments?(comment: Comment): void | Promise<void>; 1462 text?(element: Text): void | Promise<void>; 1463} 1464interface HTMLRewriterDocumentContentHandlers { 1465 doctype?(doctype: Doctype): void | Promise<void>; 1466 comments?(comment: Comment): void | Promise<void>; 1467 text?(text: Text): void | Promise<void>; 1468 end?(end: DocumentEnd): void | Promise<void>; 1469} 1470interface Doctype { 1471 readonly name: string | null; 1472 readonly publicId: string | null; 1473 readonly systemId: string | null; 1474} 1475interface Element { 1476 tagName: string; 1477 readonly attributes: IterableIterator<string[]>; 1478 readonly removed: boolean; 1479 readonly namespaceURI: string; 1480 getAttribute(name: string): string | null; 1481 hasAttribute(name: string): boolean; 1482 setAttribute(name: string, value: string): Element; 1483 removeAttribute(name: string): Element; 1484 before(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1485 after(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1486 prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1487 append(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1488 replace(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1489 remove(): Element; 1490 removeAndKeepContent(): Element; 1491 setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element; 1492 onEndTag(handler: (tag: EndTag) => void | Promise<void>): void; 1493} 1494interface EndTag { 1495 name: string; 1496 before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag; 1497 after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag; 1498 remove(): EndTag; 1499} 1500interface Comment { 1501 text: string; 1502 readonly removed: boolean; 1503 before(content: string, options?: ContentOptions): Comment; 1504 after(content: string, options?: ContentOptions): Comment; 1505 replace(content: string, options?: ContentOptions): Comment; 1506 remove(): Comment; 1507} 1508interface Text { 1509 readonly text: string; 1510 readonly lastInTextNode: boolean; 1511 readonly removed: boolean; 1512 before(content: string | ReadableStream | Response, options?: ContentOptions): Text; 1513 after(content: string | ReadableStream | Response, options?: ContentOptions): Text; 1514 replace(content: string | ReadableStream | Response, options?: ContentOptions): Text; 1515 remove(): Text; 1516} 1517interface DocumentEnd { 1518 append(content: string, options?: ContentOptions): DocumentEnd; 1519} 1520/** 1521 * This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope. 1522 * 1523 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent) 1524 */ 1525declare abstract class FetchEvent extends ExtendableEvent { 1526 /** 1527 * The **`request`** read-only property of the the event handler. 1528 * 1529 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) 1530 */ 1531 readonly request: Request; 1532 /** 1533 * The **`respondWith()`** method of allows you to provide a promise for a Response yourself. 1534 * 1535 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) 1536 */ 1537 respondWith(promise: Response | Promise<Response>): void; 1538 passThroughOnException(): void; 1539} 1540type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>; 1541/** 1542 * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers. 1543 * 1544 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers) 1545 */ 1546declare class Headers { 1547 constructor(init?: HeadersInit); 1548 /** 1549 * 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. 1550 * 1551 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get) 1552 */ 1553 get(name: string): string | null; 1554 getAll(name: string): string[]; 1555 /** 1556 * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response. 1557 * 1558 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie) 1559 */ 1560 getSetCookie(): string[]; 1561 /** 1562 * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header. 1563 * 1564 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has) 1565 */ 1566 has(name: string): boolean; 1567 /** 1568 * 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. 1569 * 1570 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set) 1571 */ 1572 set(name: string, value: string): void; 1573 /** 1574 * 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. 1575 * 1576 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append) 1577 */ 1578 append(name: string, value: string): void; 1579 /** 1580 * The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object. 1581 * 1582 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete) 1583 */ 1584 delete(name: string): void; 1585 forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void; 1586 /* Returns an iterator allowing to go through all key/value pairs contained in this object. */ 1587 entries(): IterableIterator<[ 1588 key: string, 1589 value: string 1590 ]>; 1591 /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */ 1592 keys(): IterableIterator<string>; 1593 /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */ 1594 values(): IterableIterator<string>; 1595 [Symbol.iterator](): IterableIterator<[ 1596 key: string, 1597 value: string 1598 ]>; 1599} 1600type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData; 1601declare abstract class Body { 1602 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */ 1603 get body(): ReadableStream | null; 1604 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */ 1605 get bodyUsed(): boolean; 1606 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */ 1607 arrayBuffer(): Promise<ArrayBuffer>; 1608 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */ 1609 bytes(): Promise<Uint8Array>; 1610 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */ 1611 text(): Promise<string>; 1612 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */ 1613 json<T>(): Promise<T>; 1614 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */ 1615 formData(): Promise<FormData>; 1616 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */ 1617 blob(): Promise<Blob>; 1618} 1619/** 1620 * The **`Response`** interface of the Fetch API represents the response to a request. 1621 * 1622 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response) 1623 */ 1624declare var Response: { 1625 prototype: Response; 1626 new (body?: BodyInit | null, init?: ResponseInit): Response; 1627 error(): Response; 1628 redirect(url: string, status?: number): Response; 1629 json(any: any, maybeInit?: (ResponseInit | Response)): Response; 1630}; 1631/** 1632 * The **`Response`** interface of the Fetch API represents the response to a request. 1633 * 1634 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response) 1635 */ 1636interface Response extends Body { 1637 /** 1638 * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable. 1639 * 1640 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) 1641 */ 1642 clone(): Response; 1643 /** 1644 * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response. 1645 * 1646 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) 1647 */ 1648 status: number; 1649 /** 1650 * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status. 1651 * 1652 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) 1653 */ 1654 statusText: string; 1655 /** 1656 * The **`headers`** read-only property of the with the response. 1657 * 1658 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) 1659 */ 1660 headers: Headers; 1661 /** 1662 * 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. 1663 * 1664 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) 1665 */ 1666 ok: boolean; 1667 /** 1668 * 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. 1669 * 1670 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) 1671 */ 1672 redirected: boolean; 1673 /** 1674 * The **`url`** read-only property of the Response interface contains the URL of the response. 1675 * 1676 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) 1677 */ 1678 url: string; 1679 webSocket: WebSocket | null; 1680 cf: any | undefined; 1681 /** 1682 * The **`type`** read-only property of the Response interface contains the type of the response. 1683 * 1684 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type) 1685 */ 1686 type: "default" | "error"; 1687} 1688interface ResponseInit { 1689 status?: number; 1690 statusText?: string; 1691 headers?: HeadersInit; 1692 cf?: any; 1693 webSocket?: (WebSocket | null); 1694 encodeBody?: "automatic" | "manual"; 1695} 1696type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string; 1697/** 1698 * The **`Request`** interface of the Fetch API represents a resource request. 1699 * 1700 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request) 1701 */ 1702declare var Request: { 1703 prototype: Request; 1704 new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>; 1705}; 1706/** 1707 * The **`Request`** interface of the Fetch API represents a resource request. 1708 * 1709 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request) 1710 */ 1711interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body { 1712 /** 1713 * The **`clone()`** method of the Request interface creates a copy of the current `Request` object. 1714 * 1715 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) 1716 */ 1717 clone(): Request<CfHostMetadata, Cf>; 1718 /** 1719 * The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request. 1720 * 1721 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method) 1722 */ 1723 method: string; 1724 /** 1725 * The **`url`** read-only property of the Request interface contains the URL of the request. 1726 * 1727 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url) 1728 */ 1729 url: string; 1730 /** 1731 * The **`headers`** read-only property of the with the request. 1732 * 1733 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers) 1734 */ 1735 headers: Headers; 1736 /** 1737 * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled. 1738 * 1739 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect) 1740 */ 1741 redirect: string; 1742 fetcher: Fetcher | null; 1743 /** 1744 * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request. 1745 * 1746 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal) 1747 */ 1748 signal: AbortSignal; 1749 cf: Cf | undefined; 1750 /** 1751 * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request. 1752 * 1753 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity) 1754 */ 1755 integrity: string; 1756 /** 1757 * 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. 1758 * 1759 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive) 1760 */ 1761 keepalive: boolean; 1762 /** 1763 * The **`cache`** read-only property of the Request interface contains the cache mode of the request. 1764 * 1765 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache) 1766 */ 1767 cache?: "no-store" | "no-cache"; 1768} 1769interface RequestInit<Cf = CfProperties> { 1770 /* A string to set request's method. */ 1771 method?: string; 1772 /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */ 1773 headers?: HeadersInit; 1774 /* A BodyInit object or null to set request's body. */ 1775 body?: BodyInit | null; 1776 /* 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. */ 1777 redirect?: string; 1778 fetcher?: (Fetcher | null); 1779 cf?: Cf; 1780 /* A string indicating how the request will interact with the browser's cache to set request's cache. */ 1781 cache?: "no-store" | "no-cache"; 1782 /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */ 1783 integrity?: string; 1784 /* An AbortSignal to set request's signal. */ 1785 signal?: (AbortSignal | null); 1786 encodeResponseBody?: "automatic" | "manual"; 1787} 1788type 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>; 1789type Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | "fetch" | "connect"> : unknown) & { 1790 fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>; 1791 connect(address: SocketAddress | string, options?: SocketOptions): Socket; 1792}; 1793interface KVNamespaceListKey<Metadata, Key extends string = string> { 1794 name: Key; 1795 expiration?: number; 1796 metadata?: Metadata; 1797} 1798type KVNamespaceListResult<Metadata, Key extends string = string> = { 1799 list_complete: false; 1800 keys: KVNamespaceListKey<Metadata, Key>[]; 1801 cursor: string; 1802 cacheStatus: string | null; 1803} | { 1804 list_complete: true; 1805 keys: KVNamespaceListKey<Metadata, Key>[]; 1806 cacheStatus: string | null; 1807}; 1808interface KVNamespace<Key extends string = string> { 1809 get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>; 1810 get(key: Key, type: "text"): Promise<string | null>; 1811 get<ExpectedValue = unknown>(key: Key, type: "json"): Promise<ExpectedValue | null>; 1812 get(key: Key, type: "arrayBuffer"): Promise<ArrayBuffer | null>; 1813 get(key: Key, type: "stream"): Promise<ReadableStream | null>; 1814 get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise<string | null>; 1815 get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<"json">): Promise<ExpectedValue | null>; 1816 get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise<ArrayBuffer | null>; 1817 get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise<ReadableStream | null>; 1818 get(key: Array<Key>, type: "text"): Promise<Map<string, string | null>>; 1819 get<ExpectedValue = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, ExpectedValue | null>>; 1820 get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>; 1821 get(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, string | null>>; 1822 get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, ExpectedValue | null>>; 1823 list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>; 1824 put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>; 1825 getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>; 1826 getWithMetadata<Metadata = unknown>(key: Key, type: "text"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>; 1827 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: "json"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>; 1828 getWithMetadata<Metadata = unknown>(key: Key, type: "arrayBuffer"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>; 1829 getWithMetadata<Metadata = unknown>(key: Key, type: "stream"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>; 1830 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"text">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>; 1831 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"json">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>; 1832 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"arrayBuffer">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>; 1833 getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<"stream">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>; 1834 getWithMetadata<Metadata = unknown>(key: Array<Key>, type: "text"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>; 1835 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: "json"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>; 1836 getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>; 1837 getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"text">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>; 1838 getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<"json">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>; 1839 delete(key: Key): Promise<void>; 1840} 1841interface KVNamespaceListOptions { 1842 limit?: number; 1843 prefix?: (string | null); 1844 cursor?: (string | null); 1845} 1846interface KVNamespaceGetOptions<Type> { 1847 type: Type; 1848 cacheTtl?: number; 1849} 1850interface KVNamespacePutOptions { 1851 expiration?: number; 1852 expirationTtl?: number; 1853 metadata?: (any | null); 1854} 1855interface KVNamespaceGetWithMetadataResult<Value, Metadata> { 1856 value: Value | null; 1857 metadata: Metadata | null; 1858 cacheStatus: string | null; 1859} 1860type QueueContentType = "text" | "bytes" | "json" | "v8"; 1861interface Queue<Body = unknown> { 1862 send(message: Body, options?: QueueSendOptions): Promise<void>; 1863 sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<void>; 1864} 1865interface QueueSendOptions { 1866 contentType?: QueueContentType; 1867 delaySeconds?: number; 1868} 1869interface QueueSendBatchOptions { 1870 delaySeconds?: number; 1871} 1872interface MessageSendRequest<Body = unknown> { 1873 body: Body; 1874 contentType?: QueueContentType; 1875 delaySeconds?: number; 1876} 1877interface QueueRetryOptions { 1878 delaySeconds?: number; 1879} 1880interface Message<Body = unknown> { 1881 readonly id: string; 1882 readonly timestamp: Date; 1883 readonly body: Body; 1884 readonly attempts: number; 1885 retry(options?: QueueRetryOptions): void; 1886 ack(): void; 1887} 1888interface QueueEvent<Body = unknown> extends ExtendableEvent { 1889 readonly messages: readonly Message<Body>[]; 1890 readonly queue: string; 1891 retryAll(options?: QueueRetryOptions): void; 1892 ackAll(): void; 1893} 1894interface MessageBatch<Body = unknown> { 1895 readonly messages: readonly Message<Body>[]; 1896 readonly queue: string; 1897 retryAll(options?: QueueRetryOptions): void; 1898 ackAll(): void; 1899} 1900interface R2Error extends Error { 1901 readonly name: string; 1902 readonly code: number; 1903 readonly message: string; 1904 readonly action: string; 1905 readonly stack: any; 1906} 1907interface R2ListOptions { 1908 limit?: number; 1909 prefix?: string; 1910 cursor?: string; 1911 delimiter?: string; 1912 startAfter?: string; 1913 include?: ("httpMetadata" | "customMetadata")[]; 1914} 1915declare abstract class R2Bucket { 1916 head(key: string): Promise<R2Object | null>; 1917 get(key: string, options: R2GetOptions & { 1918 onlyIf: R2Conditional | Headers; 1919 }): Promise<R2ObjectBody | R2Object | null>; 1920 get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>; 1921 put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & { 1922 onlyIf: R2Conditional | Headers; 1923 }): Promise<R2Object | null>; 1924 put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>; 1925 createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>; 1926 resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; 1927 delete(keys: string | string[]): Promise<void>; 1928 list(options?: R2ListOptions): Promise<R2Objects>; 1929} 1930interface R2MultipartUpload { 1931 readonly key: string; 1932 readonly uploadId: string; 1933 uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>; 1934 abort(): Promise<void>; 1935 complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>; 1936} 1937interface R2UploadedPart { 1938 partNumber: number; 1939 etag: string; 1940} 1941declare abstract class R2Object { 1942 readonly key: string; 1943 readonly version: string; 1944 readonly size: number; 1945 readonly etag: string; 1946 readonly httpEtag: string; 1947 readonly checksums: R2Checksums; 1948 readonly uploaded: Date; 1949 readonly httpMetadata?: R2HTTPMetadata; 1950 readonly customMetadata?: Record<string, string>; 1951 readonly range?: R2Range; 1952 readonly storageClass: string; 1953 readonly ssecKeyMd5?: string; 1954 writeHttpMetadata(headers: Headers): void; 1955} 1956interface R2ObjectBody extends R2Object { 1957 get body(): ReadableStream; 1958 get bodyUsed(): boolean; 1959 arrayBuffer(): Promise<ArrayBuffer>; 1960 bytes(): Promise<Uint8Array>; 1961 text(): Promise<string>; 1962 json<T>(): Promise<T>; 1963 blob(): Promise<Blob>; 1964} 1965type R2Range = { 1966 offset: number; 1967 length?: number; 1968} | { 1969 offset?: number; 1970 length: number; 1971} | { 1972 suffix: number; 1973}; 1974interface R2Conditional { 1975 etagMatches?: string; 1976 etagDoesNotMatch?: string; 1977 uploadedBefore?: Date; 1978 uploadedAfter?: Date; 1979 secondsGranularity?: boolean; 1980} 1981interface R2GetOptions { 1982 onlyIf?: (R2Conditional | Headers); 1983 range?: (R2Range | Headers); 1984 ssecKey?: (ArrayBuffer | string); 1985} 1986interface R2PutOptions { 1987 onlyIf?: (R2Conditional | Headers); 1988 httpMetadata?: (R2HTTPMetadata | Headers); 1989 customMetadata?: Record<string, string>; 1990 md5?: ((ArrayBuffer | ArrayBufferView) | string); 1991 sha1?: ((ArrayBuffer | ArrayBufferView) | string); 1992 sha256?: ((ArrayBuffer | ArrayBufferView) | string); 1993 sha384?: ((ArrayBuffer | ArrayBufferView) | string); 1994 sha512?: ((ArrayBuffer | ArrayBufferView) | string); 1995 storageClass?: string; 1996 ssecKey?: (ArrayBuffer | string); 1997} 1998interface R2MultipartOptions { 1999 httpMetadata?: (R2HTTPMetadata | Headers); 2000 customMetadata?: Record<string, string>; 2001 storageClass?: string; 2002 ssecKey?: (ArrayBuffer | string); 2003} 2004interface R2Checksums { 2005 readonly md5?: ArrayBuffer; 2006 readonly sha1?: ArrayBuffer; 2007 readonly sha256?: ArrayBuffer; 2008 readonly sha384?: ArrayBuffer; 2009 readonly sha512?: ArrayBuffer; 2010 toJSON(): R2StringChecksums; 2011} 2012interface R2StringChecksums { 2013 md5?: string; 2014 sha1?: string; 2015 sha256?: string; 2016 sha384?: string; 2017 sha512?: string; 2018} 2019interface R2HTTPMetadata { 2020 contentType?: string; 2021 contentLanguage?: string; 2022 contentDisposition?: string; 2023 contentEncoding?: string; 2024 cacheControl?: string; 2025 cacheExpiry?: Date; 2026} 2027type R2Objects = { 2028 objects: R2Object[]; 2029 delimitedPrefixes: string[]; 2030} & ({ 2031 truncated: true; 2032 cursor: string; 2033} | { 2034 truncated: false; 2035}); 2036interface R2UploadPartOptions { 2037 ssecKey?: (ArrayBuffer | string); 2038} 2039declare abstract class ScheduledEvent extends ExtendableEvent { 2040 readonly scheduledTime: number; 2041 readonly cron: string; 2042 noRetry(): void; 2043} 2044interface ScheduledController { 2045 readonly scheduledTime: number; 2046 readonly cron: string; 2047 noRetry(): void; 2048} 2049interface QueuingStrategy<T = any> { 2050 highWaterMark?: (number | bigint); 2051 size?: (chunk: T) => number | bigint; 2052} 2053interface UnderlyingSink<W = any> { 2054 type?: string; 2055 start?: (controller: WritableStreamDefaultController) => void | Promise<void>; 2056 write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>; 2057 abort?: (reason: any) => void | Promise<void>; 2058 close?: () => void | Promise<void>; 2059} 2060interface UnderlyingByteSource { 2061 type: "bytes"; 2062 autoAllocateChunkSize?: number; 2063 start?: (controller: ReadableByteStreamController) => void | Promise<void>; 2064 pull?: (controller: ReadableByteStreamController) => void | Promise<void>; 2065 cancel?: (reason: any) => void | Promise<void>; 2066} 2067interface UnderlyingSource<R = any> { 2068 type?: "" | undefined; 2069 start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>; 2070 pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>; 2071 cancel?: (reason: any) => void | Promise<void>; 2072 expectedLength?: (number | bigint); 2073} 2074interface Transformer<I = any, O = any> { 2075 readableType?: string; 2076 writableType?: string; 2077 start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>; 2078 transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>; 2079 flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>; 2080 cancel?: (reason: any) => void | Promise<void>; 2081 expectedLength?: number; 2082} 2083interface StreamPipeOptions { 2084 /** 2085 * 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. 2086 * 2087 * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. 2088 * 2089 * Errors and closures of the source and destination streams propagate as follows: 2090 * 2091 * 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. 2092 * 2093 * 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. 2094 * 2095 * 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. 2096 * 2097 * 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. 2098 * 2099 * 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. 2100 */ 2101 preventClose?: boolean; 2102 preventAbort?: boolean; 2103 preventCancel?: boolean; 2104 signal?: AbortSignal; 2105} 2106type ReadableStreamReadResult<R = any> = { 2107 done: false; 2108 value: R; 2109} | { 2110 done: true; 2111 value?: undefined; 2112}; 2113/** 2114 * The `ReadableStream` interface of the Streams API represents a readable stream of byte data. 2115 * 2116 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream) 2117 */ 2118interface ReadableStream<R = any> { 2119 /** 2120 * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader. 2121 * 2122 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) 2123 */ 2124 get locked(): boolean; 2125 /** 2126 * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled. 2127 * 2128 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) 2129 */ 2130 cancel(reason?: any): Promise<void>; 2131 /** 2132 * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. 2133 * 2134 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) 2135 */ 2136 getReader(): ReadableStreamDefaultReader<R>; 2137 /** 2138 * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. 2139 * 2140 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) 2141 */ 2142 getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; 2143 /** 2144 * 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. 2145 * 2146 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) 2147 */ 2148 pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>; 2149 /** 2150 * 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. 2151 * 2152 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) 2153 */ 2154 pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>; 2155 /** 2156 * The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances. 2157 * 2158 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) 2159 */ 2160 tee(): [ 2161 ReadableStream<R>, 2162 ReadableStream<R> 2163 ]; 2164 values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>; 2165 [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>; 2166} 2167/** 2168 * The `ReadableStream` interface of the Streams API represents a readable stream of byte data. 2169 * 2170 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream) 2171 */ 2172declare const ReadableStream: { 2173 prototype: ReadableStream; 2174 new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>; 2175 new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>; 2176}; 2177/** 2178 * 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). 2179 * 2180 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader) 2181 */ 2182declare class ReadableStreamDefaultReader<R = any> { 2183 constructor(stream: ReadableStream); 2184 get closed(): Promise<void>; 2185 cancel(reason?: any): Promise<void>; 2186 /** 2187 * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue. 2188 * 2189 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) 2190 */ 2191 read(): Promise<ReadableStreamReadResult<R>>; 2192 /** 2193 * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream. 2194 * 2195 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) 2196 */ 2197 releaseLock(): void; 2198} 2199/** 2200 * The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source. 2201 * 2202 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) 2203 */ 2204declare class ReadableStreamBYOBReader { 2205 constructor(stream: ReadableStream); 2206 get closed(): Promise<void>; 2207 cancel(reason?: any): Promise<void>; 2208 /** 2209 * 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. 2210 * 2211 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) 2212 */ 2213 read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>; 2214 /** 2215 * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream. 2216 * 2217 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) 2218 */ 2219 releaseLock(): void; 2220 readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>; 2221} 2222interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions { 2223 min?: number; 2224} 2225interface ReadableStreamGetReaderOptions { 2226 /** 2227 * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. 2228 * 2229 * 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. 2230 */ 2231 mode: "byob"; 2232} 2233/** 2234 * 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). 2235 * 2236 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) 2237 */ 2238declare abstract class ReadableStreamBYOBRequest { 2239 /** 2240 * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view. 2241 * 2242 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) 2243 */ 2244 get view(): Uint8Array | null; 2245 /** 2246 * 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. 2247 * 2248 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) 2249 */ 2250 respond(bytesWritten: number): void; 2251 /** 2252 * 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. 2253 * 2254 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) 2255 */ 2256 respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; 2257 get atLeast(): number | null; 2258} 2259/** 2260 * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. 2261 * 2262 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) 2263 */ 2264declare abstract class ReadableStreamDefaultController<R = any> { 2265 /** 2266 * The **`desiredSize`** read-only property of the required to fill the stream's internal queue. 2267 * 2268 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) 2269 */ 2270 get desiredSize(): number | null; 2271 /** 2272 * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream. 2273 * 2274 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) 2275 */ 2276 close(): void; 2277 /** 2278 * The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue. 2279 * 2280 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) 2281 */ 2282 enqueue(chunk?: R): void; 2283 /** 2284 * The **`error()`** method of the with the associated stream to error. 2285 * 2286 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) 2287 */ 2288 error(reason: any): void; 2289} 2290/** 2291 * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream. 2292 * 2293 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) 2294 */ 2295declare abstract class ReadableByteStreamController { 2296 /** 2297 * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests. 2298 * 2299 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) 2300 */ 2301 get byobRequest(): ReadableStreamBYOBRequest | null; 2302 /** 2303 * 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'. 2304 * 2305 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) 2306 */ 2307 get desiredSize(): number | null; 2308 /** 2309 * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream. 2310 * 2311 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) 2312 */ 2313 close(): void; 2314 /** 2315 * 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). 2316 * 2317 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) 2318 */ 2319 enqueue(chunk: ArrayBuffer | ArrayBufferView): void; 2320 /** 2321 * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason. 2322 * 2323 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) 2324 */ 2325 error(reason: any): void; 2326} 2327/** 2328 * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state. 2329 * 2330 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController) 2331 */ 2332declare abstract class WritableStreamDefaultController { 2333 /** 2334 * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller. 2335 * 2336 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) 2337 */ 2338 get signal(): AbortSignal; 2339 /** 2340 * The **`error()`** method of the with the associated stream to error. 2341 * 2342 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) 2343 */ 2344 error(reason?: any): void; 2345} 2346/** 2347 * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream. 2348 * 2349 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) 2350 */ 2351declare abstract class TransformStreamDefaultController<O = any> { 2352 /** 2353 * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream. 2354 * 2355 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) 2356 */ 2357 get desiredSize(): number | null; 2358 /** 2359 * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream. 2360 * 2361 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) 2362 */ 2363 enqueue(chunk?: O): void; 2364 /** 2365 * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream. 2366 * 2367 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) 2368 */ 2369 error(reason: any): void; 2370 /** 2371 * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream. 2372 * 2373 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) 2374 */ 2375 terminate(): void; 2376} 2377interface ReadableWritablePair<R = any, W = any> { 2378 /** 2379 * 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. 2380 * 2381 * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. 2382 */ 2383 writable: WritableStream<W>; 2384 readable: ReadableStream<R>; 2385} 2386/** 2387 * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. 2388 * 2389 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream) 2390 */ 2391declare class WritableStream<W = any> { 2392 constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy); 2393 /** 2394 * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer. 2395 * 2396 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) 2397 */ 2398 get locked(): boolean; 2399 /** 2400 * 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. 2401 * 2402 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) 2403 */ 2404 abort(reason?: any): Promise<void>; 2405 /** 2406 * The **`close()`** method of the WritableStream interface closes the associated stream. 2407 * 2408 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) 2409 */ 2410 close(): Promise<void>; 2411 /** 2412 * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. 2413 * 2414 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) 2415 */ 2416 getWriter(): WritableStreamDefaultWriter<W>; 2417} 2418/** 2419 * 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. 2420 * 2421 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter) 2422 */ 2423declare class WritableStreamDefaultWriter<W = any> { 2424 constructor(stream: WritableStream); 2425 /** 2426 * The **`closed`** read-only property of the the stream errors or the writer's lock is released. 2427 * 2428 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) 2429 */ 2430 get closed(): Promise<void>; 2431 /** 2432 * 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. 2433 * 2434 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) 2435 */ 2436 get ready(): Promise<void>; 2437 /** 2438 * The **`desiredSize`** read-only property of the to fill the stream's internal queue. 2439 * 2440 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) 2441 */ 2442 get desiredSize(): number | null; 2443 /** 2444 * 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. 2445 * 2446 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) 2447 */ 2448 abort(reason?: any): Promise<void>; 2449 /** 2450 * The **`close()`** method of the stream. 2451 * 2452 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) 2453 */ 2454 close(): Promise<void>; 2455 /** 2456 * The **`write()`** method of the operation. 2457 * 2458 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) 2459 */ 2460 write(chunk?: W): Promise<void>; 2461 /** 2462 * The **`releaseLock()`** method of the corresponding stream. 2463 * 2464 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) 2465 */ 2466 releaseLock(): void; 2467} 2468/** 2469 * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept. 2470 * 2471 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream) 2472 */ 2473declare class TransformStream<I = any, O = any> { 2474 constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>); 2475 /** 2476 * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`. 2477 * 2478 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) 2479 */ 2480 get readable(): ReadableStream<O>; 2481 /** 2482 * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`. 2483 * 2484 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) 2485 */ 2486 get writable(): WritableStream<I>; 2487} 2488declare class FixedLengthStream extends IdentityTransformStream { 2489 constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy); 2490} 2491declare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> { 2492 constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy); 2493} 2494interface IdentityTransformStreamQueuingStrategy { 2495 highWaterMark?: (number | bigint); 2496} 2497interface ReadableStreamValuesOptions { 2498 preventCancel?: boolean; 2499} 2500/** 2501 * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data. 2502 * 2503 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) 2504 */ 2505declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> { 2506 constructor(format: "gzip" | "deflate" | "deflate-raw"); 2507} 2508/** 2509 * The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data. 2510 * 2511 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) 2512 */ 2513declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> { 2514 constructor(format: "gzip" | "deflate" | "deflate-raw"); 2515} 2516/** 2517 * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. 2518 * 2519 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream) 2520 */ 2521declare class TextEncoderStream extends TransformStream<string, Uint8Array> { 2522 constructor(); 2523 get encoding(): string; 2524} 2525/** 2526 * 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. 2527 * 2528 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream) 2529 */ 2530declare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> { 2531 constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); 2532 get encoding(): string; 2533 get fatal(): boolean; 2534 get ignoreBOM(): boolean; 2535} 2536interface TextDecoderStreamTextDecoderStreamInit { 2537 fatal?: boolean; 2538 ignoreBOM?: boolean; 2539} 2540/** 2541 * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. 2542 * 2543 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy) 2544 */ 2545declare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> { 2546 constructor(init: QueuingStrategyInit); 2547 /** 2548 * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied. 2549 * 2550 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) 2551 */ 2552 get highWaterMark(): number; 2553 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */ 2554 get size(): (chunk?: any) => number; 2555} 2556/** 2557 * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams. 2558 * 2559 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy) 2560 */ 2561declare class CountQueuingStrategy implements QueuingStrategy { 2562 constructor(init: QueuingStrategyInit); 2563 /** 2564 * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied. 2565 * 2566 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) 2567 */ 2568 get highWaterMark(): number; 2569 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */ 2570 get size(): (chunk?: any) => number; 2571} 2572interface QueuingStrategyInit { 2573 /** 2574 * Creates a new ByteLengthQueuingStrategy with the provided high water mark. 2575 * 2576 * 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. 2577 */ 2578 highWaterMark: number; 2579} 2580interface ScriptVersion { 2581 id?: string; 2582 tag?: string; 2583 message?: string; 2584} 2585declare abstract class TailEvent extends ExtendableEvent { 2586 readonly events: TraceItem[]; 2587 readonly traces: TraceItem[]; 2588} 2589interface TraceItem { 2590 readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null; 2591 readonly eventTimestamp: number | null; 2592 readonly logs: TraceLog[]; 2593 readonly exceptions: TraceException[]; 2594 readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[]; 2595 readonly scriptName: string | null; 2596 readonly entrypoint?: string; 2597 readonly scriptVersion?: ScriptVersion; 2598 readonly dispatchNamespace?: string; 2599 readonly scriptTags?: string[]; 2600 readonly durableObjectId?: string; 2601 readonly outcome: string; 2602 readonly executionModel: string; 2603 readonly truncated: boolean; 2604 readonly cpuTime: number; 2605 readonly wallTime: number; 2606} 2607interface TraceItemAlarmEventInfo { 2608 readonly scheduledTime: Date; 2609} 2610interface TraceItemCustomEventInfo { 2611} 2612interface TraceItemScheduledEventInfo { 2613 readonly scheduledTime: number; 2614 readonly cron: string; 2615} 2616interface TraceItemQueueEventInfo { 2617 readonly queue: string; 2618 readonly batchSize: number; 2619} 2620interface TraceItemEmailEventInfo { 2621 readonly mailFrom: string; 2622 readonly rcptTo: string; 2623 readonly rawSize: number; 2624} 2625interface TraceItemTailEventInfo { 2626 readonly consumedEvents: TraceItemTailEventInfoTailItem[]; 2627} 2628interface TraceItemTailEventInfoTailItem { 2629 readonly scriptName: string | null; 2630} 2631interface TraceItemFetchEventInfo { 2632 readonly response?: TraceItemFetchEventInfoResponse; 2633 readonly request: TraceItemFetchEventInfoRequest; 2634} 2635interface TraceItemFetchEventInfoRequest { 2636 readonly cf?: any; 2637 readonly headers: Record<string, string>; 2638 readonly method: string; 2639 readonly url: string; 2640 getUnredacted(): TraceItemFetchEventInfoRequest; 2641} 2642interface TraceItemFetchEventInfoResponse { 2643 readonly status: number; 2644} 2645interface TraceItemJsRpcEventInfo { 2646 readonly rpcMethod: string; 2647} 2648interface TraceItemHibernatableWebSocketEventInfo { 2649 readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError; 2650} 2651interface TraceItemHibernatableWebSocketEventInfoMessage { 2652 readonly webSocketEventType: string; 2653} 2654interface TraceItemHibernatableWebSocketEventInfoClose { 2655 readonly webSocketEventType: string; 2656 readonly code: number; 2657 readonly wasClean: boolean; 2658} 2659interface TraceItemHibernatableWebSocketEventInfoError { 2660 readonly webSocketEventType: string; 2661} 2662interface TraceLog { 2663 readonly timestamp: number; 2664 readonly level: string; 2665 readonly message: any; 2666} 2667interface TraceException { 2668 readonly timestamp: number; 2669 readonly message: string; 2670 readonly name: string; 2671 readonly stack?: string; 2672} 2673interface TraceDiagnosticChannelEvent { 2674 readonly timestamp: number; 2675 readonly channel: string; 2676 readonly message: any; 2677} 2678interface TraceMetrics { 2679 readonly cpuTime: number; 2680 readonly wallTime: number; 2681} 2682interface UnsafeTraceMetrics { 2683 fromTrace(item: TraceItem): TraceMetrics; 2684} 2685/** 2686 * The **`URL`** interface is used to parse, construct, normalize, and encode URL. 2687 * 2688 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL) 2689 */ 2690declare class URL { 2691 constructor(url: string | URL, base?: string | URL); 2692 /** 2693 * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL. 2694 * 2695 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) 2696 */ 2697 get origin(): string; 2698 /** 2699 * The **`href`** property of the URL interface is a string containing the whole URL. 2700 * 2701 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) 2702 */ 2703 get href(): string; 2704 /** 2705 * The **`href`** property of the URL interface is a string containing the whole URL. 2706 * 2707 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) 2708 */ 2709 set href(value: string); 2710 /** 2711 * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`. 2712 * 2713 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) 2714 */ 2715 get protocol(): string; 2716 /** 2717 * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`. 2718 * 2719 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) 2720 */ 2721 set protocol(value: string); 2722 /** 2723 * The **`username`** property of the URL interface is a string containing the username component of the URL. 2724 * 2725 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) 2726 */ 2727 get username(): string; 2728 /** 2729 * The **`username`** property of the URL interface is a string containing the username component of the URL. 2730 * 2731 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) 2732 */ 2733 set username(value: string); 2734 /** 2735 * The **`password`** property of the URL interface is a string containing the password component of the URL. 2736 * 2737 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) 2738 */ 2739 get password(): string; 2740 /** 2741 * The **`password`** property of the URL interface is a string containing the password component of the URL. 2742 * 2743 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) 2744 */ 2745 set password(value: string); 2746 /** 2747 * 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. 2748 * 2749 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) 2750 */ 2751 get host(): string; 2752 /** 2753 * 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. 2754 * 2755 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) 2756 */ 2757 set host(value: string); 2758 /** 2759 * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. 2760 * 2761 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) 2762 */ 2763 get hostname(): string; 2764 /** 2765 * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. 2766 * 2767 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) 2768 */ 2769 set hostname(value: string); 2770 /** 2771 * The **`port`** property of the URL interface is a string containing the port number of the URL. 2772 * 2773 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) 2774 */ 2775 get port(): string; 2776 /** 2777 * The **`port`** property of the URL interface is a string containing the port number of the URL. 2778 * 2779 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) 2780 */ 2781 set port(value: string); 2782 /** 2783 * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. 2784 * 2785 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) 2786 */ 2787 get pathname(): string; 2788 /** 2789 * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. 2790 * 2791 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) 2792 */ 2793 set pathname(value: string); 2794 /** 2795 * 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. 2796 * 2797 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) 2798 */ 2799 get search(): string; 2800 /** 2801 * 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. 2802 * 2803 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) 2804 */ 2805 set search(value: string); 2806 /** 2807 * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL. 2808 * 2809 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) 2810 */ 2811 get hash(): string; 2812 /** 2813 * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL. 2814 * 2815 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) 2816 */ 2817 set hash(value: string); 2818 /** 2819 * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL. 2820 * 2821 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) 2822 */ 2823 get searchParams(): URLSearchParams; 2824 /** 2825 * 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. 2826 * 2827 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) 2828 */ 2829 toJSON(): string; 2830 /*function toString() { [native code] }*/ 2831 toString(): string; 2832 /** 2833 * 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. 2834 * 2835 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) 2836 */ 2837 static canParse(url: string, base?: string): boolean; 2838 /** 2839 * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters. 2840 * 2841 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static) 2842 */ 2843 static parse(url: string, base?: string): URL | null; 2844 /** 2845 * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter. 2846 * 2847 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static) 2848 */ 2849 static createObjectURL(object: File | Blob): string; 2850 /** 2851 * 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. 2852 * 2853 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static) 2854 */ 2855 static revokeObjectURL(object_url: string): void; 2856} 2857/** 2858 * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL. 2859 * 2860 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) 2861 */ 2862declare class URLSearchParams { 2863 constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string)); 2864 /** 2865 * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries. 2866 * 2867 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) 2868 */ 2869 get size(): number; 2870 /** 2871 * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter. 2872 * 2873 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append) 2874 */ 2875 append(name: string, value: string): void; 2876 /** 2877 * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters. 2878 * 2879 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete) 2880 */ 2881 delete(name: string, value?: string): void; 2882 /** 2883 * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter. 2884 * 2885 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get) 2886 */ 2887 get(name: string): string | null; 2888 /** 2889 * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array. 2890 * 2891 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll) 2892 */ 2893 getAll(name: string): string[]; 2894 /** 2895 * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters. 2896 * 2897 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has) 2898 */ 2899 has(name: string, value?: string): boolean; 2900 /** 2901 * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value. 2902 * 2903 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set) 2904 */ 2905 set(name: string, value: string): void; 2906 /** 2907 * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`. 2908 * 2909 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) 2910 */ 2911 sort(): void; 2912 /* Returns an array of key, value pairs for every entry in the search params. */ 2913 entries(): IterableIterator<[ 2914 key: string, 2915 value: string 2916 ]>; 2917 /* Returns a list of keys in the search params. */ 2918 keys(): IterableIterator<string>; 2919 /* Returns a list of values in the search params. */ 2920 values(): IterableIterator<string>; 2921 forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void; 2922 /*function toString() { [native code] }*/ 2923 toString(): string; 2924 [Symbol.iterator](): IterableIterator<[ 2925 key: string, 2926 value: string 2927 ]>; 2928} 2929declare class URLPattern { 2930 constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions); 2931 get protocol(): string; 2932 get username(): string; 2933 get password(): string; 2934 get hostname(): string; 2935 get port(): string; 2936 get pathname(): string; 2937 get search(): string; 2938 get hash(): string; 2939 get hasRegExpGroups(): boolean; 2940 test(input?: (string | URLPatternInit), baseURL?: string): boolean; 2941 exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null; 2942} 2943interface URLPatternInit { 2944 protocol?: string; 2945 username?: string; 2946 password?: string; 2947 hostname?: string; 2948 port?: string; 2949 pathname?: string; 2950 search?: string; 2951 hash?: string; 2952 baseURL?: string; 2953} 2954interface URLPatternComponentResult { 2955 input: string; 2956 groups: Record<string, string>; 2957} 2958interface URLPatternResult { 2959 inputs: (string | URLPatternInit)[]; 2960 protocol: URLPatternComponentResult; 2961 username: URLPatternComponentResult; 2962 password: URLPatternComponentResult; 2963 hostname: URLPatternComponentResult; 2964 port: URLPatternComponentResult; 2965 pathname: URLPatternComponentResult; 2966 search: URLPatternComponentResult; 2967 hash: URLPatternComponentResult; 2968} 2969interface URLPatternOptions { 2970 ignoreCase?: boolean; 2971} 2972/** 2973 * A `CloseEvent` is sent to clients using WebSockets when the connection is closed. 2974 * 2975 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent) 2976 */ 2977declare class CloseEvent extends Event { 2978 constructor(type: string, initializer?: CloseEventInit); 2979 /** 2980 * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed. 2981 * 2982 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) 2983 */ 2984 readonly code: number; 2985 /** 2986 * 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. 2987 * 2988 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason) 2989 */ 2990 readonly reason: string; 2991 /** 2992 * The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly. 2993 * 2994 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean) 2995 */ 2996 readonly wasClean: boolean; 2997} 2998interface CloseEventInit { 2999 code?: number; 3000 reason?: string; 3001 wasClean?: boolean; 3002} 3003type WebSocketEventMap = { 3004 close: CloseEvent; 3005 message: MessageEvent; 3006 open: Event; 3007 error: ErrorEvent; 3008}; 3009/** 3010 * 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. 3011 * 3012 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket) 3013 */ 3014declare var WebSocket: { 3015 prototype: WebSocket; 3016 new (url: string, protocols?: (string[] | string)): WebSocket; 3017 readonly READY_STATE_CONNECTING: number; 3018 readonly CONNECTING: number; 3019 readonly READY_STATE_OPEN: number; 3020 readonly OPEN: number; 3021 readonly READY_STATE_CLOSING: number; 3022 readonly CLOSING: number; 3023 readonly READY_STATE_CLOSED: number; 3024 readonly CLOSED: number; 3025}; 3026/** 3027 * 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. 3028 * 3029 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket) 3030 */ 3031interface WebSocket extends EventTarget<WebSocketEventMap> { 3032 accept(): void; 3033 /** 3034 * 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. 3035 * 3036 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send) 3037 */ 3038 send(message: (ArrayBuffer | ArrayBufferView) | string): void; 3039 /** 3040 * The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing. 3041 * 3042 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close) 3043 */ 3044 close(code?: number, reason?: string): void; 3045 serializeAttachment(attachment: any): void; 3046 deserializeAttachment(): any | null; 3047 /** 3048 * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection. 3049 * 3050 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState) 3051 */ 3052 readyState: number; 3053 /** 3054 * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor. 3055 * 3056 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url) 3057 */ 3058 url: string | null; 3059 /** 3060 * 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. 3061 * 3062 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol) 3063 */ 3064 protocol: string | null; 3065 /** 3066 * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server. 3067 * 3068 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions) 3069 */ 3070 extensions: string | null; 3071} 3072declare const WebSocketPair: { 3073 new (): { 3074 0: WebSocket; 3075 1: WebSocket; 3076 }; 3077}; 3078interface SqlStorage { 3079 exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>; 3080 get databaseSize(): number; 3081 Cursor: typeof SqlStorageCursor; 3082 Statement: typeof SqlStorageStatement; 3083} 3084declare abstract class SqlStorageStatement { 3085} 3086type SqlStorageValue = ArrayBuffer | string | number | null; 3087declare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> { 3088 next(): { 3089 done?: false; 3090 value: T; 3091 } | { 3092 done: true; 3093 value?: never; 3094 }; 3095 toArray(): T[]; 3096 one(): T; 3097 raw<U extends SqlStorageValue[]>(): IterableIterator<U>; 3098 columnNames: string[]; 3099 get rowsRead(): number; 3100 get rowsWritten(): number; 3101 [Symbol.iterator](): IterableIterator<T>; 3102} 3103interface Socket { 3104 get readable(): ReadableStream; 3105 get writable(): WritableStream; 3106 get closed(): Promise<void>; 3107 get opened(): Promise<SocketInfo>; 3108 get upgraded(): boolean; 3109 get secureTransport(): "on" | "off" | "starttls"; 3110 close(): Promise<void>; 3111 startTls(options?: TlsOptions): Socket; 3112} 3113interface SocketOptions { 3114 secureTransport?: string; 3115 allowHalfOpen: boolean; 3116 highWaterMark?: (number | bigint); 3117} 3118interface SocketAddress { 3119 hostname: string; 3120 port: number; 3121} 3122interface TlsOptions { 3123 expectedServerHostname?: string; 3124} 3125interface SocketInfo { 3126 remoteAddress?: string; 3127 localAddress?: string; 3128} 3129/** 3130 * The **`EventSource`** interface is web content's interface to server-sent events. 3131 * 3132 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) 3133 */ 3134declare class EventSource extends EventTarget { 3135 constructor(url: string, init?: EventSourceEventSourceInit); 3136 /** 3137 * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None. 3138 * 3139 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close) 3140 */ 3141 close(): void; 3142 /** 3143 * The **`url`** read-only property of the URL of the source. 3144 * 3145 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url) 3146 */ 3147 get url(): string; 3148 /** 3149 * The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set. 3150 * 3151 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials) 3152 */ 3153 get withCredentials(): boolean; 3154 /** 3155 * The **`readyState`** read-only property of the connection. 3156 * 3157 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState) 3158 */ 3159 get readyState(): number; 3160 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ 3161 get onopen(): any | null; 3162 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ 3163 set onopen(value: any | null); 3164 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ 3165 get onmessage(): any | null; 3166 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ 3167 set onmessage(value: any | null); 3168 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ 3169 get onerror(): any | null; 3170 /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ 3171 set onerror(value: any | null); 3172 static readonly CONNECTING: number; 3173 static readonly OPEN: number; 3174 static readonly CLOSED: number; 3175 static from(stream: ReadableStream): EventSource; 3176} 3177interface EventSourceEventSourceInit { 3178 withCredentials?: boolean; 3179 fetcher?: Fetcher; 3180} 3181interface Container { 3182 get running(): boolean; 3183 start(options?: ContainerStartupOptions): void; 3184 monitor(): Promise<void>; 3185 destroy(error?: any): Promise<void>; 3186 signal(signo: number): void; 3187 getTcpPort(port: number): Fetcher; 3188 setInactivityTimeout(durationMs: number | bigint): Promise<void>; 3189} 3190interface ContainerStartupOptions { 3191 entrypoint?: string[]; 3192 enableInternet: boolean; 3193 env?: Record<string, string>; 3194 hardTimeout?: (number | bigint); 3195} 3196/** 3197 * 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. 3198 * 3199 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort) 3200 */ 3201declare abstract class MessagePort extends EventTarget { 3202 /** 3203 * The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts. 3204 * 3205 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage) 3206 */ 3207 postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void; 3208 /** 3209 * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. 3210 * 3211 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close) 3212 */ 3213 close(): void; 3214 /** 3215 * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. 3216 * 3217 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start) 3218 */ 3219 start(): void; 3220 get onmessage(): any | null; 3221 set onmessage(value: any | null); 3222} 3223/** 3224 * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties. 3225 * 3226 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel) 3227 */ 3228declare class MessageChannel { 3229 constructor(); 3230 /** 3231 * The **`port1`** read-only property of the the port attached to the context that originated the channel. 3232 * 3233 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1) 3234 */ 3235 readonly port1: MessagePort; 3236 /** 3237 * The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to. 3238 * 3239 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2) 3240 */ 3241 readonly port2: MessagePort; 3242} 3243interface MessagePortPostMessageOptions { 3244 transfer?: any[]; 3245} 3246type 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; 3247type LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: { 3248 props?: Props; 3249}) => Fetcher<T> : (opts: { 3250 props?: any; 3251}) => Fetcher<T>); 3252type LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: { 3253 props?: Props; 3254}) => DurableObjectClass<T> : (opts: { 3255 props?: any; 3256}) => DurableObjectClass<T>); 3257interface SyncKvStorage { 3258 get<T = unknown>(key: string): T | undefined; 3259 list<T = unknown>(options?: SyncKvListOptions): Iterable<[ 3260 string, 3261 T 3262 ]>; 3263 put<T>(key: string, value: T): void; 3264 delete(key: string): boolean; 3265} 3266interface SyncKvListOptions { 3267 start?: string; 3268 startAfter?: string; 3269 end?: string; 3270 prefix?: string; 3271 reverse?: boolean; 3272 limit?: number; 3273} 3274interface WorkerStub { 3275 getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>; 3276} 3277interface WorkerStubEntrypointOptions { 3278 props?: any; 3279} 3280interface WorkerLoader { 3281 get(name: string, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub; 3282} 3283interface WorkerLoaderModule { 3284 js?: string; 3285 cjs?: string; 3286 text?: string; 3287 data?: ArrayBuffer; 3288 json?: any; 3289 py?: string; 3290 wasm?: ArrayBuffer; 3291} 3292interface WorkerLoaderWorkerCode { 3293 compatibilityDate: string; 3294 compatibilityFlags?: string[]; 3295 allowExperimental?: boolean; 3296 mainModule: string; 3297 modules: Record<string, WorkerLoaderModule | string>; 3298 env?: any; 3299 globalOutbound?: (Fetcher | null); 3300 tails?: Fetcher[]; 3301 streamingTails?: Fetcher[]; 3302} 3303/** 3304* The Workers runtime supports a subset of the Performance API, used to measure timing and performance, 3305* as well as timing of subrequests and other operations. 3306* 3307* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/) 3308*/ 3309declare abstract class Performance { 3310 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */ 3311 get timeOrigin(): number; 3312 /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */ 3313 now(): number; 3314} 3315type AiImageClassificationInput = { 3316 image: number[]; 3317}; 3318type AiImageClassificationOutput = { 3319 score?: number; 3320 label?: string; 3321}[]; 3322declare abstract class BaseAiImageClassification { 3323 inputs: AiImageClassificationInput; 3324 postProcessedOutputs: AiImageClassificationOutput; 3325} 3326type AiImageToTextInput = { 3327 image: number[]; 3328 prompt?: string; 3329 max_tokens?: number; 3330 temperature?: number; 3331 top_p?: number; 3332 top_k?: number; 3333 seed?: number; 3334 repetition_penalty?: number; 3335 frequency_penalty?: number; 3336 presence_penalty?: number; 3337 raw?: boolean; 3338 messages?: RoleScopedChatInput[]; 3339}; 3340type AiImageToTextOutput = { 3341 description: string; 3342}; 3343declare abstract class BaseAiImageToText { 3344 inputs: AiImageToTextInput; 3345 postProcessedOutputs: AiImageToTextOutput; 3346} 3347type AiImageTextToTextInput = { 3348 image: string; 3349 prompt?: string; 3350 max_tokens?: number; 3351 temperature?: number; 3352 ignore_eos?: boolean; 3353 top_p?: number; 3354 top_k?: number; 3355 seed?: number; 3356 repetition_penalty?: number; 3357 frequency_penalty?: number; 3358 presence_penalty?: number; 3359 raw?: boolean; 3360 messages?: RoleScopedChatInput[]; 3361}; 3362type AiImageTextToTextOutput = { 3363 description: string; 3364}; 3365declare abstract class BaseAiImageTextToText { 3366 inputs: AiImageTextToTextInput; 3367 postProcessedOutputs: AiImageTextToTextOutput; 3368} 3369type AiMultimodalEmbeddingsInput = { 3370 image: string; 3371 text: string[]; 3372}; 3373type AiIMultimodalEmbeddingsOutput = { 3374 data: number[][]; 3375 shape: number[]; 3376}; 3377declare abstract class BaseAiMultimodalEmbeddings { 3378 inputs: AiImageTextToTextInput; 3379 postProcessedOutputs: AiImageTextToTextOutput; 3380} 3381type AiObjectDetectionInput = { 3382 image: number[]; 3383}; 3384type AiObjectDetectionOutput = { 3385 score?: number; 3386 label?: string; 3387}[]; 3388declare abstract class BaseAiObjectDetection { 3389 inputs: AiObjectDetectionInput; 3390 postProcessedOutputs: AiObjectDetectionOutput; 3391} 3392type AiSentenceSimilarityInput = { 3393 source: string; 3394 sentences: string[]; 3395}; 3396type AiSentenceSimilarityOutput = number[]; 3397declare abstract class BaseAiSentenceSimilarity { 3398 inputs: AiSentenceSimilarityInput; 3399 postProcessedOutputs: AiSentenceSimilarityOutput; 3400} 3401type AiAutomaticSpeechRecognitionInput = { 3402 audio: number[]; 3403}; 3404type AiAutomaticSpeechRecognitionOutput = { 3405 text?: string; 3406 words?: { 3407 word: string; 3408 start: number; 3409 end: number; 3410 }[]; 3411 vtt?: string; 3412}; 3413declare abstract class BaseAiAutomaticSpeechRecognition { 3414 inputs: AiAutomaticSpeechRecognitionInput; 3415 postProcessedOutputs: AiAutomaticSpeechRecognitionOutput; 3416} 3417type AiSummarizationInput = { 3418 input_text: string; 3419 max_length?: number; 3420}; 3421type AiSummarizationOutput = { 3422 summary: string; 3423}; 3424declare abstract class BaseAiSummarization { 3425 inputs: AiSummarizationInput; 3426 postProcessedOutputs: AiSummarizationOutput; 3427} 3428type AiTextClassificationInput = { 3429 text: string; 3430}; 3431type AiTextClassificationOutput = { 3432 score?: number; 3433 label?: string; 3434}[]; 3435declare abstract class BaseAiTextClassification { 3436 inputs: AiTextClassificationInput; 3437 postProcessedOutputs: AiTextClassificationOutput; 3438} 3439type AiTextEmbeddingsInput = { 3440 text: string | string[]; 3441}; 3442type AiTextEmbeddingsOutput = { 3443 shape: number[]; 3444 data: number[][]; 3445}; 3446declare abstract class BaseAiTextEmbeddings { 3447 inputs: AiTextEmbeddingsInput; 3448 postProcessedOutputs: AiTextEmbeddingsOutput; 3449} 3450type RoleScopedChatInput = { 3451 role: "user" | "assistant" | "system" | "tool" | (string & NonNullable<unknown>); 3452 content: string; 3453 name?: string; 3454}; 3455type AiTextGenerationToolLegacyInput = { 3456 name: string; 3457 description: string; 3458 parameters?: { 3459 type: "object" | (string & NonNullable<unknown>); 3460 properties: { 3461 [key: string]: { 3462 type: string; 3463 description?: string; 3464 }; 3465 }; 3466 required: string[]; 3467 }; 3468}; 3469type AiTextGenerationToolInput = { 3470 type: "function" | (string & NonNullable<unknown>); 3471 function: { 3472 name: string; 3473 description: string; 3474 parameters?: { 3475 type: "object" | (string & NonNullable<unknown>); 3476 properties: { 3477 [key: string]: { 3478 type: string; 3479 description?: string; 3480 }; 3481 }; 3482 required: string[]; 3483 }; 3484 }; 3485}; 3486type AiTextGenerationFunctionsInput = { 3487 name: string; 3488 code: string; 3489}; 3490type AiTextGenerationResponseFormat = { 3491 type: string; 3492 json_schema?: any; 3493}; 3494type AiTextGenerationInput = { 3495 prompt?: string; 3496 raw?: boolean; 3497 stream?: boolean; 3498 max_tokens?: number; 3499 temperature?: number; 3500 top_p?: number; 3501 top_k?: number; 3502 seed?: number; 3503 repetition_penalty?: number; 3504 frequency_penalty?: number; 3505 presence_penalty?: number; 3506 messages?: RoleScopedChatInput[]; 3507 response_format?: AiTextGenerationResponseFormat; 3508 tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>); 3509 functions?: AiTextGenerationFunctionsInput[]; 3510}; 3511type AiTextGenerationToolLegacyOutput = { 3512 name: string; 3513 arguments: unknown; 3514}; 3515type AiTextGenerationToolOutput = { 3516 id: string; 3517 type: "function"; 3518 function: { 3519 name: string; 3520 arguments: string; 3521 }; 3522}; 3523type UsageTags = { 3524 prompt_tokens: number; 3525 completion_tokens: number; 3526 total_tokens: number; 3527}; 3528type AiTextGenerationOutput = { 3529 response?: string; 3530 tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[]; 3531 usage?: UsageTags; 3532}; 3533declare abstract class BaseAiTextGeneration { 3534 inputs: AiTextGenerationInput; 3535 postProcessedOutputs: AiTextGenerationOutput; 3536} 3537type AiTextToSpeechInput = { 3538 prompt: string; 3539 lang?: string; 3540}; 3541type AiTextToSpeechOutput = Uint8Array | { 3542 audio: string; 3543}; 3544declare abstract class BaseAiTextToSpeech { 3545 inputs: AiTextToSpeechInput; 3546 postProcessedOutputs: AiTextToSpeechOutput; 3547} 3548type AiTextToImageInput = { 3549 prompt: string; 3550 negative_prompt?: string; 3551 height?: number; 3552 width?: number; 3553 image?: number[]; 3554 image_b64?: string; 3555 mask?: number[]; 3556 num_steps?: number; 3557 strength?: number; 3558 guidance?: number; 3559 seed?: number; 3560}; 3561type AiTextToImageOutput = ReadableStream<Uint8Array>; 3562declare abstract class BaseAiTextToImage { 3563 inputs: AiTextToImageInput; 3564 postProcessedOutputs: AiTextToImageOutput; 3565} 3566type AiTranslationInput = { 3567 text: string; 3568 target_lang: string; 3569 source_lang?: string; 3570}; 3571type AiTranslationOutput = { 3572 translated_text?: string; 3573}; 3574declare abstract class BaseAiTranslation { 3575 inputs: AiTranslationInput; 3576 postProcessedOutputs: AiTranslationOutput; 3577} 3578/** 3579 * Workers AI support for OpenAI's Responses API 3580 * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts 3581 * 3582 * It's a stripped down version from its source. 3583 * It currently supports basic function calling, json mode and accepts images as input. 3584 * 3585 * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools. 3586 * We plan to add those incrementally as model + platform capabilities evolve. 3587 */ 3588type ResponsesInput = { 3589 background?: boolean | null; 3590 conversation?: string | ResponseConversationParam | null; 3591 include?: Array<ResponseIncludable> | null; 3592 input?: string | ResponseInput; 3593 instructions?: string | null; 3594 max_output_tokens?: number | null; 3595 parallel_tool_calls?: boolean | null; 3596 previous_response_id?: string | null; 3597 prompt_cache_key?: string; 3598 reasoning?: Reasoning | null; 3599 safety_identifier?: string; 3600 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; 3601 stream?: boolean | null; 3602 stream_options?: StreamOptions | null; 3603 temperature?: number | null; 3604 text?: ResponseTextConfig; 3605 tool_choice?: ToolChoiceOptions | ToolChoiceFunction; 3606 tools?: Array<Tool>; 3607 top_p?: number | null; 3608 truncation?: "auto" | "disabled" | null; 3609}; 3610type ResponsesOutput = { 3611 id?: string; 3612 created_at?: number; 3613 output_text?: string; 3614 error?: ResponseError | null; 3615 incomplete_details?: ResponseIncompleteDetails | null; 3616 instructions?: string | Array<ResponseInputItem> | null; 3617 object?: "response"; 3618 output?: Array<ResponseOutputItem>; 3619 parallel_tool_calls?: boolean; 3620 temperature?: number | null; 3621 tool_choice?: ToolChoiceOptions | ToolChoiceFunction; 3622 tools?: Array<Tool>; 3623 top_p?: number | null; 3624 max_output_tokens?: number | null; 3625 previous_response_id?: string | null; 3626 prompt?: ResponsePrompt | null; 3627 reasoning?: Reasoning | null; 3628 safety_identifier?: string; 3629 service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null; 3630 status?: ResponseStatus; 3631 text?: ResponseTextConfig; 3632 truncation?: "auto" | "disabled" | null; 3633 usage?: ResponseUsage; 3634}; 3635type EasyInputMessage = { 3636 content: string | ResponseInputMessageContentList; 3637 role: "user" | "assistant" | "system" | "developer"; 3638 type?: "message"; 3639}; 3640type ResponsesFunctionTool = { 3641 name: string; 3642 parameters: { 3643 [key: string]: unknown; 3644 } | null; 3645 strict: boolean | null; 3646 type: "function"; 3647 description?: string | null; 3648}; 3649type ResponseIncompleteDetails = { 3650 reason?: "max_output_tokens" | "content_filter"; 3651}; 3652type ResponsePrompt = { 3653 id: string; 3654 variables?: { 3655 [key: string]: string | ResponseInputText | ResponseInputImage; 3656 } | null; 3657 version?: string | null; 3658}; 3659type Reasoning = { 3660 effort?: ReasoningEffort | null; 3661 generate_summary?: "auto" | "concise" | "detailed" | null; 3662 summary?: "auto" | "concise" | "detailed" | null; 3663}; 3664type ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText; 3665type ResponseContentReasoningText = { 3666 text: string; 3667 type: "reasoning_text"; 3668}; 3669type ResponseConversationParam = { 3670 id: string; 3671}; 3672type ResponseCreatedEvent = { 3673 response: Response; 3674 sequence_number: number; 3675 type: "response.created"; 3676}; 3677type ResponseCustomToolCallOutput = { 3678 call_id: string; 3679 output: string | Array<ResponseInputText | ResponseInputImage>; 3680 type: "custom_tool_call_output"; 3681 id?: string; 3682}; 3683type ResponseError = { 3684 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"; 3685 message: string; 3686}; 3687type ResponseErrorEvent = { 3688 code: string | null; 3689 message: string; 3690 param: string | null; 3691 sequence_number: number; 3692 type: "error"; 3693}; 3694type ResponseFailedEvent = { 3695 response: Response; 3696 sequence_number: number; 3697 type: "response.failed"; 3698}; 3699type ResponseFormatText = { 3700 type: "text"; 3701}; 3702type ResponseFormatJSONObject = { 3703 type: "json_object"; 3704}; 3705type ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject; 3706type ResponseFormatTextJSONSchemaConfig = { 3707 name: string; 3708 schema: { 3709 [key: string]: unknown; 3710 }; 3711 type: "json_schema"; 3712 description?: string; 3713 strict?: boolean | null; 3714}; 3715type ResponseFunctionCallArgumentsDeltaEvent = { 3716 delta: string; 3717 item_id: string; 3718 output_index: number; 3719 sequence_number: number; 3720 type: "response.function_call_arguments.delta"; 3721}; 3722type ResponseFunctionCallArgumentsDoneEvent = { 3723 arguments: string; 3724 item_id: string; 3725 name: string; 3726 output_index: number; 3727 sequence_number: number; 3728 type: "response.function_call_arguments.done"; 3729}; 3730type ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent; 3731type ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>; 3732type ResponseFunctionToolCall = { 3733 arguments: string; 3734 call_id: string; 3735 name: string; 3736 type: "function_call"; 3737 id?: string; 3738 status?: "in_progress" | "completed" | "incomplete"; 3739}; 3740interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall { 3741 id: string; 3742} 3743type ResponseFunctionToolCallOutputItem = { 3744 id: string; 3745 call_id: string; 3746 output: string | Array<ResponseInputText | ResponseInputImage>; 3747 type: "function_call_output"; 3748 status?: "in_progress" | "completed" | "incomplete"; 3749}; 3750type ResponseIncludable = "message.input_image.image_url" | "message.output_text.logprobs"; 3751type ResponseIncompleteEvent = { 3752 response: Response; 3753 sequence_number: number; 3754 type: "response.incomplete"; 3755}; 3756type ResponseInput = Array<ResponseInputItem>; 3757type ResponseInputContent = ResponseInputText | ResponseInputImage; 3758type ResponseInputImage = { 3759 detail: "low" | "high" | "auto"; 3760 type: "input_image"; 3761 /** 3762 * Base64 encoded image 3763 */ 3764 image_url?: string | null; 3765}; 3766type ResponseInputImageContent = { 3767 type: "input_image"; 3768 detail?: "low" | "high" | "auto" | null; 3769 /** 3770 * Base64 encoded image 3771 */ 3772 image_url?: string | null; 3773}; 3774type ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem; 3775type ResponseInputItemFunctionCallOutput = { 3776 call_id: string; 3777 output: string | ResponseFunctionCallOutputItemList; 3778 type: "function_call_output"; 3779 id?: string | null; 3780 status?: "in_progress" | "completed" | "incomplete" | null; 3781}; 3782type ResponseInputItemMessage = { 3783 content: ResponseInputMessageContentList; 3784 role: "user" | "system" | "developer"; 3785 status?: "in_progress" | "completed" | "incomplete"; 3786 type?: "message"; 3787}; 3788type ResponseInputMessageContentList = Array<ResponseInputContent>; 3789type ResponseInputMessageItem = { 3790 id: string; 3791 content: ResponseInputMessageContentList; 3792 role: "user" | "system" | "developer"; 3793 status?: "in_progress" | "completed" | "incomplete"; 3794 type?: "message"; 3795}; 3796type ResponseInputText = { 3797 text: string; 3798 type: "input_text"; 3799}; 3800type ResponseInputTextContent = { 3801 text: string; 3802 type: "input_text"; 3803}; 3804type ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem; 3805type ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem; 3806type ResponseOutputItemAddedEvent = { 3807 item: ResponseOutputItem; 3808 output_index: number; 3809 sequence_number: number; 3810 type: "response.output_item.added"; 3811}; 3812type ResponseOutputItemDoneEvent = { 3813 item: ResponseOutputItem; 3814 output_index: number; 3815 sequence_number: number; 3816 type: "response.output_item.done"; 3817}; 3818type ResponseOutputMessage = { 3819 id: string; 3820 content: Array<ResponseOutputText | ResponseOutputRefusal>; 3821 role: "assistant"; 3822 status: "in_progress" | "completed" | "incomplete"; 3823 type: "message"; 3824}; 3825type ResponseOutputRefusal = { 3826 refusal: string; 3827 type: "refusal"; 3828}; 3829type ResponseOutputText = { 3830 text: string; 3831 type: "output_text"; 3832 logprobs?: Array<Logprob>; 3833}; 3834type ResponseReasoningItem = { 3835 id: string; 3836 summary: Array<ResponseReasoningSummaryItem>; 3837 type: "reasoning"; 3838 content?: Array<ResponseReasoningContentItem>; 3839 encrypted_content?: string | null; 3840 status?: "in_progress" | "completed" | "incomplete"; 3841}; 3842type ResponseReasoningSummaryItem = { 3843 text: string; 3844 type: "summary_text"; 3845}; 3846type ResponseReasoningContentItem = { 3847 text: string; 3848 type: "reasoning_text"; 3849}; 3850type ResponseReasoningTextDeltaEvent = { 3851 content_index: number; 3852 delta: string; 3853 item_id: string; 3854 output_index: number; 3855 sequence_number: number; 3856 type: "response.reasoning_text.delta"; 3857}; 3858type ResponseReasoningTextDoneEvent = { 3859 content_index: number; 3860 item_id: string; 3861 output_index: number; 3862 sequence_number: number; 3863 text: string; 3864 type: "response.reasoning_text.done"; 3865}; 3866type ResponseRefusalDeltaEvent = { 3867 content_index: number; 3868 delta: string; 3869 item_id: string; 3870 output_index: number; 3871 sequence_number: number; 3872 type: "response.refusal.delta"; 3873}; 3874type ResponseRefusalDoneEvent = { 3875 content_index: number; 3876 item_id: string; 3877 output_index: number; 3878 refusal: string; 3879 sequence_number: number; 3880 type: "response.refusal.done"; 3881}; 3882type ResponseStatus = "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete"; 3883type ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent; 3884type ResponseCompletedEvent = { 3885 response: Response; 3886 sequence_number: number; 3887 type: "response.completed"; 3888}; 3889type ResponseTextConfig = { 3890 format?: ResponseFormatTextConfig; 3891 verbosity?: "low" | "medium" | "high" | null; 3892}; 3893type ResponseTextDeltaEvent = { 3894 content_index: number; 3895 delta: string; 3896 item_id: string; 3897 logprobs: Array<Logprob>; 3898 output_index: number; 3899 sequence_number: number; 3900 type: "response.output_text.delta"; 3901}; 3902type ResponseTextDoneEvent = { 3903 content_index: number; 3904 item_id: string; 3905 logprobs: Array<Logprob>; 3906 output_index: number; 3907 sequence_number: number; 3908 text: string; 3909 type: "response.output_text.done"; 3910}; 3911type Logprob = { 3912 token: string; 3913 logprob: number; 3914 top_logprobs?: Array<TopLogprob>; 3915}; 3916type TopLogprob = { 3917 token?: string; 3918 logprob?: number; 3919}; 3920type ResponseUsage = { 3921 input_tokens: number; 3922 output_tokens: number; 3923 total_tokens: number; 3924}; 3925type Tool = ResponsesFunctionTool; 3926type ToolChoiceFunction = { 3927 name: string; 3928 type: "function"; 3929}; 3930type ToolChoiceOptions = "none"; 3931type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null; 3932type StreamOptions = { 3933 include_obfuscation?: boolean; 3934}; 3935type Ai_Cf_Baai_Bge_Base_En_V1_5_Input = { 3936 text: string | string[]; 3937 /** 3938 * 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. 3939 */ 3940 pooling?: "mean" | "cls"; 3941} | { 3942 /** 3943 * Batch of the embeddings requests to run using async-queue 3944 */ 3945 requests: { 3946 text: string | string[]; 3947 /** 3948 * 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. 3949 */ 3950 pooling?: "mean" | "cls"; 3951 }[]; 3952}; 3953type Ai_Cf_Baai_Bge_Base_En_V1_5_Output = { 3954 shape?: number[]; 3955 /** 3956 * Embeddings of the requested text values 3957 */ 3958 data?: number[][]; 3959 /** 3960 * The pooling method used in the embedding process. 3961 */ 3962 pooling?: "mean" | "cls"; 3963} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse; 3964interface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse { 3965 /** 3966 * The async request id that can be used to obtain the results. 3967 */ 3968 request_id?: string; 3969} 3970declare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 { 3971 inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input; 3972 postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output; 3973} 3974type Ai_Cf_Openai_Whisper_Input = string | { 3975 /** 3976 * An array of integers that represent the audio data constrained to 8-bit unsigned integer values 3977 */ 3978 audio: number[]; 3979}; 3980interface Ai_Cf_Openai_Whisper_Output { 3981 /** 3982 * The transcription 3983 */ 3984 text: string; 3985 word_count?: number; 3986 words?: { 3987 word?: string; 3988 /** 3989 * The second this word begins in the recording 3990 */ 3991 start?: number; 3992 /** 3993 * The ending second when the word completes 3994 */ 3995 end?: number; 3996 }[]; 3997 vtt?: string; 3998} 3999declare abstract class Base_Ai_Cf_Openai_Whisper { 4000 inputs: Ai_Cf_Openai_Whisper_Input; 4001 postProcessedOutputs: Ai_Cf_Openai_Whisper_Output; 4002} 4003type Ai_Cf_Meta_M2M100_1_2B_Input = { 4004 /** 4005 * The text to be translated 4006 */ 4007 text: string; 4008 /** 4009 * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified 4010 */ 4011 source_lang?: string; 4012 /** 4013 * The language code to translate the text into (e.g., 'es' for Spanish) 4014 */ 4015 target_lang: string; 4016} | { 4017 /** 4018 * Batch of the embeddings requests to run using async-queue 4019 */ 4020 requests: { 4021 /** 4022 * The text to be translated 4023 */ 4024 text: string; 4025 /** 4026 * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified 4027 */ 4028 source_lang?: string; 4029 /** 4030 * The language code to translate the text into (e.g., 'es' for Spanish) 4031 */ 4032 target_lang: string; 4033 }[]; 4034}; 4035type Ai_Cf_Meta_M2M100_1_2B_Output = { 4036 /** 4037 * The translated text in the target language 4038 */ 4039 translated_text?: string; 4040} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse; 4041interface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse { 4042 /** 4043 * The async request id that can be used to obtain the results. 4044 */ 4045 request_id?: string; 4046} 4047declare abstract class Base_Ai_Cf_Meta_M2M100_1_2B { 4048 inputs: Ai_Cf_Meta_M2M100_1_2B_Input; 4049 postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output; 4050} 4051type Ai_Cf_Baai_Bge_Small_En_V1_5_Input = { 4052 text: string | string[]; 4053 /** 4054 * 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. 4055 */ 4056 pooling?: "mean" | "cls"; 4057} | { 4058 /** 4059 * Batch of the embeddings requests to run using async-queue 4060 */ 4061 requests: { 4062 text: string | string[]; 4063 /** 4064 * 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. 4065 */ 4066 pooling?: "mean" | "cls"; 4067 }[]; 4068}; 4069type Ai_Cf_Baai_Bge_Small_En_V1_5_Output = { 4070 shape?: number[]; 4071 /** 4072 * Embeddings of the requested text values 4073 */ 4074 data?: number[][]; 4075 /** 4076 * The pooling method used in the embedding process. 4077 */ 4078 pooling?: "mean" | "cls"; 4079} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse; 4080interface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse { 4081 /** 4082 * The async request id that can be used to obtain the results. 4083 */ 4084 request_id?: string; 4085} 4086declare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 { 4087 inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input; 4088 postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output; 4089} 4090type Ai_Cf_Baai_Bge_Large_En_V1_5_Input = { 4091 text: string | string[]; 4092 /** 4093 * 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. 4094 */ 4095 pooling?: "mean" | "cls"; 4096} | { 4097 /** 4098 * Batch of the embeddings requests to run using async-queue 4099 */ 4100 requests: { 4101 text: string | string[]; 4102 /** 4103 * 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. 4104 */ 4105 pooling?: "mean" | "cls"; 4106 }[]; 4107}; 4108type Ai_Cf_Baai_Bge_Large_En_V1_5_Output = { 4109 shape?: number[]; 4110 /** 4111 * Embeddings of the requested text values 4112 */ 4113 data?: number[][]; 4114 /** 4115 * The pooling method used in the embedding process. 4116 */ 4117 pooling?: "mean" | "cls"; 4118} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse; 4119interface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse { 4120 /** 4121 * The async request id that can be used to obtain the results. 4122 */ 4123 request_id?: string; 4124} 4125declare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 { 4126 inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input; 4127 postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output; 4128} 4129type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | { 4130 /** 4131 * The input text prompt for the model to generate a response. 4132 */ 4133 prompt?: string; 4134 /** 4135 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 4136 */ 4137 raw?: boolean; 4138 /** 4139 * 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. 4140 */ 4141 top_p?: number; 4142 /** 4143 * 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. 4144 */ 4145 top_k?: number; 4146 /** 4147 * Random seed for reproducibility of the generation. 4148 */ 4149 seed?: number; 4150 /** 4151 * Penalty for repeated tokens; higher values discourage repetition. 4152 */ 4153 repetition_penalty?: number; 4154 /** 4155 * Decreases the likelihood of the model repeating the same lines verbatim. 4156 */ 4157 frequency_penalty?: number; 4158 /** 4159 * Increases the likelihood of the model introducing new topics. 4160 */ 4161 presence_penalty?: number; 4162 image: number[] | (string & NonNullable<unknown>); 4163 /** 4164 * The maximum number of tokens to generate in the response. 4165 */ 4166 max_tokens?: number; 4167}; 4168interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output { 4169 description?: string; 4170} 4171declare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M { 4172 inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input; 4173 postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output; 4174} 4175type Ai_Cf_Openai_Whisper_Tiny_En_Input = string | { 4176 /** 4177 * An array of integers that represent the audio data constrained to 8-bit unsigned integer values 4178 */ 4179 audio: number[]; 4180}; 4181interface Ai_Cf_Openai_Whisper_Tiny_En_Output { 4182 /** 4183 * The transcription 4184 */ 4185 text: string; 4186 word_count?: number; 4187 words?: { 4188 word?: string; 4189 /** 4190 * The second this word begins in the recording 4191 */ 4192 start?: number; 4193 /** 4194 * The ending second when the word completes 4195 */ 4196 end?: number; 4197 }[]; 4198 vtt?: string; 4199} 4200declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En { 4201 inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input; 4202 postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output; 4203} 4204interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input { 4205 /** 4206 * Base64 encoded value of the audio data. 4207 */ 4208 audio: string; 4209 /** 4210 * Supported tasks are 'translate' or 'transcribe'. 4211 */ 4212 task?: string; 4213 /** 4214 * The language of the audio being transcribed or translated. 4215 */ 4216 language?: string; 4217 /** 4218 * Preprocess the audio with a voice activity detection model. 4219 */ 4220 vad_filter?: boolean; 4221 /** 4222 * A text prompt to help provide context to the model on the contents of the audio. 4223 */ 4224 initial_prompt?: string; 4225 /** 4226 * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result. 4227 */ 4228 prefix?: string; 4229} 4230interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output { 4231 transcription_info?: { 4232 /** 4233 * The language of the audio being transcribed or translated. 4234 */ 4235 language?: string; 4236 /** 4237 * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1. 4238 */ 4239 language_probability?: number; 4240 /** 4241 * The total duration of the original audio file, in seconds. 4242 */ 4243 duration?: number; 4244 /** 4245 * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds. 4246 */ 4247 duration_after_vad?: number; 4248 }; 4249 /** 4250 * The complete transcription of the audio. 4251 */ 4252 text: string; 4253 /** 4254 * The total number of words in the transcription. 4255 */ 4256 word_count?: number; 4257 segments?: { 4258 /** 4259 * The starting time of the segment within the audio, in seconds. 4260 */ 4261 start?: number; 4262 /** 4263 * The ending time of the segment within the audio, in seconds. 4264 */ 4265 end?: number; 4266 /** 4267 * The transcription of the segment. 4268 */ 4269 text?: string; 4270 /** 4271 * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs. 4272 */ 4273 temperature?: number; 4274 /** 4275 * The average log probability of the predictions for the words in this segment, indicating overall confidence. 4276 */ 4277 avg_logprob?: number; 4278 /** 4279 * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process. 4280 */ 4281 compression_ratio?: number; 4282 /** 4283 * The probability that the segment contains no speech, represented as a decimal between 0 and 1. 4284 */ 4285 no_speech_prob?: number; 4286 words?: { 4287 /** 4288 * The individual word transcribed from the audio. 4289 */ 4290 word?: string; 4291 /** 4292 * The starting time of the word within the audio, in seconds. 4293 */ 4294 start?: number; 4295 /** 4296 * The ending time of the word within the audio, in seconds. 4297 */ 4298 end?: number; 4299 }[]; 4300 }[]; 4301 /** 4302 * The transcription in WebVTT format, which includes timing and text information for use in subtitles. 4303 */ 4304 vtt?: string; 4305} 4306declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo { 4307 inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input; 4308 postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output; 4309} 4310type Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | { 4311 /** 4312 * Batch of the embeddings requests to run using async-queue 4313 */ 4314 requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[]; 4315}; 4316interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts { 4317 /** 4318 * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts 4319 */ 4320 query?: string; 4321 /** 4322 * List of provided contexts. Note that the index in this array is important, as the response will refer to it. 4323 */ 4324 contexts: { 4325 /** 4326 * One of the provided context content 4327 */ 4328 text?: string; 4329 }[]; 4330 /** 4331 * When provided with too long context should the model error out or truncate the context to fit? 4332 */ 4333 truncate_inputs?: boolean; 4334} 4335interface Ai_Cf_Baai_Bge_M3_Input_Embedding { 4336 text: string | string[]; 4337 /** 4338 * When provided with too long context should the model error out or truncate the context to fit? 4339 */ 4340 truncate_inputs?: boolean; 4341} 4342interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 { 4343 /** 4344 * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts 4345 */ 4346 query?: string; 4347 /** 4348 * List of provided contexts. Note that the index in this array is important, as the response will refer to it. 4349 */ 4350 contexts: { 4351 /** 4352 * One of the provided context content 4353 */ 4354 text?: string; 4355 }[]; 4356 /** 4357 * When provided with too long context should the model error out or truncate the context to fit? 4358 */ 4359 truncate_inputs?: boolean; 4360} 4361interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 { 4362 text: string | string[]; 4363 /** 4364 * When provided with too long context should the model error out or truncate the context to fit? 4365 */ 4366 truncate_inputs?: boolean; 4367} 4368type Ai_Cf_Baai_Bge_M3_Output = Ai_Cf_Baai_Bge_M3_Ouput_Query | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts | Ai_Cf_Baai_Bge_M3_Ouput_Embedding | Ai_Cf_Baai_Bge_M3_AsyncResponse; 4369interface Ai_Cf_Baai_Bge_M3_Ouput_Query { 4370 response?: { 4371 /** 4372 * Index of the context in the request 4373 */ 4374 id?: number; 4375 /** 4376 * Score of the context under the index. 4377 */ 4378 score?: number; 4379 }[]; 4380} 4381interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts { 4382 response?: number[][]; 4383 shape?: number[]; 4384 /** 4385 * The pooling method used in the embedding process. 4386 */ 4387 pooling?: "mean" | "cls"; 4388} 4389interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding { 4390 shape?: number[]; 4391 /** 4392 * Embeddings of the requested text values 4393 */ 4394 data?: number[][]; 4395 /** 4396 * The pooling method used in the embedding process. 4397 */ 4398 pooling?: "mean" | "cls"; 4399} 4400interface Ai_Cf_Baai_Bge_M3_AsyncResponse { 4401 /** 4402 * The async request id that can be used to obtain the results. 4403 */ 4404 request_id?: string; 4405} 4406declare abstract class Base_Ai_Cf_Baai_Bge_M3 { 4407 inputs: Ai_Cf_Baai_Bge_M3_Input; 4408 postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output; 4409} 4410interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input { 4411 /** 4412 * A text description of the image you want to generate. 4413 */ 4414 prompt: string; 4415 /** 4416 * The number of diffusion steps; higher values can improve quality but take longer. 4417 */ 4418 steps?: number; 4419} 4420interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output { 4421 /** 4422 * The generated image in Base64 format. 4423 */ 4424 image?: string; 4425} 4426declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell { 4427 inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input; 4428 postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output; 4429} 4430type 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; 4431interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt { 4432 /** 4433 * The input text prompt for the model to generate a response. 4434 */ 4435 prompt: string; 4436 image?: number[] | (string & NonNullable<unknown>); 4437 /** 4438 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 4439 */ 4440 raw?: boolean; 4441 /** 4442 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 4443 */ 4444 stream?: boolean; 4445 /** 4446 * The maximum number of tokens to generate in the response. 4447 */ 4448 max_tokens?: number; 4449 /** 4450 * Controls the randomness of the output; higher values produce more random results. 4451 */ 4452 temperature?: number; 4453 /** 4454 * 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. 4455 */ 4456 top_p?: number; 4457 /** 4458 * 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. 4459 */ 4460 top_k?: number; 4461 /** 4462 * Random seed for reproducibility of the generation. 4463 */ 4464 seed?: number; 4465 /** 4466 * Penalty for repeated tokens; higher values discourage repetition. 4467 */ 4468 repetition_penalty?: number; 4469 /** 4470 * Decreases the likelihood of the model repeating the same lines verbatim. 4471 */ 4472 frequency_penalty?: number; 4473 /** 4474 * Increases the likelihood of the model introducing new topics. 4475 */ 4476 presence_penalty?: number; 4477 /** 4478 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 4479 */ 4480 lora?: string; 4481} 4482interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages { 4483 /** 4484 * An array of message objects representing the conversation history. 4485 */ 4486 messages: { 4487 /** 4488 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 4489 */ 4490 role?: string; 4491 /** 4492 * 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 4493 */ 4494 tool_call_id?: string; 4495 content?: string | { 4496 /** 4497 * Type of the content provided 4498 */ 4499 type?: string; 4500 text?: string; 4501 image_url?: { 4502 /** 4503 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 4504 */ 4505 url?: string; 4506 }; 4507 }[] | { 4508 /** 4509 * Type of the content provided 4510 */ 4511 type?: string; 4512 text?: string; 4513 image_url?: { 4514 /** 4515 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 4516 */ 4517 url?: string; 4518 }; 4519 }; 4520 }[]; 4521 image?: number[] | (string & NonNullable<unknown>); 4522 functions?: { 4523 name: string; 4524 code: string; 4525 }[]; 4526 /** 4527 * A list of tools available for the assistant to use. 4528 */ 4529 tools?: ({ 4530 /** 4531 * The name of the tool. More descriptive the better. 4532 */ 4533 name: string; 4534 /** 4535 * A brief description of what the tool does. 4536 */ 4537 description: string; 4538 /** 4539 * Schema defining the parameters accepted by the tool. 4540 */ 4541 parameters: { 4542 /** 4543 * The type of the parameters object (usually 'object'). 4544 */ 4545 type: string; 4546 /** 4547 * List of required parameter names. 4548 */ 4549 required?: string[]; 4550 /** 4551 * Definitions of each parameter. 4552 */ 4553 properties: { 4554 [k: string]: { 4555 /** 4556 * The data type of the parameter. 4557 */ 4558 type: string; 4559 /** 4560 * A description of the expected parameter. 4561 */ 4562 description: string; 4563 }; 4564 }; 4565 }; 4566 } | { 4567 /** 4568 * Specifies the type of tool (e.g., 'function'). 4569 */ 4570 type: string; 4571 /** 4572 * Details of the function tool. 4573 */ 4574 function: { 4575 /** 4576 * The name of the function. 4577 */ 4578 name: string; 4579 /** 4580 * A brief description of what the function does. 4581 */ 4582 description: string; 4583 /** 4584 * Schema defining the parameters accepted by the function. 4585 */ 4586 parameters: { 4587 /** 4588 * The type of the parameters object (usually 'object'). 4589 */ 4590 type: string; 4591 /** 4592 * List of required parameter names. 4593 */ 4594 required?: string[]; 4595 /** 4596 * Definitions of each parameter. 4597 */ 4598 properties: { 4599 [k: string]: { 4600 /** 4601 * The data type of the parameter. 4602 */ 4603 type: string; 4604 /** 4605 * A description of the expected parameter. 4606 */ 4607 description: string; 4608 }; 4609 }; 4610 }; 4611 }; 4612 })[]; 4613 /** 4614 * If true, the response will be streamed back incrementally. 4615 */ 4616 stream?: boolean; 4617 /** 4618 * The maximum number of tokens to generate in the response. 4619 */ 4620 max_tokens?: number; 4621 /** 4622 * Controls the randomness of the output; higher values produce more random results. 4623 */ 4624 temperature?: number; 4625 /** 4626 * 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. 4627 */ 4628 top_p?: number; 4629 /** 4630 * 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. 4631 */ 4632 top_k?: number; 4633 /** 4634 * Random seed for reproducibility of the generation. 4635 */ 4636 seed?: number; 4637 /** 4638 * Penalty for repeated tokens; higher values discourage repetition. 4639 */ 4640 repetition_penalty?: number; 4641 /** 4642 * Decreases the likelihood of the model repeating the same lines verbatim. 4643 */ 4644 frequency_penalty?: number; 4645 /** 4646 * Increases the likelihood of the model introducing new topics. 4647 */ 4648 presence_penalty?: number; 4649} 4650type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = { 4651 /** 4652 * The generated text response from the model 4653 */ 4654 response?: string; 4655 /** 4656 * An array of tool calls requests made during the response generation 4657 */ 4658 tool_calls?: { 4659 /** 4660 * The arguments passed to be passed to the tool call request 4661 */ 4662 arguments?: object; 4663 /** 4664 * The name of the tool to be called 4665 */ 4666 name?: string; 4667 }[]; 4668}; 4669declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct { 4670 inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input; 4671 postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output; 4672} 4673type 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; 4674interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt { 4675 /** 4676 * The input text prompt for the model to generate a response. 4677 */ 4678 prompt: string; 4679 /** 4680 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 4681 */ 4682 lora?: string; 4683 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode; 4684 /** 4685 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 4686 */ 4687 raw?: boolean; 4688 /** 4689 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 4690 */ 4691 stream?: boolean; 4692 /** 4693 * The maximum number of tokens to generate in the response. 4694 */ 4695 max_tokens?: number; 4696 /** 4697 * Controls the randomness of the output; higher values produce more random results. 4698 */ 4699 temperature?: number; 4700 /** 4701 * 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. 4702 */ 4703 top_p?: number; 4704 /** 4705 * 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. 4706 */ 4707 top_k?: number; 4708 /** 4709 * Random seed for reproducibility of the generation. 4710 */ 4711 seed?: number; 4712 /** 4713 * Penalty for repeated tokens; higher values discourage repetition. 4714 */ 4715 repetition_penalty?: number; 4716 /** 4717 * Decreases the likelihood of the model repeating the same lines verbatim. 4718 */ 4719 frequency_penalty?: number; 4720 /** 4721 * Increases the likelihood of the model introducing new topics. 4722 */ 4723 presence_penalty?: number; 4724} 4725interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode { 4726 type?: "json_object" | "json_schema"; 4727 json_schema?: unknown; 4728} 4729interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages { 4730 /** 4731 * An array of message objects representing the conversation history. 4732 */ 4733 messages: { 4734 /** 4735 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 4736 */ 4737 role: string; 4738 /** 4739 * The content of the message as a string. 4740 */ 4741 content: string; 4742 }[]; 4743 functions?: { 4744 name: string; 4745 code: string; 4746 }[]; 4747 /** 4748 * A list of tools available for the assistant to use. 4749 */ 4750 tools?: ({ 4751 /** 4752 * The name of the tool. More descriptive the better. 4753 */ 4754 name: string; 4755 /** 4756 * A brief description of what the tool does. 4757 */ 4758 description: string; 4759 /** 4760 * Schema defining the parameters accepted by the tool. 4761 */ 4762 parameters: { 4763 /** 4764 * The type of the parameters object (usually 'object'). 4765 */ 4766 type: string; 4767 /** 4768 * List of required parameter names. 4769 */ 4770 required?: string[]; 4771 /** 4772 * Definitions of each parameter. 4773 */ 4774 properties: { 4775 [k: string]: { 4776 /** 4777 * The data type of the parameter. 4778 */ 4779 type: string; 4780 /** 4781 * A description of the expected parameter. 4782 */ 4783 description: string; 4784 }; 4785 }; 4786 }; 4787 } | { 4788 /** 4789 * Specifies the type of tool (e.g., 'function'). 4790 */ 4791 type: string; 4792 /** 4793 * Details of the function tool. 4794 */ 4795 function: { 4796 /** 4797 * The name of the function. 4798 */ 4799 name: string; 4800 /** 4801 * A brief description of what the function does. 4802 */ 4803 description: string; 4804 /** 4805 * Schema defining the parameters accepted by the function. 4806 */ 4807 parameters: { 4808 /** 4809 * The type of the parameters object (usually 'object'). 4810 */ 4811 type: string; 4812 /** 4813 * List of required parameter names. 4814 */ 4815 required?: string[]; 4816 /** 4817 * Definitions of each parameter. 4818 */ 4819 properties: { 4820 [k: string]: { 4821 /** 4822 * The data type of the parameter. 4823 */ 4824 type: string; 4825 /** 4826 * A description of the expected parameter. 4827 */ 4828 description: string; 4829 }; 4830 }; 4831 }; 4832 }; 4833 })[]; 4834 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1; 4835 /** 4836 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 4837 */ 4838 raw?: boolean; 4839 /** 4840 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 4841 */ 4842 stream?: boolean; 4843 /** 4844 * The maximum number of tokens to generate in the response. 4845 */ 4846 max_tokens?: number; 4847 /** 4848 * Controls the randomness of the output; higher values produce more random results. 4849 */ 4850 temperature?: number; 4851 /** 4852 * 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. 4853 */ 4854 top_p?: number; 4855 /** 4856 * 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. 4857 */ 4858 top_k?: number; 4859 /** 4860 * Random seed for reproducibility of the generation. 4861 */ 4862 seed?: number; 4863 /** 4864 * Penalty for repeated tokens; higher values discourage repetition. 4865 */ 4866 repetition_penalty?: number; 4867 /** 4868 * Decreases the likelihood of the model repeating the same lines verbatim. 4869 */ 4870 frequency_penalty?: number; 4871 /** 4872 * Increases the likelihood of the model introducing new topics. 4873 */ 4874 presence_penalty?: number; 4875} 4876interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 { 4877 type?: "json_object" | "json_schema"; 4878 json_schema?: unknown; 4879} 4880interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch { 4881 requests?: { 4882 /** 4883 * 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. 4884 */ 4885 external_reference?: string; 4886 /** 4887 * Prompt for the text generation model 4888 */ 4889 prompt?: string; 4890 /** 4891 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 4892 */ 4893 stream?: boolean; 4894 /** 4895 * The maximum number of tokens to generate in the response. 4896 */ 4897 max_tokens?: number; 4898 /** 4899 * Controls the randomness of the output; higher values produce more random results. 4900 */ 4901 temperature?: number; 4902 /** 4903 * 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. 4904 */ 4905 top_p?: number; 4906 /** 4907 * Random seed for reproducibility of the generation. 4908 */ 4909 seed?: number; 4910 /** 4911 * Penalty for repeated tokens; higher values discourage repetition. 4912 */ 4913 repetition_penalty?: number; 4914 /** 4915 * Decreases the likelihood of the model repeating the same lines verbatim. 4916 */ 4917 frequency_penalty?: number; 4918 /** 4919 * Increases the likelihood of the model introducing new topics. 4920 */ 4921 presence_penalty?: number; 4922 response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2; 4923 }[]; 4924} 4925interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 { 4926 type?: "json_object" | "json_schema"; 4927 json_schema?: unknown; 4928} 4929type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = { 4930 /** 4931 * The generated text response from the model 4932 */ 4933 response: string; 4934 /** 4935 * Usage statistics for the inference request 4936 */ 4937 usage?: { 4938 /** 4939 * Total number of tokens in input 4940 */ 4941 prompt_tokens?: number; 4942 /** 4943 * Total number of tokens in output 4944 */ 4945 completion_tokens?: number; 4946 /** 4947 * Total number of input and output tokens 4948 */ 4949 total_tokens?: number; 4950 }; 4951 /** 4952 * An array of tool calls requests made during the response generation 4953 */ 4954 tool_calls?: { 4955 /** 4956 * The arguments passed to be passed to the tool call request 4957 */ 4958 arguments?: object; 4959 /** 4960 * The name of the tool to be called 4961 */ 4962 name?: string; 4963 }[]; 4964} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse; 4965interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse { 4966 /** 4967 * The async request id that can be used to obtain the results. 4968 */ 4969 request_id?: string; 4970} 4971declare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast { 4972 inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input; 4973 postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output; 4974} 4975interface Ai_Cf_Meta_Llama_Guard_3_8B_Input { 4976 /** 4977 * An array of message objects representing the conversation history. 4978 */ 4979 messages: { 4980 /** 4981 * The role of the message sender must alternate between 'user' and 'assistant'. 4982 */ 4983 role: "user" | "assistant"; 4984 /** 4985 * The content of the message as a string. 4986 */ 4987 content: string; 4988 }[]; 4989 /** 4990 * The maximum number of tokens to generate in the response. 4991 */ 4992 max_tokens?: number; 4993 /** 4994 * Controls the randomness of the output; higher values produce more random results. 4995 */ 4996 temperature?: number; 4997 /** 4998 * Dictate the output format of the generated response. 4999 */ 5000 response_format?: { 5001 /** 5002 * Set to json_object to process and output generated text as JSON. 5003 */ 5004 type?: string; 5005 }; 5006} 5007interface Ai_Cf_Meta_Llama_Guard_3_8B_Output { 5008 response?: string | { 5009 /** 5010 * Whether the conversation is safe or not. 5011 */ 5012 safe?: boolean; 5013 /** 5014 * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe. 5015 */ 5016 categories?: string[]; 5017 }; 5018 /** 5019 * Usage statistics for the inference request 5020 */ 5021 usage?: { 5022 /** 5023 * Total number of tokens in input 5024 */ 5025 prompt_tokens?: number; 5026 /** 5027 * Total number of tokens in output 5028 */ 5029 completion_tokens?: number; 5030 /** 5031 * Total number of input and output tokens 5032 */ 5033 total_tokens?: number; 5034 }; 5035} 5036declare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B { 5037 inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input; 5038 postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output; 5039} 5040interface Ai_Cf_Baai_Bge_Reranker_Base_Input { 5041 /** 5042 * A query you wish to perform against the provided contexts. 5043 */ 5044 /** 5045 * Number of returned results starting with the best score. 5046 */ 5047 top_k?: number; 5048 /** 5049 * List of provided contexts. Note that the index in this array is important, as the response will refer to it. 5050 */ 5051 contexts: { 5052 /** 5053 * One of the provided context content 5054 */ 5055 text?: string; 5056 }[]; 5057} 5058interface Ai_Cf_Baai_Bge_Reranker_Base_Output { 5059 response?: { 5060 /** 5061 * Index of the context in the request 5062 */ 5063 id?: number; 5064 /** 5065 * Score of the context under the index. 5066 */ 5067 score?: number; 5068 }[]; 5069} 5070declare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base { 5071 inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input; 5072 postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output; 5073} 5074type 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; 5075interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt { 5076 /** 5077 * The input text prompt for the model to generate a response. 5078 */ 5079 prompt: string; 5080 /** 5081 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 5082 */ 5083 lora?: string; 5084 response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode; 5085 /** 5086 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5087 */ 5088 raw?: boolean; 5089 /** 5090 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5091 */ 5092 stream?: boolean; 5093 /** 5094 * The maximum number of tokens to generate in the response. 5095 */ 5096 max_tokens?: number; 5097 /** 5098 * Controls the randomness of the output; higher values produce more random results. 5099 */ 5100 temperature?: number; 5101 /** 5102 * 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. 5103 */ 5104 top_p?: number; 5105 /** 5106 * 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. 5107 */ 5108 top_k?: number; 5109 /** 5110 * Random seed for reproducibility of the generation. 5111 */ 5112 seed?: number; 5113 /** 5114 * Penalty for repeated tokens; higher values discourage repetition. 5115 */ 5116 repetition_penalty?: number; 5117 /** 5118 * Decreases the likelihood of the model repeating the same lines verbatim. 5119 */ 5120 frequency_penalty?: number; 5121 /** 5122 * Increases the likelihood of the model introducing new topics. 5123 */ 5124 presence_penalty?: number; 5125} 5126interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode { 5127 type?: "json_object" | "json_schema"; 5128 json_schema?: unknown; 5129} 5130interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages { 5131 /** 5132 * An array of message objects representing the conversation history. 5133 */ 5134 messages: { 5135 /** 5136 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 5137 */ 5138 role: string; 5139 /** 5140 * The content of the message as a string. 5141 */ 5142 content: string; 5143 }[]; 5144 functions?: { 5145 name: string; 5146 code: string; 5147 }[]; 5148 /** 5149 * A list of tools available for the assistant to use. 5150 */ 5151 tools?: ({ 5152 /** 5153 * The name of the tool. More descriptive the better. 5154 */ 5155 name: string; 5156 /** 5157 * A brief description of what the tool does. 5158 */ 5159 description: string; 5160 /** 5161 * Schema defining the parameters accepted by the tool. 5162 */ 5163 parameters: { 5164 /** 5165 * The type of the parameters object (usually 'object'). 5166 */ 5167 type: string; 5168 /** 5169 * List of required parameter names. 5170 */ 5171 required?: string[]; 5172 /** 5173 * Definitions of each parameter. 5174 */ 5175 properties: { 5176 [k: string]: { 5177 /** 5178 * The data type of the parameter. 5179 */ 5180 type: string; 5181 /** 5182 * A description of the expected parameter. 5183 */ 5184 description: string; 5185 }; 5186 }; 5187 }; 5188 } | { 5189 /** 5190 * Specifies the type of tool (e.g., 'function'). 5191 */ 5192 type: string; 5193 /** 5194 * Details of the function tool. 5195 */ 5196 function: { 5197 /** 5198 * The name of the function. 5199 */ 5200 name: string; 5201 /** 5202 * A brief description of what the function does. 5203 */ 5204 description: string; 5205 /** 5206 * Schema defining the parameters accepted by the function. 5207 */ 5208 parameters: { 5209 /** 5210 * The type of the parameters object (usually 'object'). 5211 */ 5212 type: string; 5213 /** 5214 * List of required parameter names. 5215 */ 5216 required?: string[]; 5217 /** 5218 * Definitions of each parameter. 5219 */ 5220 properties: { 5221 [k: string]: { 5222 /** 5223 * The data type of the parameter. 5224 */ 5225 type: string; 5226 /** 5227 * A description of the expected parameter. 5228 */ 5229 description: string; 5230 }; 5231 }; 5232 }; 5233 }; 5234 })[]; 5235 response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1; 5236 /** 5237 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5238 */ 5239 raw?: boolean; 5240 /** 5241 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5242 */ 5243 stream?: boolean; 5244 /** 5245 * The maximum number of tokens to generate in the response. 5246 */ 5247 max_tokens?: number; 5248 /** 5249 * Controls the randomness of the output; higher values produce more random results. 5250 */ 5251 temperature?: number; 5252 /** 5253 * 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. 5254 */ 5255 top_p?: number; 5256 /** 5257 * 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. 5258 */ 5259 top_k?: number; 5260 /** 5261 * Random seed for reproducibility of the generation. 5262 */ 5263 seed?: number; 5264 /** 5265 * Penalty for repeated tokens; higher values discourage repetition. 5266 */ 5267 repetition_penalty?: number; 5268 /** 5269 * Decreases the likelihood of the model repeating the same lines verbatim. 5270 */ 5271 frequency_penalty?: number; 5272 /** 5273 * Increases the likelihood of the model introducing new topics. 5274 */ 5275 presence_penalty?: number; 5276} 5277interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 { 5278 type?: "json_object" | "json_schema"; 5279 json_schema?: unknown; 5280} 5281type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = { 5282 /** 5283 * The generated text response from the model 5284 */ 5285 response: string; 5286 /** 5287 * Usage statistics for the inference request 5288 */ 5289 usage?: { 5290 /** 5291 * Total number of tokens in input 5292 */ 5293 prompt_tokens?: number; 5294 /** 5295 * Total number of tokens in output 5296 */ 5297 completion_tokens?: number; 5298 /** 5299 * Total number of input and output tokens 5300 */ 5301 total_tokens?: number; 5302 }; 5303 /** 5304 * An array of tool calls requests made during the response generation 5305 */ 5306 tool_calls?: { 5307 /** 5308 * The arguments passed to be passed to the tool call request 5309 */ 5310 arguments?: object; 5311 /** 5312 * The name of the tool to be called 5313 */ 5314 name?: string; 5315 }[]; 5316}; 5317declare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct { 5318 inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input; 5319 postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output; 5320} 5321type Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages; 5322interface Ai_Cf_Qwen_Qwq_32B_Prompt { 5323 /** 5324 * The input text prompt for the model to generate a response. 5325 */ 5326 prompt: string; 5327 /** 5328 * JSON schema that should be fulfilled for the response. 5329 */ 5330 guided_json?: object; 5331 /** 5332 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5333 */ 5334 raw?: boolean; 5335 /** 5336 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5337 */ 5338 stream?: boolean; 5339 /** 5340 * The maximum number of tokens to generate in the response. 5341 */ 5342 max_tokens?: number; 5343 /** 5344 * Controls the randomness of the output; higher values produce more random results. 5345 */ 5346 temperature?: number; 5347 /** 5348 * 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. 5349 */ 5350 top_p?: number; 5351 /** 5352 * 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. 5353 */ 5354 top_k?: number; 5355 /** 5356 * Random seed for reproducibility of the generation. 5357 */ 5358 seed?: number; 5359 /** 5360 * Penalty for repeated tokens; higher values discourage repetition. 5361 */ 5362 repetition_penalty?: number; 5363 /** 5364 * Decreases the likelihood of the model repeating the same lines verbatim. 5365 */ 5366 frequency_penalty?: number; 5367 /** 5368 * Increases the likelihood of the model introducing new topics. 5369 */ 5370 presence_penalty?: number; 5371} 5372interface Ai_Cf_Qwen_Qwq_32B_Messages { 5373 /** 5374 * An array of message objects representing the conversation history. 5375 */ 5376 messages: { 5377 /** 5378 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 5379 */ 5380 role?: string; 5381 /** 5382 * 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 5383 */ 5384 tool_call_id?: string; 5385 content?: string | { 5386 /** 5387 * Type of the content provided 5388 */ 5389 type?: string; 5390 text?: string; 5391 image_url?: { 5392 /** 5393 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 5394 */ 5395 url?: string; 5396 }; 5397 }[] | { 5398 /** 5399 * Type of the content provided 5400 */ 5401 type?: string; 5402 text?: string; 5403 image_url?: { 5404 /** 5405 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 5406 */ 5407 url?: string; 5408 }; 5409 }; 5410 }[]; 5411 functions?: { 5412 name: string; 5413 code: string; 5414 }[]; 5415 /** 5416 * A list of tools available for the assistant to use. 5417 */ 5418 tools?: ({ 5419 /** 5420 * The name of the tool. More descriptive the better. 5421 */ 5422 name: string; 5423 /** 5424 * A brief description of what the tool does. 5425 */ 5426 description: string; 5427 /** 5428 * Schema defining the parameters accepted by the tool. 5429 */ 5430 parameters: { 5431 /** 5432 * The type of the parameters object (usually 'object'). 5433 */ 5434 type: string; 5435 /** 5436 * List of required parameter names. 5437 */ 5438 required?: string[]; 5439 /** 5440 * Definitions of each parameter. 5441 */ 5442 properties: { 5443 [k: string]: { 5444 /** 5445 * The data type of the parameter. 5446 */ 5447 type: string; 5448 /** 5449 * A description of the expected parameter. 5450 */ 5451 description: string; 5452 }; 5453 }; 5454 }; 5455 } | { 5456 /** 5457 * Specifies the type of tool (e.g., 'function'). 5458 */ 5459 type: string; 5460 /** 5461 * Details of the function tool. 5462 */ 5463 function: { 5464 /** 5465 * The name of the function. 5466 */ 5467 name: string; 5468 /** 5469 * A brief description of what the function does. 5470 */ 5471 description: string; 5472 /** 5473 * Schema defining the parameters accepted by the function. 5474 */ 5475 parameters: { 5476 /** 5477 * The type of the parameters object (usually 'object'). 5478 */ 5479 type: string; 5480 /** 5481 * List of required parameter names. 5482 */ 5483 required?: string[]; 5484 /** 5485 * Definitions of each parameter. 5486 */ 5487 properties: { 5488 [k: string]: { 5489 /** 5490 * The data type of the parameter. 5491 */ 5492 type: string; 5493 /** 5494 * A description of the expected parameter. 5495 */ 5496 description: string; 5497 }; 5498 }; 5499 }; 5500 }; 5501 })[]; 5502 /** 5503 * JSON schema that should be fufilled for the response. 5504 */ 5505 guided_json?: object; 5506 /** 5507 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5508 */ 5509 raw?: boolean; 5510 /** 5511 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5512 */ 5513 stream?: boolean; 5514 /** 5515 * The maximum number of tokens to generate in the response. 5516 */ 5517 max_tokens?: number; 5518 /** 5519 * Controls the randomness of the output; higher values produce more random results. 5520 */ 5521 temperature?: number; 5522 /** 5523 * 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. 5524 */ 5525 top_p?: number; 5526 /** 5527 * 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. 5528 */ 5529 top_k?: number; 5530 /** 5531 * Random seed for reproducibility of the generation. 5532 */ 5533 seed?: number; 5534 /** 5535 * Penalty for repeated tokens; higher values discourage repetition. 5536 */ 5537 repetition_penalty?: number; 5538 /** 5539 * Decreases the likelihood of the model repeating the same lines verbatim. 5540 */ 5541 frequency_penalty?: number; 5542 /** 5543 * Increases the likelihood of the model introducing new topics. 5544 */ 5545 presence_penalty?: number; 5546} 5547type Ai_Cf_Qwen_Qwq_32B_Output = { 5548 /** 5549 * The generated text response from the model 5550 */ 5551 response: string; 5552 /** 5553 * Usage statistics for the inference request 5554 */ 5555 usage?: { 5556 /** 5557 * Total number of tokens in input 5558 */ 5559 prompt_tokens?: number; 5560 /** 5561 * Total number of tokens in output 5562 */ 5563 completion_tokens?: number; 5564 /** 5565 * Total number of input and output tokens 5566 */ 5567 total_tokens?: number; 5568 }; 5569 /** 5570 * An array of tool calls requests made during the response generation 5571 */ 5572 tool_calls?: { 5573 /** 5574 * The arguments passed to be passed to the tool call request 5575 */ 5576 arguments?: object; 5577 /** 5578 * The name of the tool to be called 5579 */ 5580 name?: string; 5581 }[]; 5582}; 5583declare abstract class Base_Ai_Cf_Qwen_Qwq_32B { 5584 inputs: Ai_Cf_Qwen_Qwq_32B_Input; 5585 postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output; 5586} 5587type 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; 5588interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt { 5589 /** 5590 * The input text prompt for the model to generate a response. 5591 */ 5592 prompt: string; 5593 /** 5594 * JSON schema that should be fulfilled for the response. 5595 */ 5596 guided_json?: object; 5597 /** 5598 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5599 */ 5600 raw?: boolean; 5601 /** 5602 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5603 */ 5604 stream?: boolean; 5605 /** 5606 * The maximum number of tokens to generate in the response. 5607 */ 5608 max_tokens?: number; 5609 /** 5610 * Controls the randomness of the output; higher values produce more random results. 5611 */ 5612 temperature?: number; 5613 /** 5614 * 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. 5615 */ 5616 top_p?: number; 5617 /** 5618 * 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. 5619 */ 5620 top_k?: number; 5621 /** 5622 * Random seed for reproducibility of the generation. 5623 */ 5624 seed?: number; 5625 /** 5626 * Penalty for repeated tokens; higher values discourage repetition. 5627 */ 5628 repetition_penalty?: number; 5629 /** 5630 * Decreases the likelihood of the model repeating the same lines verbatim. 5631 */ 5632 frequency_penalty?: number; 5633 /** 5634 * Increases the likelihood of the model introducing new topics. 5635 */ 5636 presence_penalty?: number; 5637} 5638interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages { 5639 /** 5640 * An array of message objects representing the conversation history. 5641 */ 5642 messages: { 5643 /** 5644 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 5645 */ 5646 role?: string; 5647 /** 5648 * 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 5649 */ 5650 tool_call_id?: string; 5651 content?: string | { 5652 /** 5653 * Type of the content provided 5654 */ 5655 type?: string; 5656 text?: string; 5657 image_url?: { 5658 /** 5659 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 5660 */ 5661 url?: string; 5662 }; 5663 }[] | { 5664 /** 5665 * Type of the content provided 5666 */ 5667 type?: string; 5668 text?: string; 5669 image_url?: { 5670 /** 5671 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 5672 */ 5673 url?: string; 5674 }; 5675 }; 5676 }[]; 5677 functions?: { 5678 name: string; 5679 code: string; 5680 }[]; 5681 /** 5682 * A list of tools available for the assistant to use. 5683 */ 5684 tools?: ({ 5685 /** 5686 * The name of the tool. More descriptive the better. 5687 */ 5688 name: string; 5689 /** 5690 * A brief description of what the tool does. 5691 */ 5692 description: string; 5693 /** 5694 * Schema defining the parameters accepted by the tool. 5695 */ 5696 parameters: { 5697 /** 5698 * The type of the parameters object (usually 'object'). 5699 */ 5700 type: string; 5701 /** 5702 * List of required parameter names. 5703 */ 5704 required?: string[]; 5705 /** 5706 * Definitions of each parameter. 5707 */ 5708 properties: { 5709 [k: string]: { 5710 /** 5711 * The data type of the parameter. 5712 */ 5713 type: string; 5714 /** 5715 * A description of the expected parameter. 5716 */ 5717 description: string; 5718 }; 5719 }; 5720 }; 5721 } | { 5722 /** 5723 * Specifies the type of tool (e.g., 'function'). 5724 */ 5725 type: string; 5726 /** 5727 * Details of the function tool. 5728 */ 5729 function: { 5730 /** 5731 * The name of the function. 5732 */ 5733 name: string; 5734 /** 5735 * A brief description of what the function does. 5736 */ 5737 description: string; 5738 /** 5739 * Schema defining the parameters accepted by the function. 5740 */ 5741 parameters: { 5742 /** 5743 * The type of the parameters object (usually 'object'). 5744 */ 5745 type: string; 5746 /** 5747 * List of required parameter names. 5748 */ 5749 required?: string[]; 5750 /** 5751 * Definitions of each parameter. 5752 */ 5753 properties: { 5754 [k: string]: { 5755 /** 5756 * The data type of the parameter. 5757 */ 5758 type: string; 5759 /** 5760 * A description of the expected parameter. 5761 */ 5762 description: string; 5763 }; 5764 }; 5765 }; 5766 }; 5767 })[]; 5768 /** 5769 * JSON schema that should be fufilled for the response. 5770 */ 5771 guided_json?: object; 5772 /** 5773 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5774 */ 5775 raw?: boolean; 5776 /** 5777 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5778 */ 5779 stream?: boolean; 5780 /** 5781 * The maximum number of tokens to generate in the response. 5782 */ 5783 max_tokens?: number; 5784 /** 5785 * Controls the randomness of the output; higher values produce more random results. 5786 */ 5787 temperature?: number; 5788 /** 5789 * 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. 5790 */ 5791 top_p?: number; 5792 /** 5793 * 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. 5794 */ 5795 top_k?: number; 5796 /** 5797 * Random seed for reproducibility of the generation. 5798 */ 5799 seed?: number; 5800 /** 5801 * Penalty for repeated tokens; higher values discourage repetition. 5802 */ 5803 repetition_penalty?: number; 5804 /** 5805 * Decreases the likelihood of the model repeating the same lines verbatim. 5806 */ 5807 frequency_penalty?: number; 5808 /** 5809 * Increases the likelihood of the model introducing new topics. 5810 */ 5811 presence_penalty?: number; 5812} 5813type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = { 5814 /** 5815 * The generated text response from the model 5816 */ 5817 response: string; 5818 /** 5819 * Usage statistics for the inference request 5820 */ 5821 usage?: { 5822 /** 5823 * Total number of tokens in input 5824 */ 5825 prompt_tokens?: number; 5826 /** 5827 * Total number of tokens in output 5828 */ 5829 completion_tokens?: number; 5830 /** 5831 * Total number of input and output tokens 5832 */ 5833 total_tokens?: number; 5834 }; 5835 /** 5836 * An array of tool calls requests made during the response generation 5837 */ 5838 tool_calls?: { 5839 /** 5840 * The arguments passed to be passed to the tool call request 5841 */ 5842 arguments?: object; 5843 /** 5844 * The name of the tool to be called 5845 */ 5846 name?: string; 5847 }[]; 5848}; 5849declare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct { 5850 inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input; 5851 postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output; 5852} 5853type Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages; 5854interface Ai_Cf_Google_Gemma_3_12B_It_Prompt { 5855 /** 5856 * The input text prompt for the model to generate a response. 5857 */ 5858 prompt: string; 5859 /** 5860 * JSON schema that should be fufilled for the response. 5861 */ 5862 guided_json?: object; 5863 /** 5864 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 5865 */ 5866 raw?: boolean; 5867 /** 5868 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 5869 */ 5870 stream?: boolean; 5871 /** 5872 * The maximum number of tokens to generate in the response. 5873 */ 5874 max_tokens?: number; 5875 /** 5876 * Controls the randomness of the output; higher values produce more random results. 5877 */ 5878 temperature?: number; 5879 /** 5880 * 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. 5881 */ 5882 top_p?: number; 5883 /** 5884 * 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. 5885 */ 5886 top_k?: number; 5887 /** 5888 * Random seed for reproducibility of the generation. 5889 */ 5890 seed?: number; 5891 /** 5892 * Penalty for repeated tokens; higher values discourage repetition. 5893 */ 5894 repetition_penalty?: number; 5895 /** 5896 * Decreases the likelihood of the model repeating the same lines verbatim. 5897 */ 5898 frequency_penalty?: number; 5899 /** 5900 * Increases the likelihood of the model introducing new topics. 5901 */ 5902 presence_penalty?: number; 5903} 5904interface Ai_Cf_Google_Gemma_3_12B_It_Messages { 5905 /** 5906 * An array of message objects representing the conversation history. 5907 */ 5908 messages: { 5909 /** 5910 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 5911 */ 5912 role?: string; 5913 content?: string | { 5914 /** 5915 * Type of the content provided 5916 */ 5917 type?: string; 5918 text?: string; 5919 image_url?: { 5920 /** 5921 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 5922 */ 5923 url?: string; 5924 }; 5925 }[]; 5926 }[]; 5927 functions?: { 5928 name: string; 5929 code: string; 5930 }[]; 5931 /** 5932 * A list of tools available for the assistant to use. 5933 */ 5934 tools?: ({ 5935 /** 5936 * The name of the tool. More descriptive the better. 5937 */ 5938 name: string; 5939 /** 5940 * A brief description of what the tool does. 5941 */ 5942 description: string; 5943 /** 5944 * Schema defining the parameters accepted by the tool. 5945 */ 5946 parameters: { 5947 /** 5948 * The type of the parameters object (usually 'object'). 5949 */ 5950 type: string; 5951 /** 5952 * List of required parameter names. 5953 */ 5954 required?: string[]; 5955 /** 5956 * Definitions of each parameter. 5957 */ 5958 properties: { 5959 [k: string]: { 5960 /** 5961 * The data type of the parameter. 5962 */ 5963 type: string; 5964 /** 5965 * A description of the expected parameter. 5966 */ 5967 description: string; 5968 }; 5969 }; 5970 }; 5971 } | { 5972 /** 5973 * Specifies the type of tool (e.g., 'function'). 5974 */ 5975 type: string; 5976 /** 5977 * Details of the function tool. 5978 */ 5979 function: { 5980 /** 5981 * The name of the function. 5982 */ 5983 name: string; 5984 /** 5985 * A brief description of what the function does. 5986 */ 5987 description: string; 5988 /** 5989 * Schema defining the parameters accepted by the function. 5990 */ 5991 parameters: { 5992 /** 5993 * The type of the parameters object (usually 'object'). 5994 */ 5995 type: string; 5996 /** 5997 * List of required parameter names. 5998 */ 5999 required?: string[]; 6000 /** 6001 * Definitions of each parameter. 6002 */ 6003 properties: { 6004 [k: string]: { 6005 /** 6006 * The data type of the parameter. 6007 */ 6008 type: string; 6009 /** 6010 * A description of the expected parameter. 6011 */ 6012 description: string; 6013 }; 6014 }; 6015 }; 6016 }; 6017 })[]; 6018 /** 6019 * JSON schema that should be fufilled for the response. 6020 */ 6021 guided_json?: object; 6022 /** 6023 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6024 */ 6025 raw?: boolean; 6026 /** 6027 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6028 */ 6029 stream?: boolean; 6030 /** 6031 * The maximum number of tokens to generate in the response. 6032 */ 6033 max_tokens?: number; 6034 /** 6035 * Controls the randomness of the output; higher values produce more random results. 6036 */ 6037 temperature?: number; 6038 /** 6039 * 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. 6040 */ 6041 top_p?: number; 6042 /** 6043 * 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. 6044 */ 6045 top_k?: number; 6046 /** 6047 * Random seed for reproducibility of the generation. 6048 */ 6049 seed?: number; 6050 /** 6051 * Penalty for repeated tokens; higher values discourage repetition. 6052 */ 6053 repetition_penalty?: number; 6054 /** 6055 * Decreases the likelihood of the model repeating the same lines verbatim. 6056 */ 6057 frequency_penalty?: number; 6058 /** 6059 * Increases the likelihood of the model introducing new topics. 6060 */ 6061 presence_penalty?: number; 6062} 6063type Ai_Cf_Google_Gemma_3_12B_It_Output = { 6064 /** 6065 * The generated text response from the model 6066 */ 6067 response: string; 6068 /** 6069 * Usage statistics for the inference request 6070 */ 6071 usage?: { 6072 /** 6073 * Total number of tokens in input 6074 */ 6075 prompt_tokens?: number; 6076 /** 6077 * Total number of tokens in output 6078 */ 6079 completion_tokens?: number; 6080 /** 6081 * Total number of input and output tokens 6082 */ 6083 total_tokens?: number; 6084 }; 6085 /** 6086 * An array of tool calls requests made during the response generation 6087 */ 6088 tool_calls?: { 6089 /** 6090 * The arguments passed to be passed to the tool call request 6091 */ 6092 arguments?: object; 6093 /** 6094 * The name of the tool to be called 6095 */ 6096 name?: string; 6097 }[]; 6098}; 6099declare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It { 6100 inputs: Ai_Cf_Google_Gemma_3_12B_It_Input; 6101 postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output; 6102} 6103type 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; 6104interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt { 6105 /** 6106 * The input text prompt for the model to generate a response. 6107 */ 6108 prompt: string; 6109 /** 6110 * JSON schema that should be fulfilled for the response. 6111 */ 6112 guided_json?: object; 6113 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; 6114 /** 6115 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6116 */ 6117 raw?: boolean; 6118 /** 6119 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6120 */ 6121 stream?: boolean; 6122 /** 6123 * The maximum number of tokens to generate in the response. 6124 */ 6125 max_tokens?: number; 6126 /** 6127 * Controls the randomness of the output; higher values produce more random results. 6128 */ 6129 temperature?: number; 6130 /** 6131 * 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. 6132 */ 6133 top_p?: number; 6134 /** 6135 * 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. 6136 */ 6137 top_k?: number; 6138 /** 6139 * Random seed for reproducibility of the generation. 6140 */ 6141 seed?: number; 6142 /** 6143 * Penalty for repeated tokens; higher values discourage repetition. 6144 */ 6145 repetition_penalty?: number; 6146 /** 6147 * Decreases the likelihood of the model repeating the same lines verbatim. 6148 */ 6149 frequency_penalty?: number; 6150 /** 6151 * Increases the likelihood of the model introducing new topics. 6152 */ 6153 presence_penalty?: number; 6154} 6155interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode { 6156 type?: "json_object" | "json_schema"; 6157 json_schema?: unknown; 6158} 6159interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages { 6160 /** 6161 * An array of message objects representing the conversation history. 6162 */ 6163 messages: { 6164 /** 6165 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 6166 */ 6167 role?: string; 6168 /** 6169 * The tool call id. If you don't know what to put here you can fall back to 000000001 6170 */ 6171 tool_call_id?: string; 6172 content?: string | { 6173 /** 6174 * Type of the content provided 6175 */ 6176 type?: string; 6177 text?: string; 6178 image_url?: { 6179 /** 6180 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 6181 */ 6182 url?: string; 6183 }; 6184 }[] | { 6185 /** 6186 * Type of the content provided 6187 */ 6188 type?: string; 6189 text?: string; 6190 image_url?: { 6191 /** 6192 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 6193 */ 6194 url?: string; 6195 }; 6196 }; 6197 }[]; 6198 functions?: { 6199 name: string; 6200 code: string; 6201 }[]; 6202 /** 6203 * A list of tools available for the assistant to use. 6204 */ 6205 tools?: ({ 6206 /** 6207 * The name of the tool. More descriptive the better. 6208 */ 6209 name: string; 6210 /** 6211 * A brief description of what the tool does. 6212 */ 6213 description: string; 6214 /** 6215 * Schema defining the parameters accepted by the tool. 6216 */ 6217 parameters: { 6218 /** 6219 * The type of the parameters object (usually 'object'). 6220 */ 6221 type: string; 6222 /** 6223 * List of required parameter names. 6224 */ 6225 required?: string[]; 6226 /** 6227 * Definitions of each parameter. 6228 */ 6229 properties: { 6230 [k: string]: { 6231 /** 6232 * The data type of the parameter. 6233 */ 6234 type: string; 6235 /** 6236 * A description of the expected parameter. 6237 */ 6238 description: string; 6239 }; 6240 }; 6241 }; 6242 } | { 6243 /** 6244 * Specifies the type of tool (e.g., 'function'). 6245 */ 6246 type: string; 6247 /** 6248 * Details of the function tool. 6249 */ 6250 function: { 6251 /** 6252 * The name of the function. 6253 */ 6254 name: string; 6255 /** 6256 * A brief description of what the function does. 6257 */ 6258 description: string; 6259 /** 6260 * Schema defining the parameters accepted by the function. 6261 */ 6262 parameters: { 6263 /** 6264 * The type of the parameters object (usually 'object'). 6265 */ 6266 type: string; 6267 /** 6268 * List of required parameter names. 6269 */ 6270 required?: string[]; 6271 /** 6272 * Definitions of each parameter. 6273 */ 6274 properties: { 6275 [k: string]: { 6276 /** 6277 * The data type of the parameter. 6278 */ 6279 type: string; 6280 /** 6281 * A description of the expected parameter. 6282 */ 6283 description: string; 6284 }; 6285 }; 6286 }; 6287 }; 6288 })[]; 6289 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; 6290 /** 6291 * JSON schema that should be fufilled for the response. 6292 */ 6293 guided_json?: object; 6294 /** 6295 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6296 */ 6297 raw?: boolean; 6298 /** 6299 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6300 */ 6301 stream?: boolean; 6302 /** 6303 * The maximum number of tokens to generate in the response. 6304 */ 6305 max_tokens?: number; 6306 /** 6307 * Controls the randomness of the output; higher values produce more random results. 6308 */ 6309 temperature?: number; 6310 /** 6311 * 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. 6312 */ 6313 top_p?: number; 6314 /** 6315 * 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. 6316 */ 6317 top_k?: number; 6318 /** 6319 * Random seed for reproducibility of the generation. 6320 */ 6321 seed?: number; 6322 /** 6323 * Penalty for repeated tokens; higher values discourage repetition. 6324 */ 6325 repetition_penalty?: number; 6326 /** 6327 * Decreases the likelihood of the model repeating the same lines verbatim. 6328 */ 6329 frequency_penalty?: number; 6330 /** 6331 * Increases the likelihood of the model introducing new topics. 6332 */ 6333 presence_penalty?: number; 6334} 6335interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch { 6336 requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[]; 6337} 6338interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner { 6339 /** 6340 * The input text prompt for the model to generate a response. 6341 */ 6342 prompt: string; 6343 /** 6344 * JSON schema that should be fulfilled for the response. 6345 */ 6346 guided_json?: object; 6347 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; 6348 /** 6349 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6350 */ 6351 raw?: boolean; 6352 /** 6353 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6354 */ 6355 stream?: boolean; 6356 /** 6357 * The maximum number of tokens to generate in the response. 6358 */ 6359 max_tokens?: number; 6360 /** 6361 * Controls the randomness of the output; higher values produce more random results. 6362 */ 6363 temperature?: number; 6364 /** 6365 * 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. 6366 */ 6367 top_p?: number; 6368 /** 6369 * 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. 6370 */ 6371 top_k?: number; 6372 /** 6373 * Random seed for reproducibility of the generation. 6374 */ 6375 seed?: number; 6376 /** 6377 * Penalty for repeated tokens; higher values discourage repetition. 6378 */ 6379 repetition_penalty?: number; 6380 /** 6381 * Decreases the likelihood of the model repeating the same lines verbatim. 6382 */ 6383 frequency_penalty?: number; 6384 /** 6385 * Increases the likelihood of the model introducing new topics. 6386 */ 6387 presence_penalty?: number; 6388} 6389interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner { 6390 /** 6391 * An array of message objects representing the conversation history. 6392 */ 6393 messages: { 6394 /** 6395 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 6396 */ 6397 role?: string; 6398 /** 6399 * The tool call id. If you don't know what to put here you can fall back to 000000001 6400 */ 6401 tool_call_id?: string; 6402 content?: string | { 6403 /** 6404 * Type of the content provided 6405 */ 6406 type?: string; 6407 text?: string; 6408 image_url?: { 6409 /** 6410 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 6411 */ 6412 url?: string; 6413 }; 6414 }[] | { 6415 /** 6416 * Type of the content provided 6417 */ 6418 type?: string; 6419 text?: string; 6420 image_url?: { 6421 /** 6422 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted 6423 */ 6424 url?: string; 6425 }; 6426 }; 6427 }[]; 6428 functions?: { 6429 name: string; 6430 code: string; 6431 }[]; 6432 /** 6433 * A list of tools available for the assistant to use. 6434 */ 6435 tools?: ({ 6436 /** 6437 * The name of the tool. More descriptive the better. 6438 */ 6439 name: string; 6440 /** 6441 * A brief description of what the tool does. 6442 */ 6443 description: string; 6444 /** 6445 * Schema defining the parameters accepted by the tool. 6446 */ 6447 parameters: { 6448 /** 6449 * The type of the parameters object (usually 'object'). 6450 */ 6451 type: string; 6452 /** 6453 * List of required parameter names. 6454 */ 6455 required?: string[]; 6456 /** 6457 * Definitions of each parameter. 6458 */ 6459 properties: { 6460 [k: string]: { 6461 /** 6462 * The data type of the parameter. 6463 */ 6464 type: string; 6465 /** 6466 * A description of the expected parameter. 6467 */ 6468 description: string; 6469 }; 6470 }; 6471 }; 6472 } | { 6473 /** 6474 * Specifies the type of tool (e.g., 'function'). 6475 */ 6476 type: string; 6477 /** 6478 * Details of the function tool. 6479 */ 6480 function: { 6481 /** 6482 * The name of the function. 6483 */ 6484 name: string; 6485 /** 6486 * A brief description of what the function does. 6487 */ 6488 description: string; 6489 /** 6490 * Schema defining the parameters accepted by the function. 6491 */ 6492 parameters: { 6493 /** 6494 * The type of the parameters object (usually 'object'). 6495 */ 6496 type: string; 6497 /** 6498 * List of required parameter names. 6499 */ 6500 required?: string[]; 6501 /** 6502 * Definitions of each parameter. 6503 */ 6504 properties: { 6505 [k: string]: { 6506 /** 6507 * The data type of the parameter. 6508 */ 6509 type: string; 6510 /** 6511 * A description of the expected parameter. 6512 */ 6513 description: string; 6514 }; 6515 }; 6516 }; 6517 }; 6518 })[]; 6519 response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode; 6520 /** 6521 * JSON schema that should be fufilled for the response. 6522 */ 6523 guided_json?: object; 6524 /** 6525 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6526 */ 6527 raw?: boolean; 6528 /** 6529 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6530 */ 6531 stream?: boolean; 6532 /** 6533 * The maximum number of tokens to generate in the response. 6534 */ 6535 max_tokens?: number; 6536 /** 6537 * Controls the randomness of the output; higher values produce more random results. 6538 */ 6539 temperature?: number; 6540 /** 6541 * 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. 6542 */ 6543 top_p?: number; 6544 /** 6545 * 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. 6546 */ 6547 top_k?: number; 6548 /** 6549 * Random seed for reproducibility of the generation. 6550 */ 6551 seed?: number; 6552 /** 6553 * Penalty for repeated tokens; higher values discourage repetition. 6554 */ 6555 repetition_penalty?: number; 6556 /** 6557 * Decreases the likelihood of the model repeating the same lines verbatim. 6558 */ 6559 frequency_penalty?: number; 6560 /** 6561 * Increases the likelihood of the model introducing new topics. 6562 */ 6563 presence_penalty?: number; 6564} 6565type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = { 6566 /** 6567 * The generated text response from the model 6568 */ 6569 response: string; 6570 /** 6571 * Usage statistics for the inference request 6572 */ 6573 usage?: { 6574 /** 6575 * Total number of tokens in input 6576 */ 6577 prompt_tokens?: number; 6578 /** 6579 * Total number of tokens in output 6580 */ 6581 completion_tokens?: number; 6582 /** 6583 * Total number of input and output tokens 6584 */ 6585 total_tokens?: number; 6586 }; 6587 /** 6588 * An array of tool calls requests made during the response generation 6589 */ 6590 tool_calls?: { 6591 /** 6592 * The tool call id. 6593 */ 6594 id?: string; 6595 /** 6596 * Specifies the type of tool (e.g., 'function'). 6597 */ 6598 type?: string; 6599 /** 6600 * Details of the function tool. 6601 */ 6602 function?: { 6603 /** 6604 * The name of the tool to be called 6605 */ 6606 name?: string; 6607 /** 6608 * The arguments passed to be passed to the tool call request 6609 */ 6610 arguments?: object; 6611 }; 6612 }[]; 6613}; 6614declare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct { 6615 inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input; 6616 postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output; 6617} 6618type 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; 6619interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt { 6620 /** 6621 * The input text prompt for the model to generate a response. 6622 */ 6623 prompt: string; 6624 /** 6625 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 6626 */ 6627 lora?: string; 6628 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode; 6629 /** 6630 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6631 */ 6632 raw?: boolean; 6633 /** 6634 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6635 */ 6636 stream?: boolean; 6637 /** 6638 * The maximum number of tokens to generate in the response. 6639 */ 6640 max_tokens?: number; 6641 /** 6642 * Controls the randomness of the output; higher values produce more random results. 6643 */ 6644 temperature?: number; 6645 /** 6646 * 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. 6647 */ 6648 top_p?: number; 6649 /** 6650 * 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. 6651 */ 6652 top_k?: number; 6653 /** 6654 * Random seed for reproducibility of the generation. 6655 */ 6656 seed?: number; 6657 /** 6658 * Penalty for repeated tokens; higher values discourage repetition. 6659 */ 6660 repetition_penalty?: number; 6661 /** 6662 * Decreases the likelihood of the model repeating the same lines verbatim. 6663 */ 6664 frequency_penalty?: number; 6665 /** 6666 * Increases the likelihood of the model introducing new topics. 6667 */ 6668 presence_penalty?: number; 6669} 6670interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode { 6671 type?: "json_object" | "json_schema"; 6672 json_schema?: unknown; 6673} 6674interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages { 6675 /** 6676 * An array of message objects representing the conversation history. 6677 */ 6678 messages: { 6679 /** 6680 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 6681 */ 6682 role: string; 6683 /** 6684 * The content of the message as a string. 6685 */ 6686 content: string; 6687 }[]; 6688 functions?: { 6689 name: string; 6690 code: string; 6691 }[]; 6692 /** 6693 * A list of tools available for the assistant to use. 6694 */ 6695 tools?: ({ 6696 /** 6697 * The name of the tool. More descriptive the better. 6698 */ 6699 name: string; 6700 /** 6701 * A brief description of what the tool does. 6702 */ 6703 description: string; 6704 /** 6705 * Schema defining the parameters accepted by the tool. 6706 */ 6707 parameters: { 6708 /** 6709 * The type of the parameters object (usually 'object'). 6710 */ 6711 type: string; 6712 /** 6713 * List of required parameter names. 6714 */ 6715 required?: string[]; 6716 /** 6717 * Definitions of each parameter. 6718 */ 6719 properties: { 6720 [k: string]: { 6721 /** 6722 * The data type of the parameter. 6723 */ 6724 type: string; 6725 /** 6726 * A description of the expected parameter. 6727 */ 6728 description: string; 6729 }; 6730 }; 6731 }; 6732 } | { 6733 /** 6734 * Specifies the type of tool (e.g., 'function'). 6735 */ 6736 type: string; 6737 /** 6738 * Details of the function tool. 6739 */ 6740 function: { 6741 /** 6742 * The name of the function. 6743 */ 6744 name: string; 6745 /** 6746 * A brief description of what the function does. 6747 */ 6748 description: string; 6749 /** 6750 * Schema defining the parameters accepted by the function. 6751 */ 6752 parameters: { 6753 /** 6754 * The type of the parameters object (usually 'object'). 6755 */ 6756 type: string; 6757 /** 6758 * List of required parameter names. 6759 */ 6760 required?: string[]; 6761 /** 6762 * Definitions of each parameter. 6763 */ 6764 properties: { 6765 [k: string]: { 6766 /** 6767 * The data type of the parameter. 6768 */ 6769 type: string; 6770 /** 6771 * A description of the expected parameter. 6772 */ 6773 description: string; 6774 }; 6775 }; 6776 }; 6777 }; 6778 })[]; 6779 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1; 6780 /** 6781 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6782 */ 6783 raw?: boolean; 6784 /** 6785 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6786 */ 6787 stream?: boolean; 6788 /** 6789 * The maximum number of tokens to generate in the response. 6790 */ 6791 max_tokens?: number; 6792 /** 6793 * Controls the randomness of the output; higher values produce more random results. 6794 */ 6795 temperature?: number; 6796 /** 6797 * 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. 6798 */ 6799 top_p?: number; 6800 /** 6801 * 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. 6802 */ 6803 top_k?: number; 6804 /** 6805 * Random seed for reproducibility of the generation. 6806 */ 6807 seed?: number; 6808 /** 6809 * Penalty for repeated tokens; higher values discourage repetition. 6810 */ 6811 repetition_penalty?: number; 6812 /** 6813 * Decreases the likelihood of the model repeating the same lines verbatim. 6814 */ 6815 frequency_penalty?: number; 6816 /** 6817 * Increases the likelihood of the model introducing new topics. 6818 */ 6819 presence_penalty?: number; 6820} 6821interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 { 6822 type?: "json_object" | "json_schema"; 6823 json_schema?: unknown; 6824} 6825interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch { 6826 requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[]; 6827} 6828interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 { 6829 /** 6830 * The input text prompt for the model to generate a response. 6831 */ 6832 prompt: string; 6833 /** 6834 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 6835 */ 6836 lora?: string; 6837 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2; 6838 /** 6839 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6840 */ 6841 raw?: boolean; 6842 /** 6843 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6844 */ 6845 stream?: boolean; 6846 /** 6847 * The maximum number of tokens to generate in the response. 6848 */ 6849 max_tokens?: number; 6850 /** 6851 * Controls the randomness of the output; higher values produce more random results. 6852 */ 6853 temperature?: number; 6854 /** 6855 * 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. 6856 */ 6857 top_p?: number; 6858 /** 6859 * 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. 6860 */ 6861 top_k?: number; 6862 /** 6863 * Random seed for reproducibility of the generation. 6864 */ 6865 seed?: number; 6866 /** 6867 * Penalty for repeated tokens; higher values discourage repetition. 6868 */ 6869 repetition_penalty?: number; 6870 /** 6871 * Decreases the likelihood of the model repeating the same lines verbatim. 6872 */ 6873 frequency_penalty?: number; 6874 /** 6875 * Increases the likelihood of the model introducing new topics. 6876 */ 6877 presence_penalty?: number; 6878} 6879interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 { 6880 type?: "json_object" | "json_schema"; 6881 json_schema?: unknown; 6882} 6883interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 { 6884 /** 6885 * An array of message objects representing the conversation history. 6886 */ 6887 messages: { 6888 /** 6889 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 6890 */ 6891 role: string; 6892 /** 6893 * The content of the message as a string. 6894 */ 6895 content: string; 6896 }[]; 6897 functions?: { 6898 name: string; 6899 code: string; 6900 }[]; 6901 /** 6902 * A list of tools available for the assistant to use. 6903 */ 6904 tools?: ({ 6905 /** 6906 * The name of the tool. More descriptive the better. 6907 */ 6908 name: string; 6909 /** 6910 * A brief description of what the tool does. 6911 */ 6912 description: string; 6913 /** 6914 * Schema defining the parameters accepted by the tool. 6915 */ 6916 parameters: { 6917 /** 6918 * The type of the parameters object (usually 'object'). 6919 */ 6920 type: string; 6921 /** 6922 * List of required parameter names. 6923 */ 6924 required?: string[]; 6925 /** 6926 * Definitions of each parameter. 6927 */ 6928 properties: { 6929 [k: string]: { 6930 /** 6931 * The data type of the parameter. 6932 */ 6933 type: string; 6934 /** 6935 * A description of the expected parameter. 6936 */ 6937 description: string; 6938 }; 6939 }; 6940 }; 6941 } | { 6942 /** 6943 * Specifies the type of tool (e.g., 'function'). 6944 */ 6945 type: string; 6946 /** 6947 * Details of the function tool. 6948 */ 6949 function: { 6950 /** 6951 * The name of the function. 6952 */ 6953 name: string; 6954 /** 6955 * A brief description of what the function does. 6956 */ 6957 description: string; 6958 /** 6959 * Schema defining the parameters accepted by the function. 6960 */ 6961 parameters: { 6962 /** 6963 * The type of the parameters object (usually 'object'). 6964 */ 6965 type: string; 6966 /** 6967 * List of required parameter names. 6968 */ 6969 required?: string[]; 6970 /** 6971 * Definitions of each parameter. 6972 */ 6973 properties: { 6974 [k: string]: { 6975 /** 6976 * The data type of the parameter. 6977 */ 6978 type: string; 6979 /** 6980 * A description of the expected parameter. 6981 */ 6982 description: string; 6983 }; 6984 }; 6985 }; 6986 }; 6987 })[]; 6988 response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3; 6989 /** 6990 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 6991 */ 6992 raw?: boolean; 6993 /** 6994 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 6995 */ 6996 stream?: boolean; 6997 /** 6998 * The maximum number of tokens to generate in the response. 6999 */ 7000 max_tokens?: number; 7001 /** 7002 * Controls the randomness of the output; higher values produce more random results. 7003 */ 7004 temperature?: number; 7005 /** 7006 * 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. 7007 */ 7008 top_p?: number; 7009 /** 7010 * 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. 7011 */ 7012 top_k?: number; 7013 /** 7014 * Random seed for reproducibility of the generation. 7015 */ 7016 seed?: number; 7017 /** 7018 * Penalty for repeated tokens; higher values discourage repetition. 7019 */ 7020 repetition_penalty?: number; 7021 /** 7022 * Decreases the likelihood of the model repeating the same lines verbatim. 7023 */ 7024 frequency_penalty?: number; 7025 /** 7026 * Increases the likelihood of the model introducing new topics. 7027 */ 7028 presence_penalty?: number; 7029} 7030interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 { 7031 type?: "json_object" | "json_schema"; 7032 json_schema?: unknown; 7033} 7034type 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; 7035interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response { 7036 /** 7037 * Unique identifier for the completion 7038 */ 7039 id?: string; 7040 /** 7041 * Object type identifier 7042 */ 7043 object?: "chat.completion"; 7044 /** 7045 * Unix timestamp of when the completion was created 7046 */ 7047 created?: number; 7048 /** 7049 * Model used for the completion 7050 */ 7051 model?: string; 7052 /** 7053 * List of completion choices 7054 */ 7055 choices?: { 7056 /** 7057 * Index of the choice in the list 7058 */ 7059 index?: number; 7060 /** 7061 * The message generated by the model 7062 */ 7063 message?: { 7064 /** 7065 * Role of the message author 7066 */ 7067 role: string; 7068 /** 7069 * The content of the message 7070 */ 7071 content: string; 7072 /** 7073 * Internal reasoning content (if available) 7074 */ 7075 reasoning_content?: string; 7076 /** 7077 * Tool calls made by the assistant 7078 */ 7079 tool_calls?: { 7080 /** 7081 * Unique identifier for the tool call 7082 */ 7083 id: string; 7084 /** 7085 * Type of tool call 7086 */ 7087 type: "function"; 7088 function: { 7089 /** 7090 * Name of the function to call 7091 */ 7092 name: string; 7093 /** 7094 * JSON string of arguments for the function 7095 */ 7096 arguments: string; 7097 }; 7098 }[]; 7099 }; 7100 /** 7101 * Reason why the model stopped generating 7102 */ 7103 finish_reason?: string; 7104 /** 7105 * Stop reason (may be null) 7106 */ 7107 stop_reason?: string | null; 7108 /** 7109 * Log probabilities (if requested) 7110 */ 7111 logprobs?: {} | null; 7112 }[]; 7113 /** 7114 * Usage statistics for the inference request 7115 */ 7116 usage?: { 7117 /** 7118 * Total number of tokens in input 7119 */ 7120 prompt_tokens?: number; 7121 /** 7122 * Total number of tokens in output 7123 */ 7124 completion_tokens?: number; 7125 /** 7126 * Total number of input and output tokens 7127 */ 7128 total_tokens?: number; 7129 }; 7130 /** 7131 * Log probabilities for the prompt (if requested) 7132 */ 7133 prompt_logprobs?: {} | null; 7134} 7135interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response { 7136 /** 7137 * Unique identifier for the completion 7138 */ 7139 id?: string; 7140 /** 7141 * Object type identifier 7142 */ 7143 object?: "text_completion"; 7144 /** 7145 * Unix timestamp of when the completion was created 7146 */ 7147 created?: number; 7148 /** 7149 * Model used for the completion 7150 */ 7151 model?: string; 7152 /** 7153 * List of completion choices 7154 */ 7155 choices?: { 7156 /** 7157 * Index of the choice in the list 7158 */ 7159 index: number; 7160 /** 7161 * The generated text completion 7162 */ 7163 text: string; 7164 /** 7165 * Reason why the model stopped generating 7166 */ 7167 finish_reason: string; 7168 /** 7169 * Stop reason (may be null) 7170 */ 7171 stop_reason?: string | null; 7172 /** 7173 * Log probabilities (if requested) 7174 */ 7175 logprobs?: {} | null; 7176 /** 7177 * Log probabilities for the prompt (if requested) 7178 */ 7179 prompt_logprobs?: {} | null; 7180 }[]; 7181 /** 7182 * Usage statistics for the inference request 7183 */ 7184 usage?: { 7185 /** 7186 * Total number of tokens in input 7187 */ 7188 prompt_tokens?: number; 7189 /** 7190 * Total number of tokens in output 7191 */ 7192 completion_tokens?: number; 7193 /** 7194 * Total number of input and output tokens 7195 */ 7196 total_tokens?: number; 7197 }; 7198} 7199interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse { 7200 /** 7201 * The async request id that can be used to obtain the results. 7202 */ 7203 request_id?: string; 7204} 7205declare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 { 7206 inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input; 7207 postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output; 7208} 7209interface Ai_Cf_Deepgram_Nova_3_Input { 7210 audio: { 7211 body: object; 7212 contentType: string; 7213 }; 7214 /** 7215 * 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. 7216 */ 7217 custom_topic_mode?: "extended" | "strict"; 7218 /** 7219 * Custom topics you want the model to detect within your input audio or text if present Submit up to 100 7220 */ 7221 custom_topic?: string; 7222 /** 7223 * 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 7224 */ 7225 custom_intent_mode?: "extended" | "strict"; 7226 /** 7227 * Custom intents you want the model to detect within your input audio if present 7228 */ 7229 custom_intent?: string; 7230 /** 7231 * Identifies and extracts key entities from content in submitted audio 7232 */ 7233 detect_entities?: boolean; 7234 /** 7235 * Identifies the dominant language spoken in submitted audio 7236 */ 7237 detect_language?: boolean; 7238 /** 7239 * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0 7240 */ 7241 diarize?: boolean; 7242 /** 7243 * Identify and extract key entities from content in submitted audio 7244 */ 7245 dictation?: boolean; 7246 /** 7247 * Specify the expected encoding of your submitted audio 7248 */ 7249 encoding?: "linear16" | "flac" | "mulaw" | "amr-nb" | "amr-wb" | "opus" | "speex" | "g729"; 7250 /** 7251 * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing 7252 */ 7253 extra?: string; 7254 /** 7255 * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um' 7256 */ 7257 filler_words?: boolean; 7258 /** 7259 * Key term prompting can boost or suppress specialized terminology and brands. 7260 */ 7261 keyterm?: string; 7262 /** 7263 * Keywords can boost or suppress specialized terminology and brands. 7264 */ 7265 keywords?: string; 7266 /** 7267 * 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. 7268 */ 7269 language?: string; 7270 /** 7271 * Spoken measurements will be converted to their corresponding abbreviations. 7272 */ 7273 measurements?: boolean; 7274 /** 7275 * 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. 7276 */ 7277 mip_opt_out?: boolean; 7278 /** 7279 * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio 7280 */ 7281 mode?: "general" | "medical" | "finance"; 7282 /** 7283 * Transcribe each audio channel independently. 7284 */ 7285 multichannel?: boolean; 7286 /** 7287 * Numerals converts numbers from written format to numerical format. 7288 */ 7289 numerals?: boolean; 7290 /** 7291 * Splits audio into paragraphs to improve transcript readability. 7292 */ 7293 paragraphs?: boolean; 7294 /** 7295 * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely. 7296 */ 7297 profanity_filter?: boolean; 7298 /** 7299 * Add punctuation and capitalization to the transcript. 7300 */ 7301 punctuate?: boolean; 7302 /** 7303 * Redaction removes sensitive information from your transcripts. 7304 */ 7305 redact?: string; 7306 /** 7307 * Search for terms or phrases in submitted audio and replaces them. 7308 */ 7309 replace?: string; 7310 /** 7311 * Search for terms or phrases in submitted audio. 7312 */ 7313 search?: string; 7314 /** 7315 * Recognizes the sentiment throughout a transcript or text. 7316 */ 7317 sentiment?: boolean; 7318 /** 7319 * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability. 7320 */ 7321 smart_format?: boolean; 7322 /** 7323 * Detect topics throughout a transcript or text. 7324 */ 7325 topics?: boolean; 7326 /** 7327 * Segments speech into meaningful semantic units. 7328 */ 7329 utterances?: boolean; 7330 /** 7331 * Seconds to wait before detecting a pause between words in submitted audio. 7332 */ 7333 utt_split?: number; 7334 /** 7335 * The number of channels in the submitted audio 7336 */ 7337 channels?: number; 7338 /** 7339 * 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. 7340 */ 7341 interim_results?: boolean; 7342 /** 7343 * 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 7344 */ 7345 endpointing?: string; 7346 /** 7347 * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets. 7348 */ 7349 vad_events?: boolean; 7350 /** 7351 * 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. 7352 */ 7353 utterance_end_ms?: boolean; 7354} 7355interface Ai_Cf_Deepgram_Nova_3_Output { 7356 results?: { 7357 channels?: { 7358 alternatives?: { 7359 confidence?: number; 7360 transcript?: string; 7361 words?: { 7362 confidence?: number; 7363 end?: number; 7364 start?: number; 7365 word?: string; 7366 }[]; 7367 }[]; 7368 }[]; 7369 summary?: { 7370 result?: string; 7371 short?: string; 7372 }; 7373 sentiments?: { 7374 segments?: { 7375 text?: string; 7376 start_word?: number; 7377 end_word?: number; 7378 sentiment?: string; 7379 sentiment_score?: number; 7380 }[]; 7381 average?: { 7382 sentiment?: string; 7383 sentiment_score?: number; 7384 }; 7385 }; 7386 }; 7387} 7388declare abstract class Base_Ai_Cf_Deepgram_Nova_3 { 7389 inputs: Ai_Cf_Deepgram_Nova_3_Input; 7390 postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output; 7391} 7392interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input { 7393 queries?: string | string[]; 7394 /** 7395 * Optional instruction for the task 7396 */ 7397 instruction?: string; 7398 documents?: string | string[]; 7399 text?: string | string[]; 7400} 7401interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output { 7402 data?: number[][]; 7403 shape?: number[]; 7404} 7405declare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B { 7406 inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input; 7407 postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output; 7408} 7409type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = { 7410 /** 7411 * readable stream with audio data and content-type specified for that data 7412 */ 7413 audio: { 7414 body: object; 7415 contentType: string; 7416 }; 7417 /** 7418 * type of data PCM data that's sent to the inference server as raw array 7419 */ 7420 dtype?: "uint8" | "float32" | "float64"; 7421} | { 7422 /** 7423 * base64 encoded audio data 7424 */ 7425 audio: string; 7426 /** 7427 * type of data PCM data that's sent to the inference server as raw array 7428 */ 7429 dtype?: "uint8" | "float32" | "float64"; 7430}; 7431interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output { 7432 /** 7433 * if true, end-of-turn was detected 7434 */ 7435 is_complete?: boolean; 7436 /** 7437 * probability of the end-of-turn detection 7438 */ 7439 probability?: number; 7440} 7441declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 { 7442 inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input; 7443 postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output; 7444} 7445declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B { 7446 inputs: ResponsesInput; 7447 postProcessedOutputs: ResponsesOutput; 7448} 7449declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B { 7450 inputs: ResponsesInput; 7451 postProcessedOutputs: ResponsesOutput; 7452} 7453interface Ai_Cf_Leonardo_Phoenix_1_0_Input { 7454 /** 7455 * A text description of the image you want to generate. 7456 */ 7457 prompt: string; 7458 /** 7459 * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt 7460 */ 7461 guidance?: number; 7462 /** 7463 * Random seed for reproducibility of the image generation 7464 */ 7465 seed?: number; 7466 /** 7467 * The height of the generated image in pixels 7468 */ 7469 height?: number; 7470 /** 7471 * The width of the generated image in pixels 7472 */ 7473 width?: number; 7474 /** 7475 * The number of diffusion steps; higher values can improve quality but take longer 7476 */ 7477 num_steps?: number; 7478 /** 7479 * Specify what to exclude from the generated images 7480 */ 7481 negative_prompt?: string; 7482} 7483/** 7484 * The generated image in JPEG format 7485 */ 7486type Ai_Cf_Leonardo_Phoenix_1_0_Output = string; 7487declare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 { 7488 inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input; 7489 postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output; 7490} 7491interface Ai_Cf_Leonardo_Lucid_Origin_Input { 7492 /** 7493 * A text description of the image you want to generate. 7494 */ 7495 prompt: string; 7496 /** 7497 * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt 7498 */ 7499 guidance?: number; 7500 /** 7501 * Random seed for reproducibility of the image generation 7502 */ 7503 seed?: number; 7504 /** 7505 * The height of the generated image in pixels 7506 */ 7507 height?: number; 7508 /** 7509 * The width of the generated image in pixels 7510 */ 7511 width?: number; 7512 /** 7513 * The number of diffusion steps; higher values can improve quality but take longer 7514 */ 7515 num_steps?: number; 7516 /** 7517 * The number of diffusion steps; higher values can improve quality but take longer 7518 */ 7519 steps?: number; 7520} 7521interface Ai_Cf_Leonardo_Lucid_Origin_Output { 7522 /** 7523 * The generated image in Base64 format. 7524 */ 7525 image?: string; 7526} 7527declare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin { 7528 inputs: Ai_Cf_Leonardo_Lucid_Origin_Input; 7529 postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output; 7530} 7531interface Ai_Cf_Deepgram_Aura_1_Input { 7532 /** 7533 * Speaker used to produce the audio. 7534 */ 7535 speaker?: "angus" | "asteria" | "arcas" | "orion" | "orpheus" | "athena" | "luna" | "zeus" | "perseus" | "helios" | "hera" | "stella"; 7536 /** 7537 * Encoding of the output audio. 7538 */ 7539 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac"; 7540 /** 7541 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.. 7542 */ 7543 container?: "none" | "wav" | "ogg"; 7544 /** 7545 * The text content to be converted to speech 7546 */ 7547 text: string; 7548 /** 7549 * 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 7550 */ 7551 sample_rate?: number; 7552 /** 7553 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. 7554 */ 7555 bit_rate?: number; 7556} 7557/** 7558 * The generated audio in MP3 format 7559 */ 7560type Ai_Cf_Deepgram_Aura_1_Output = string; 7561declare abstract class Base_Ai_Cf_Deepgram_Aura_1 { 7562 inputs: Ai_Cf_Deepgram_Aura_1_Input; 7563 postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output; 7564} 7565interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input { 7566 /** 7567 * Input text to translate. Can be a single string or a list of strings. 7568 */ 7569 text: string | string[]; 7570 /** 7571 * Target langauge to translate to 7572 */ 7573 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"; 7574} 7575interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output { 7576 /** 7577 * Translated texts 7578 */ 7579 translations: string[]; 7580} 7581declare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B { 7582 inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input; 7583 postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output; 7584} 7585type 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; 7586interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt { 7587 /** 7588 * The input text prompt for the model to generate a response. 7589 */ 7590 prompt: string; 7591 /** 7592 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 7593 */ 7594 lora?: string; 7595 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode; 7596 /** 7597 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7598 */ 7599 raw?: boolean; 7600 /** 7601 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7602 */ 7603 stream?: boolean; 7604 /** 7605 * The maximum number of tokens to generate in the response. 7606 */ 7607 max_tokens?: number; 7608 /** 7609 * Controls the randomness of the output; higher values produce more random results. 7610 */ 7611 temperature?: number; 7612 /** 7613 * 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. 7614 */ 7615 top_p?: number; 7616 /** 7617 * 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. 7618 */ 7619 top_k?: number; 7620 /** 7621 * Random seed for reproducibility of the generation. 7622 */ 7623 seed?: number; 7624 /** 7625 * Penalty for repeated tokens; higher values discourage repetition. 7626 */ 7627 repetition_penalty?: number; 7628 /** 7629 * Decreases the likelihood of the model repeating the same lines verbatim. 7630 */ 7631 frequency_penalty?: number; 7632 /** 7633 * Increases the likelihood of the model introducing new topics. 7634 */ 7635 presence_penalty?: number; 7636} 7637interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode { 7638 type?: "json_object" | "json_schema"; 7639 json_schema?: unknown; 7640} 7641interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages { 7642 /** 7643 * An array of message objects representing the conversation history. 7644 */ 7645 messages: { 7646 /** 7647 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 7648 */ 7649 role: string; 7650 /** 7651 * The content of the message as a string. 7652 */ 7653 content: string; 7654 }[]; 7655 functions?: { 7656 name: string; 7657 code: string; 7658 }[]; 7659 /** 7660 * A list of tools available for the assistant to use. 7661 */ 7662 tools?: ({ 7663 /** 7664 * The name of the tool. More descriptive the better. 7665 */ 7666 name: string; 7667 /** 7668 * A brief description of what the tool does. 7669 */ 7670 description: string; 7671 /** 7672 * Schema defining the parameters accepted by the tool. 7673 */ 7674 parameters: { 7675 /** 7676 * The type of the parameters object (usually 'object'). 7677 */ 7678 type: string; 7679 /** 7680 * List of required parameter names. 7681 */ 7682 required?: string[]; 7683 /** 7684 * Definitions of each parameter. 7685 */ 7686 properties: { 7687 [k: string]: { 7688 /** 7689 * The data type of the parameter. 7690 */ 7691 type: string; 7692 /** 7693 * A description of the expected parameter. 7694 */ 7695 description: string; 7696 }; 7697 }; 7698 }; 7699 } | { 7700 /** 7701 * Specifies the type of tool (e.g., 'function'). 7702 */ 7703 type: string; 7704 /** 7705 * Details of the function tool. 7706 */ 7707 function: { 7708 /** 7709 * The name of the function. 7710 */ 7711 name: string; 7712 /** 7713 * A brief description of what the function does. 7714 */ 7715 description: string; 7716 /** 7717 * Schema defining the parameters accepted by the function. 7718 */ 7719 parameters: { 7720 /** 7721 * The type of the parameters object (usually 'object'). 7722 */ 7723 type: string; 7724 /** 7725 * List of required parameter names. 7726 */ 7727 required?: string[]; 7728 /** 7729 * Definitions of each parameter. 7730 */ 7731 properties: { 7732 [k: string]: { 7733 /** 7734 * The data type of the parameter. 7735 */ 7736 type: string; 7737 /** 7738 * A description of the expected parameter. 7739 */ 7740 description: string; 7741 }; 7742 }; 7743 }; 7744 }; 7745 })[]; 7746 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1; 7747 /** 7748 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7749 */ 7750 raw?: boolean; 7751 /** 7752 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7753 */ 7754 stream?: boolean; 7755 /** 7756 * The maximum number of tokens to generate in the response. 7757 */ 7758 max_tokens?: number; 7759 /** 7760 * Controls the randomness of the output; higher values produce more random results. 7761 */ 7762 temperature?: number; 7763 /** 7764 * 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. 7765 */ 7766 top_p?: number; 7767 /** 7768 * 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. 7769 */ 7770 top_k?: number; 7771 /** 7772 * Random seed for reproducibility of the generation. 7773 */ 7774 seed?: number; 7775 /** 7776 * Penalty for repeated tokens; higher values discourage repetition. 7777 */ 7778 repetition_penalty?: number; 7779 /** 7780 * Decreases the likelihood of the model repeating the same lines verbatim. 7781 */ 7782 frequency_penalty?: number; 7783 /** 7784 * Increases the likelihood of the model introducing new topics. 7785 */ 7786 presence_penalty?: number; 7787} 7788interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 { 7789 type?: "json_object" | "json_schema"; 7790 json_schema?: unknown; 7791} 7792interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch { 7793 requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[]; 7794} 7795interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 { 7796 /** 7797 * The input text prompt for the model to generate a response. 7798 */ 7799 prompt: string; 7800 /** 7801 * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. 7802 */ 7803 lora?: string; 7804 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2; 7805 /** 7806 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7807 */ 7808 raw?: boolean; 7809 /** 7810 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7811 */ 7812 stream?: boolean; 7813 /** 7814 * The maximum number of tokens to generate in the response. 7815 */ 7816 max_tokens?: number; 7817 /** 7818 * Controls the randomness of the output; higher values produce more random results. 7819 */ 7820 temperature?: number; 7821 /** 7822 * 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. 7823 */ 7824 top_p?: number; 7825 /** 7826 * 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. 7827 */ 7828 top_k?: number; 7829 /** 7830 * Random seed for reproducibility of the generation. 7831 */ 7832 seed?: number; 7833 /** 7834 * Penalty for repeated tokens; higher values discourage repetition. 7835 */ 7836 repetition_penalty?: number; 7837 /** 7838 * Decreases the likelihood of the model repeating the same lines verbatim. 7839 */ 7840 frequency_penalty?: number; 7841 /** 7842 * Increases the likelihood of the model introducing new topics. 7843 */ 7844 presence_penalty?: number; 7845} 7846interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 { 7847 type?: "json_object" | "json_schema"; 7848 json_schema?: unknown; 7849} 7850interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 { 7851 /** 7852 * An array of message objects representing the conversation history. 7853 */ 7854 messages: { 7855 /** 7856 * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). 7857 */ 7858 role: string; 7859 /** 7860 * The content of the message as a string. 7861 */ 7862 content: string; 7863 }[]; 7864 functions?: { 7865 name: string; 7866 code: string; 7867 }[]; 7868 /** 7869 * A list of tools available for the assistant to use. 7870 */ 7871 tools?: ({ 7872 /** 7873 * The name of the tool. More descriptive the better. 7874 */ 7875 name: string; 7876 /** 7877 * A brief description of what the tool does. 7878 */ 7879 description: string; 7880 /** 7881 * Schema defining the parameters accepted by the tool. 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 * Specifies the type of tool (e.g., 'function'). 7911 */ 7912 type: string; 7913 /** 7914 * Details of the function tool. 7915 */ 7916 function: { 7917 /** 7918 * The name of the function. 7919 */ 7920 name: string; 7921 /** 7922 * A brief description of what the function does. 7923 */ 7924 description: string; 7925 /** 7926 * Schema defining the parameters accepted by the function. 7927 */ 7928 parameters: { 7929 /** 7930 * The type of the parameters object (usually 'object'). 7931 */ 7932 type: string; 7933 /** 7934 * List of required parameter names. 7935 */ 7936 required?: string[]; 7937 /** 7938 * Definitions of each parameter. 7939 */ 7940 properties: { 7941 [k: string]: { 7942 /** 7943 * The data type of the parameter. 7944 */ 7945 type: string; 7946 /** 7947 * A description of the expected parameter. 7948 */ 7949 description: string; 7950 }; 7951 }; 7952 }; 7953 }; 7954 })[]; 7955 response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3; 7956 /** 7957 * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. 7958 */ 7959 raw?: boolean; 7960 /** 7961 * If true, the response will be streamed back incrementally using SSE, Server Sent Events. 7962 */ 7963 stream?: boolean; 7964 /** 7965 * The maximum number of tokens to generate in the response. 7966 */ 7967 max_tokens?: number; 7968 /** 7969 * Controls the randomness of the output; higher values produce more random results. 7970 */ 7971 temperature?: number; 7972 /** 7973 * 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. 7974 */ 7975 top_p?: number; 7976 /** 7977 * 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. 7978 */ 7979 top_k?: number; 7980 /** 7981 * Random seed for reproducibility of the generation. 7982 */ 7983 seed?: number; 7984 /** 7985 * Penalty for repeated tokens; higher values discourage repetition. 7986 */ 7987 repetition_penalty?: number; 7988 /** 7989 * Decreases the likelihood of the model repeating the same lines verbatim. 7990 */ 7991 frequency_penalty?: number; 7992 /** 7993 * Increases the likelihood of the model introducing new topics. 7994 */ 7995 presence_penalty?: number; 7996} 7997interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 { 7998 type?: "json_object" | "json_schema"; 7999 json_schema?: unknown; 8000} 8001type 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; 8002interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response { 8003 /** 8004 * Unique identifier for the completion 8005 */ 8006 id?: string; 8007 /** 8008 * Object type identifier 8009 */ 8010 object?: "chat.completion"; 8011 /** 8012 * Unix timestamp of when the completion was created 8013 */ 8014 created?: number; 8015 /** 8016 * Model used for the completion 8017 */ 8018 model?: string; 8019 /** 8020 * List of completion choices 8021 */ 8022 choices?: { 8023 /** 8024 * Index of the choice in the list 8025 */ 8026 index?: number; 8027 /** 8028 * The message generated by the model 8029 */ 8030 message?: { 8031 /** 8032 * Role of the message author 8033 */ 8034 role: string; 8035 /** 8036 * The content of the message 8037 */ 8038 content: string; 8039 /** 8040 * Internal reasoning content (if available) 8041 */ 8042 reasoning_content?: string; 8043 /** 8044 * Tool calls made by the assistant 8045 */ 8046 tool_calls?: { 8047 /** 8048 * Unique identifier for the tool call 8049 */ 8050 id: string; 8051 /** 8052 * Type of tool call 8053 */ 8054 type: "function"; 8055 function: { 8056 /** 8057 * Name of the function to call 8058 */ 8059 name: string; 8060 /** 8061 * JSON string of arguments for the function 8062 */ 8063 arguments: string; 8064 }; 8065 }[]; 8066 }; 8067 /** 8068 * Reason why the model stopped generating 8069 */ 8070 finish_reason?: string; 8071 /** 8072 * Stop reason (may be null) 8073 */ 8074 stop_reason?: string | null; 8075 /** 8076 * Log probabilities (if requested) 8077 */ 8078 logprobs?: {} | null; 8079 }[]; 8080 /** 8081 * Usage statistics for the inference request 8082 */ 8083 usage?: { 8084 /** 8085 * Total number of tokens in input 8086 */ 8087 prompt_tokens?: number; 8088 /** 8089 * Total number of tokens in output 8090 */ 8091 completion_tokens?: number; 8092 /** 8093 * Total number of input and output tokens 8094 */ 8095 total_tokens?: number; 8096 }; 8097 /** 8098 * Log probabilities for the prompt (if requested) 8099 */ 8100 prompt_logprobs?: {} | null; 8101} 8102interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response { 8103 /** 8104 * Unique identifier for the completion 8105 */ 8106 id?: string; 8107 /** 8108 * Object type identifier 8109 */ 8110 object?: "text_completion"; 8111 /** 8112 * Unix timestamp of when the completion was created 8113 */ 8114 created?: number; 8115 /** 8116 * Model used for the completion 8117 */ 8118 model?: string; 8119 /** 8120 * List of completion choices 8121 */ 8122 choices?: { 8123 /** 8124 * Index of the choice in the list 8125 */ 8126 index: number; 8127 /** 8128 * The generated text completion 8129 */ 8130 text: string; 8131 /** 8132 * Reason why the model stopped generating 8133 */ 8134 finish_reason: string; 8135 /** 8136 * Stop reason (may be null) 8137 */ 8138 stop_reason?: string | null; 8139 /** 8140 * Log probabilities (if requested) 8141 */ 8142 logprobs?: {} | null; 8143 /** 8144 * Log probabilities for the prompt (if requested) 8145 */ 8146 prompt_logprobs?: {} | null; 8147 }[]; 8148 /** 8149 * Usage statistics for the inference request 8150 */ 8151 usage?: { 8152 /** 8153 * Total number of tokens in input 8154 */ 8155 prompt_tokens?: number; 8156 /** 8157 * Total number of tokens in output 8158 */ 8159 completion_tokens?: number; 8160 /** 8161 * Total number of input and output tokens 8162 */ 8163 total_tokens?: number; 8164 }; 8165} 8166interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse { 8167 /** 8168 * The async request id that can be used to obtain the results. 8169 */ 8170 request_id?: string; 8171} 8172declare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It { 8173 inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input; 8174 postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output; 8175} 8176interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input { 8177 /** 8178 * Input text to embed. Can be a single string or a list of strings. 8179 */ 8180 text: string | string[]; 8181} 8182interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output { 8183 /** 8184 * Embedding vectors, where each vector is a list of floats. 8185 */ 8186 data: number[][]; 8187 /** 8188 * Shape of the embedding data as [number_of_embeddings, embedding_dimension]. 8189 * 8190 * @minItems 2 8191 * @maxItems 2 8192 */ 8193 shape: [ 8194 number, 8195 number 8196 ]; 8197} 8198declare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B { 8199 inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input; 8200 postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output; 8201} 8202interface Ai_Cf_Deepgram_Flux_Input { 8203 /** 8204 * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM. 8205 */ 8206 encoding: "linear16"; 8207 /** 8208 * Sample rate of the audio stream in Hz. 8209 */ 8210 sample_rate: string; 8211 /** 8212 * 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. 8213 */ 8214 eager_eot_threshold?: string; 8215 /** 8216 * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9. 8217 */ 8218 eot_threshold?: string; 8219 /** 8220 * A turn will be finished when this much time has passed after speech, regardless of EOT confidence. 8221 */ 8222 eot_timeout_ms?: string; 8223 /** 8224 * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms. 8225 */ 8226 keyterm?: string; 8227 /** 8228 * 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 8229 */ 8230 mip_opt_out?: "true" | "false"; 8231 /** 8232 * Label your requests for the purpose of identification during usage reporting 8233 */ 8234 tag?: string; 8235} 8236/** 8237 * Output will be returned as websocket messages. 8238 */ 8239interface Ai_Cf_Deepgram_Flux_Output { 8240 /** 8241 * The unique identifier of the request (uuid) 8242 */ 8243 request_id?: string; 8244 /** 8245 * Starts at 0 and increments for each message the server sends to the client. 8246 */ 8247 sequence_id?: number; 8248 /** 8249 * The type of event being reported. 8250 */ 8251 event?: "Update" | "StartOfTurn" | "EagerEndOfTurn" | "TurnResumed" | "EndOfTurn"; 8252 /** 8253 * The index of the current turn 8254 */ 8255 turn_index?: number; 8256 /** 8257 * Start time in seconds of the audio range that was transcribed 8258 */ 8259 audio_window_start?: number; 8260 /** 8261 * End time in seconds of the audio range that was transcribed 8262 */ 8263 audio_window_end?: number; 8264 /** 8265 * Text that was said over the course of the current turn 8266 */ 8267 transcript?: string; 8268 /** 8269 * The words in the transcript 8270 */ 8271 words?: { 8272 /** 8273 * The individual punctuated, properly-cased word from the transcript 8274 */ 8275 word: string; 8276 /** 8277 * Confidence that this word was transcribed correctly 8278 */ 8279 confidence: number; 8280 }[]; 8281 /** 8282 * Confidence that no more speech is coming in this turn 8283 */ 8284 end_of_turn_confidence?: number; 8285} 8286declare abstract class Base_Ai_Cf_Deepgram_Flux { 8287 inputs: Ai_Cf_Deepgram_Flux_Input; 8288 postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output; 8289} 8290interface Ai_Cf_Deepgram_Aura_2_En_Input { 8291 /** 8292 * Speaker used to produce the audio. 8293 */ 8294 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"; 8295 /** 8296 * Encoding of the output audio. 8297 */ 8298 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac"; 8299 /** 8300 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.. 8301 */ 8302 container?: "none" | "wav" | "ogg"; 8303 /** 8304 * The text content to be converted to speech 8305 */ 8306 text: string; 8307 /** 8308 * 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 8309 */ 8310 sample_rate?: number; 8311 /** 8312 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. 8313 */ 8314 bit_rate?: number; 8315} 8316/** 8317 * The generated audio in MP3 format 8318 */ 8319type Ai_Cf_Deepgram_Aura_2_En_Output = string; 8320declare abstract class Base_Ai_Cf_Deepgram_Aura_2_En { 8321 inputs: Ai_Cf_Deepgram_Aura_2_En_Input; 8322 postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output; 8323} 8324interface Ai_Cf_Deepgram_Aura_2_Es_Input { 8325 /** 8326 * Speaker used to produce the audio. 8327 */ 8328 speaker?: "sirio" | "nestor" | "carina" | "celeste" | "alvaro" | "diana" | "aquila" | "selena" | "estrella" | "javier"; 8329 /** 8330 * Encoding of the output audio. 8331 */ 8332 encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac"; 8333 /** 8334 * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.. 8335 */ 8336 container?: "none" | "wav" | "ogg"; 8337 /** 8338 * The text content to be converted to speech 8339 */ 8340 text: string; 8341 /** 8342 * 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 8343 */ 8344 sample_rate?: number; 8345 /** 8346 * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. 8347 */ 8348 bit_rate?: number; 8349} 8350/** 8351 * The generated audio in MP3 format 8352 */ 8353type Ai_Cf_Deepgram_Aura_2_Es_Output = string; 8354declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es { 8355 inputs: Ai_Cf_Deepgram_Aura_2_Es_Input; 8356 postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output; 8357} 8358interface AiModels { 8359 "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification; 8360 "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage; 8361 "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage; 8362 "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage; 8363 "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage; 8364 "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage; 8365 "@cf/myshell-ai/melotts": BaseAiTextToSpeech; 8366 "@cf/google/embeddinggemma-300m": BaseAiTextEmbeddings; 8367 "@cf/microsoft/resnet-50": BaseAiImageClassification; 8368 "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration; 8369 "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration; 8370 "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration; 8371 "@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration; 8372 "@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration; 8373 "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration; 8374 "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration; 8375 "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration; 8376 "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration; 8377 "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration; 8378 "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration; 8379 "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration; 8380 "@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration; 8381 "@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration; 8382 "@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration; 8383 "@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration; 8384 "@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration; 8385 "@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration; 8386 "@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration; 8387 "@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration; 8388 "@cf/microsoft/phi-2": BaseAiTextGeneration; 8389 "@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration; 8390 "@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration; 8391 "@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration; 8392 "@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration; 8393 "@hf/google/gemma-7b-it": BaseAiTextGeneration; 8394 "@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration; 8395 "@cf/google/gemma-2b-it-lora": BaseAiTextGeneration; 8396 "@cf/google/gemma-7b-it-lora": BaseAiTextGeneration; 8397 "@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration; 8398 "@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration; 8399 "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration; 8400 "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration; 8401 "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration; 8402 "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration; 8403 "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration; 8404 "@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration; 8405 "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b": BaseAiTextGeneration; 8406 "@cf/ibm-granite/granite-4.0-h-micro": BaseAiTextGeneration; 8407 "@cf/facebook/bart-large-cnn": BaseAiSummarization; 8408 "@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText; 8409 "@cf/baai/bge-base-en-v1.5": Base_Ai_Cf_Baai_Bge_Base_En_V1_5; 8410 "@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper; 8411 "@cf/meta/m2m100-1.2b": Base_Ai_Cf_Meta_M2M100_1_2B; 8412 "@cf/baai/bge-small-en-v1.5": Base_Ai_Cf_Baai_Bge_Small_En_V1_5; 8413 "@cf/baai/bge-large-en-v1.5": Base_Ai_Cf_Baai_Bge_Large_En_V1_5; 8414 "@cf/unum/uform-gen2-qwen-500m": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M; 8415 "@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En; 8416 "@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo; 8417 "@cf/baai/bge-m3": Base_Ai_Cf_Baai_Bge_M3; 8418 "@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell; 8419 "@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct; 8420 "@cf/meta/llama-3.3-70b-instruct-fp8-fast": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast; 8421 "@cf/meta/llama-guard-3-8b": Base_Ai_Cf_Meta_Llama_Guard_3_8B; 8422 "@cf/baai/bge-reranker-base": Base_Ai_Cf_Baai_Bge_Reranker_Base; 8423 "@cf/qwen/qwen2.5-coder-32b-instruct": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct; 8424 "@cf/qwen/qwq-32b": Base_Ai_Cf_Qwen_Qwq_32B; 8425 "@cf/mistralai/mistral-small-3.1-24b-instruct": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct; 8426 "@cf/google/gemma-3-12b-it": Base_Ai_Cf_Google_Gemma_3_12B_It; 8427 "@cf/meta/llama-4-scout-17b-16e-instruct": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct; 8428 "@cf/qwen/qwen3-30b-a3b-fp8": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8; 8429 "@cf/deepgram/nova-3": Base_Ai_Cf_Deepgram_Nova_3; 8430 "@cf/qwen/qwen3-embedding-0.6b": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B; 8431 "@cf/pipecat-ai/smart-turn-v2": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2; 8432 "@cf/openai/gpt-oss-120b": Base_Ai_Cf_Openai_Gpt_Oss_120B; 8433 "@cf/openai/gpt-oss-20b": Base_Ai_Cf_Openai_Gpt_Oss_20B; 8434 "@cf/leonardo/phoenix-1.0": Base_Ai_Cf_Leonardo_Phoenix_1_0; 8435 "@cf/leonardo/lucid-origin": Base_Ai_Cf_Leonardo_Lucid_Origin; 8436 "@cf/deepgram/aura-1": Base_Ai_Cf_Deepgram_Aura_1; 8437 "@cf/ai4bharat/indictrans2-en-indic-1B": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B; 8438 "@cf/aisingapore/gemma-sea-lion-v4-27b-it": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It; 8439 "@cf/pfnet/plamo-embedding-1b": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B; 8440 "@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux; 8441 "@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En; 8442 "@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es; 8443} 8444type AiOptions = { 8445 /** 8446 * Send requests as an asynchronous batch job, only works for supported models 8447 * https://developers.cloudflare.com/workers-ai/features/batch-api 8448 */ 8449 queueRequest?: boolean; 8450 /** 8451 * Establish websocket connections, only works for supported models 8452 */ 8453 websocket?: boolean; 8454 /** 8455 * Tag your requests to group and view them in Cloudflare dashboard. 8456 * 8457 * Rules: 8458 * Tags must only contain letters, numbers, and the symbols: : - . / @ 8459 * Each tag can have maximum 50 characters. 8460 * Maximum 5 tags are allowed each request. 8461 * Duplicate tags will removed. 8462 */ 8463 tags: string[]; 8464 gateway?: GatewayOptions; 8465 returnRawResponse?: boolean; 8466 prefix?: string; 8467 extraHeaders?: object; 8468}; 8469type AiModelsSearchParams = { 8470 author?: string; 8471 hide_experimental?: boolean; 8472 page?: number; 8473 per_page?: number; 8474 search?: string; 8475 source?: number; 8476 task?: string; 8477}; 8478type AiModelsSearchObject = { 8479 id: string; 8480 source: number; 8481 name: string; 8482 description: string; 8483 task: { 8484 id: string; 8485 name: string; 8486 description: string; 8487 }; 8488 tags: string[]; 8489 properties: { 8490 property_id: string; 8491 value: string; 8492 }[]; 8493}; 8494interface InferenceUpstreamError extends Error { 8495} 8496interface AiInternalError extends Error { 8497} 8498type AiModelListType = Record<string, any>; 8499declare abstract class Ai<AiModelList extends AiModelListType = AiModels> { 8500 aiGatewayLogId: string | null; 8501 gateway(gatewayId: string): AiGateway; 8502 autorag(autoragId: string): AutoRAG; 8503 run<Name extends keyof AiModelList, Options extends AiOptions, InputOptions extends AiModelList[Name]["inputs"]>(model: Name, inputs: InputOptions, options?: Options): Promise<Options extends { 8504 returnRawResponse: true; 8505 } | { 8506 websocket: true; 8507 } ? Response : InputOptions extends { 8508 stream: true; 8509 } ? ReadableStream : AiModelList[Name]["postProcessedOutputs"]>; 8510 models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>; 8511 toMarkdown(): ToMarkdownService; 8512 toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>; 8513 toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>; 8514} 8515type GatewayRetries = { 8516 maxAttempts?: 1 | 2 | 3 | 4 | 5; 8517 retryDelayMs?: number; 8518 backoff?: 'constant' | 'linear' | 'exponential'; 8519}; 8520type GatewayOptions = { 8521 id: string; 8522 cacheKey?: string; 8523 cacheTtl?: number; 8524 skipCache?: boolean; 8525 metadata?: Record<string, number | string | boolean | null | bigint>; 8526 collectLog?: boolean; 8527 eventId?: string; 8528 requestTimeoutMs?: number; 8529 retries?: GatewayRetries; 8530}; 8531type UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & { 8532 /** 8533 ** @deprecated 8534 */ 8535 id?: string; 8536}; 8537type AiGatewayPatchLog = { 8538 score?: number | null; 8539 feedback?: -1 | 1 | null; 8540 metadata?: Record<string, number | string | boolean | null | bigint> | null; 8541}; 8542type AiGatewayLog = { 8543 id: string; 8544 provider: string; 8545 model: string; 8546 model_type?: string; 8547 path: string; 8548 duration: number; 8549 request_type?: string; 8550 request_content_type?: string; 8551 status_code: number; 8552 response_content_type?: string; 8553 success: boolean; 8554 cached: boolean; 8555 tokens_in?: number; 8556 tokens_out?: number; 8557 metadata?: Record<string, number | string | boolean | null | bigint>; 8558 step?: number; 8559 cost?: number; 8560 custom_cost?: boolean; 8561 request_size: number; 8562 request_head?: string; 8563 request_head_complete: boolean; 8564 response_size: number; 8565 response_head?: string; 8566 response_head_complete: boolean; 8567 created_at: Date; 8568}; 8569type 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'; 8570type AIGatewayHeaders = { 8571 'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string; 8572 'cf-aig-custom-cost': { 8573 per_token_in?: number; 8574 per_token_out?: number; 8575 } | { 8576 total_cost?: number; 8577 } | string; 8578 'cf-aig-cache-ttl': number | string; 8579 'cf-aig-skip-cache': boolean | string; 8580 'cf-aig-cache-key': string; 8581 'cf-aig-event-id': string; 8582 'cf-aig-request-timeout': number | string; 8583 'cf-aig-max-attempts': number | string; 8584 'cf-aig-retry-delay': number | string; 8585 'cf-aig-backoff': string; 8586 'cf-aig-collect-log': boolean | string; 8587 Authorization: string; 8588 'Content-Type': string; 8589 [key: string]: string | number | boolean | object; 8590}; 8591type AIGatewayUniversalRequest = { 8592 provider: AIGatewayProviders | string; // eslint-disable-line 8593 endpoint: string; 8594 headers: Partial<AIGatewayHeaders>; 8595 query: unknown; 8596}; 8597interface AiGatewayInternalError extends Error { 8598} 8599interface AiGatewayLogNotFound extends Error { 8600} 8601declare abstract class AiGateway { 8602 patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>; 8603 getLog(logId: string): Promise<AiGatewayLog>; 8604 run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: { 8605 gateway?: UniversalGatewayOptions; 8606 extraHeaders?: object; 8607 }): Promise<Response>; 8608 getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line 8609} 8610interface AutoRAGInternalError extends Error { 8611} 8612interface AutoRAGNotFoundError extends Error { 8613} 8614interface AutoRAGUnauthorizedError extends Error { 8615} 8616interface AutoRAGNameNotSetError extends Error { 8617} 8618type ComparisonFilter = { 8619 key: string; 8620 type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte'; 8621 value: string | number | boolean; 8622}; 8623type CompoundFilter = { 8624 type: 'and' | 'or'; 8625 filters: ComparisonFilter[]; 8626}; 8627type AutoRagSearchRequest = { 8628 query: string; 8629 filters?: CompoundFilter | ComparisonFilter; 8630 max_num_results?: number; 8631 ranking_options?: { 8632 ranker?: string; 8633 score_threshold?: number; 8634 }; 8635 reranking?: { 8636 enabled?: boolean; 8637 model?: string; 8638 }; 8639 rewrite_query?: boolean; 8640}; 8641type AutoRagAiSearchRequest = AutoRagSearchRequest & { 8642 stream?: boolean; 8643 system_prompt?: string; 8644}; 8645type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & { 8646 stream: true; 8647}; 8648type AutoRagSearchResponse = { 8649 object: 'vector_store.search_results.page'; 8650 search_query: string; 8651 data: { 8652 file_id: string; 8653 filename: string; 8654 score: number; 8655 attributes: Record<string, string | number | boolean | null>; 8656 content: { 8657 type: 'text'; 8658 text: string; 8659 }[]; 8660 }[]; 8661 has_more: boolean; 8662 next_page: string | null; 8663}; 8664type AutoRagListResponse = { 8665 id: string; 8666 enable: boolean; 8667 type: string; 8668 source: string; 8669 vectorize_name: string; 8670 paused: boolean; 8671 status: string; 8672}[]; 8673type AutoRagAiSearchResponse = AutoRagSearchResponse & { 8674 response: string; 8675}; 8676declare abstract class AutoRAG { 8677 list(): Promise<AutoRagListResponse>; 8678 search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>; 8679 aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>; 8680 aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>; 8681 aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>; 8682} 8683interface BasicImageTransformations { 8684 /** 8685 * Maximum width in image pixels. The value must be an integer. 8686 */ 8687 width?: number; 8688 /** 8689 * Maximum height in image pixels. The value must be an integer. 8690 */ 8691 height?: number; 8692 /** 8693 * Resizing mode as a string. It affects interpretation of width and height 8694 * options: 8695 * - scale-down: Similar to contain, but the image is never enlarged. If 8696 * the image is larger than given width or height, it will be resized. 8697 * Otherwise its original size will be kept. 8698 * - contain: Resizes to maximum size that fits within the given width and 8699 * height. If only a single dimension is given (e.g. only width), the 8700 * image will be shrunk or enlarged to exactly match that dimension. 8701 * Aspect ratio is always preserved. 8702 * - cover: Resizes (shrinks or enlarges) to fill the entire area of width 8703 * and height. If the image has an aspect ratio different from the ratio 8704 * of width and height, it will be cropped to fit. 8705 * - crop: The image will be shrunk and cropped to fit within the area 8706 * specified by width and height. The image will not be enlarged. For images 8707 * smaller than the given dimensions it's the same as scale-down. For 8708 * images larger than the given dimensions, it's the same as cover. 8709 * See also trim. 8710 * - pad: Resizes to the maximum size that fits within the given width and 8711 * height, and then fills the remaining area with a background color 8712 * (white by default). Use of this mode is not recommended, as the same 8713 * effect can be more efficiently achieved with the contain mode and the 8714 * CSS object-fit: contain property. 8715 * - squeeze: Stretches and deforms to the width and height given, even if it 8716 * breaks aspect ratio 8717 */ 8718 fit?: "scale-down" | "contain" | "cover" | "crop" | "pad" | "squeeze"; 8719 /** 8720 * Image segmentation using artificial intelligence models. Sets pixels not 8721 * within selected segment area to transparent e.g "foreground" sets every 8722 * background pixel as transparent. 8723 */ 8724 segment?: "foreground"; 8725 /** 8726 * When cropping with fit: "cover", this defines the side or point that should 8727 * be left uncropped. The value is either a string 8728 * "left", "right", "top", "bottom", "auto", or "center" (the default), 8729 * or an object {x, y} containing focal point coordinates in the original 8730 * image expressed as fractions ranging from 0.0 (top or left) to 1.0 8731 * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will 8732 * crop bottom or left and right sides as necessary, but won’t crop anything 8733 * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to 8734 * preserve as much as possible around a point at 20% of the height of the 8735 * source image. 8736 */ 8737 gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates; 8738 /** 8739 * Background color to add underneath the image. Applies only to images with 8740 * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), 8741 * hsl(…), etc.) 8742 */ 8743 background?: string; 8744 /** 8745 * Number of degrees (90, 180, 270) to rotate the image by. width and height 8746 * options refer to axes after rotation. 8747 */ 8748 rotate?: 0 | 90 | 180 | 270 | 360; 8749} 8750interface BasicImageTransformationsGravityCoordinates { 8751 x?: number; 8752 y?: number; 8753 mode?: 'remainder' | 'box-center'; 8754} 8755/** 8756 * In addition to the properties you can set in the RequestInit dict 8757 * that you pass as an argument to the Request constructor, you can 8758 * set certain properties of a `cf` object to control how Cloudflare 8759 * features are applied to that new Request. 8760 * 8761 * Note: Currently, these properties cannot be tested in the 8762 * playground. 8763 */ 8764interface RequestInitCfProperties extends Record<string, unknown> { 8765 cacheEverything?: boolean; 8766 /** 8767 * A request's cache key is what determines if two requests are 8768 * "the same" for caching purposes. If a request has the same cache key 8769 * as some previous request, then we can serve the same cached response for 8770 * both. (e.g. 'some-key') 8771 * 8772 * Only available for Enterprise customers. 8773 */ 8774 cacheKey?: string; 8775 /** 8776 * This allows you to append additional Cache-Tag response headers 8777 * to the origin response without modifications to the origin server. 8778 * This will allow for greater control over the Purge by Cache Tag feature 8779 * utilizing changes only in the Workers process. 8780 * 8781 * Only available for Enterprise customers. 8782 */ 8783 cacheTags?: string[]; 8784 /** 8785 * Force response to be cached for a given number of seconds. (e.g. 300) 8786 */ 8787 cacheTtl?: number; 8788 /** 8789 * Force response to be cached for a given number of seconds based on the Origin status code. 8790 * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) 8791 */ 8792 cacheTtlByStatus?: Record<string, number>; 8793 scrapeShield?: boolean; 8794 apps?: boolean; 8795 image?: RequestInitCfPropertiesImage; 8796 minify?: RequestInitCfPropertiesImageMinify; 8797 mirage?: boolean; 8798 polish?: "lossy" | "lossless" | "off"; 8799 r2?: RequestInitCfPropertiesR2; 8800 /** 8801 * Redirects the request to an alternate origin server. You can use this, 8802 * for example, to implement load balancing across several origins. 8803 * (e.g.us-east.example.com) 8804 * 8805 * Note - For security reasons, the hostname set in resolveOverride must 8806 * be proxied on the same Cloudflare zone of the incoming request. 8807 * Otherwise, the setting is ignored. CNAME hosts are allowed, so to 8808 * resolve to a host under a different domain or a DNS only domain first 8809 * declare a CNAME record within your own zone’s DNS mapping to the 8810 * external hostname, set proxy on Cloudflare, then set resolveOverride 8811 * to point to that CNAME record. 8812 */ 8813 resolveOverride?: string; 8814} 8815interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations { 8816 /** 8817 * Absolute URL of the image file to use for the drawing. It can be any of 8818 * the supported file formats. For drawing of watermarks or non-rectangular 8819 * overlays we recommend using PNG or WebP images. 8820 */ 8821 url: string; 8822 /** 8823 * Floating-point number between 0 (transparent) and 1 (opaque). 8824 * For example, opacity: 0.5 makes overlay semitransparent. 8825 */ 8826 opacity?: number; 8827 /** 8828 * - If set to true, the overlay image will be tiled to cover the entire 8829 * area. This is useful for stock-photo-like watermarks. 8830 * - If set to "x", the overlay image will be tiled horizontally only 8831 * (form a line). 8832 * - If set to "y", the overlay image will be tiled vertically only 8833 * (form a line). 8834 */ 8835 repeat?: true | "x" | "y"; 8836 /** 8837 * Position of the overlay image relative to a given edge. Each property is 8838 * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 8839 * positions left side of the overlay 10 pixels from the left edge of the 8840 * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom 8841 * of the background image. 8842 * 8843 * Setting both left & right, or both top & bottom is an error. 8844 * 8845 * If no position is specified, the image will be centered. 8846 */ 8847 top?: number; 8848 left?: number; 8849 bottom?: number; 8850 right?: number; 8851} 8852interface RequestInitCfPropertiesImage extends BasicImageTransformations { 8853 /** 8854 * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it 8855 * easier to specify higher-DPI sizes in <img srcset>. 8856 */ 8857 dpr?: number; 8858 /** 8859 * Allows you to trim your image. Takes dpr into account and is performed before 8860 * resizing or rotation. 8861 * 8862 * It can be used as: 8863 * - left, top, right, bottom - it will specify the number of pixels to cut 8864 * off each side 8865 * - width, height - the width/height you'd like to end up with - can be used 8866 * in combination with the properties above 8867 * - border - this will automatically trim the surroundings of an image based on 8868 * it's color. It consists of three properties: 8869 * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit) 8870 * - tolerance: difference from color to treat as color 8871 * - keep: the number of pixels of border to keep 8872 */ 8873 trim?: "border" | { 8874 top?: number; 8875 bottom?: number; 8876 left?: number; 8877 right?: number; 8878 width?: number; 8879 height?: number; 8880 border?: boolean | { 8881 color?: string; 8882 tolerance?: number; 8883 keep?: number; 8884 }; 8885 }; 8886 /** 8887 * Quality setting from 1-100 (useful values are in 60-90 range). Lower values 8888 * make images look worse, but load faster. The default is 85. It applies only 8889 * to JPEG and WebP images. It doesn’t have any effect on PNG. 8890 */ 8891 quality?: number | "low" | "medium-low" | "medium-high" | "high"; 8892 /** 8893 * Output format to generate. It can be: 8894 * - avif: generate images in AVIF format. 8895 * - webp: generate images in Google WebP format. Set quality to 100 to get 8896 * the WebP-lossless format. 8897 * - json: instead of generating an image, outputs information about the 8898 * image, in JSON format. The JSON object will contain image size 8899 * (before and after resizing), source image’s MIME type, file size, etc. 8900 * - jpeg: generate images in JPEG format. 8901 * - png: generate images in PNG format. 8902 */ 8903 format?: "avif" | "webp" | "json" | "jpeg" | "png" | "baseline-jpeg" | "png-force" | "svg"; 8904 /** 8905 * Whether to preserve animation frames from input files. Default is true. 8906 * Setting it to false reduces animations to still images. This setting is 8907 * recommended when enlarging images or processing arbitrary user content, 8908 * because large GIF animations can weigh tens or even hundreds of megabytes. 8909 * It is also useful to set anim:false when using format:"json" to get the 8910 * response quicker without the number of frames. 8911 */ 8912 anim?: boolean; 8913 /** 8914 * What EXIF data should be preserved in the output image. Note that EXIF 8915 * rotation and embedded color profiles are always applied ("baked in" into 8916 * the image), and aren't affected by this option. Note that if the Polish 8917 * feature is enabled, all metadata may have been removed already and this 8918 * option may have no effect. 8919 * - keep: Preserve most of EXIF metadata, including GPS location if there's 8920 * any. 8921 * - copyright: Only keep the copyright tag, and discard everything else. 8922 * This is the default behavior for JPEG files. 8923 * - none: Discard all invisible EXIF metadata. Currently WebP and PNG 8924 * output formats always discard metadata. 8925 */ 8926 metadata?: "keep" | "copyright" | "none"; 8927 /** 8928 * Strength of sharpening filter to apply to the image. Floating-point 8929 * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a 8930 * recommended value for downscaled images. 8931 */ 8932 sharpen?: number; 8933 /** 8934 * Radius of a blur filter (approximate gaussian). Maximum supported radius 8935 * is 250. 8936 */ 8937 blur?: number; 8938 /** 8939 * Overlays are drawn in the order they appear in the array (last array 8940 * entry is the topmost layer). 8941 */ 8942 draw?: RequestInitCfPropertiesImageDraw[]; 8943 /** 8944 * Fetching image from authenticated origin. Setting this property will 8945 * pass authentication headers (Authorization, Cookie, etc.) through to 8946 * the origin. 8947 */ 8948 "origin-auth"?: "share-publicly"; 8949 /** 8950 * Adds a border around the image. The border is added after resizing. Border 8951 * width takes dpr into account, and can be specified either using a single 8952 * width property, or individually for each side. 8953 */ 8954 border?: { 8955 color: string; 8956 width: number; 8957 } | { 8958 color: string; 8959 top: number; 8960 right: number; 8961 bottom: number; 8962 left: number; 8963 }; 8964 /** 8965 * Increase brightness by a factor. A value of 1.0 equals no change, a value 8966 * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. 8967 * 0 is ignored. 8968 */ 8969 brightness?: number; 8970 /** 8971 * Increase contrast by a factor. A value of 1.0 equals no change, a value of 8972 * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is 8973 * ignored. 8974 */ 8975 contrast?: number; 8976 /** 8977 * Increase exposure by a factor. A value of 1.0 equals no change, a value of 8978 * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. 8979 */ 8980 gamma?: number; 8981 /** 8982 * Increase contrast by a factor. A value of 1.0 equals no change, a value of 8983 * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is 8984 * ignored. 8985 */ 8986 saturation?: number; 8987 /** 8988 * Flips the images horizontally, vertically, or both. Flipping is applied before 8989 * rotation, so if you apply flip=h,rotate=90 then the image will be flipped 8990 * horizontally, then rotated by 90 degrees. 8991 */ 8992 flip?: 'h' | 'v' | 'hv'; 8993 /** 8994 * Slightly reduces latency on a cache miss by selecting a 8995 * quickest-to-compress file format, at a cost of increased file size and 8996 * lower image quality. It will usually override the format option and choose 8997 * JPEG over WebP or AVIF. We do not recommend using this option, except in 8998 * unusual circumstances like resizing uncacheable dynamically-generated 8999 * images. 9000 */ 9001 compression?: "fast"; 9002} 9003interface RequestInitCfPropertiesImageMinify { 9004 javascript?: boolean; 9005 css?: boolean; 9006 html?: boolean; 9007} 9008interface RequestInitCfPropertiesR2 { 9009 /** 9010 * Colo id of bucket that an object is stored in 9011 */ 9012 bucketColoId?: number; 9013} 9014/** 9015 * Request metadata provided by Cloudflare's edge. 9016 */ 9017type IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield; 9018interface IncomingRequestCfPropertiesBase extends Record<string, unknown> { 9019 /** 9020 * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. 9021 * 9022 * @example 395747 9023 */ 9024 asn?: number; 9025 /** 9026 * The organization which owns the ASN of the incoming request. 9027 * 9028 * @example "Google Cloud" 9029 */ 9030 asOrganization?: string; 9031 /** 9032 * The original value of the `Accept-Encoding` header if Cloudflare modified it. 9033 * 9034 * @example "gzip, deflate, br" 9035 */ 9036 clientAcceptEncoding?: string; 9037 /** 9038 * The number of milliseconds it took for the request to reach your worker. 9039 * 9040 * @example 22 9041 */ 9042 clientTcpRtt?: number; 9043 /** 9044 * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) 9045 * airport code of the data center that the request hit. 9046 * 9047 * @example "DFW" 9048 */ 9049 colo: string; 9050 /** 9051 * Represents the upstream's response to a 9052 * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) 9053 * from cloudflare. 9054 * 9055 * For workers with no upstream, this will always be `1`. 9056 * 9057 * @example 3 9058 */ 9059 edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; 9060 /** 9061 * The HTTP Protocol the request used. 9062 * 9063 * @example "HTTP/2" 9064 */ 9065 httpProtocol: string; 9066 /** 9067 * The browser-requested prioritization information in the request object. 9068 * 9069 * If no information was set, defaults to the empty string `""` 9070 * 9071 * @example "weight=192;exclusive=0;group=3;group-weight=127" 9072 * @default "" 9073 */ 9074 requestPriority: string; 9075 /** 9076 * The TLS version of the connection to Cloudflare. 9077 * In requests served over plaintext (without TLS), this property is the empty string `""`. 9078 * 9079 * @example "TLSv1.3" 9080 */ 9081 tlsVersion: string; 9082 /** 9083 * The cipher for the connection to Cloudflare. 9084 * In requests served over plaintext (without TLS), this property is the empty string `""`. 9085 * 9086 * @example "AEAD-AES128-GCM-SHA256" 9087 */ 9088 tlsCipher: string; 9089 /** 9090 * 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. 9091 * 9092 * If the incoming request was served over plaintext (without TLS) this field is undefined. 9093 */ 9094 tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; 9095} 9096interface IncomingRequestCfPropertiesBotManagementBase { 9097 /** 9098 * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot, 9099 * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human). 9100 * 9101 * @example 54 9102 */ 9103 score: number; 9104 /** 9105 * A boolean value that is true if the request comes from a good bot, like Google or Bing. 9106 * 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). 9107 */ 9108 verifiedBot: boolean; 9109 /** 9110 * A boolean value that is true if the request originates from a 9111 * Cloudflare-verified proxy service. 9112 */ 9113 corporateProxy: boolean; 9114 /** 9115 * 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. 9116 */ 9117 staticResource: boolean; 9118 /** 9119 * 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). 9120 */ 9121 detectionIds: number[]; 9122} 9123interface IncomingRequestCfPropertiesBotManagement { 9124 /** 9125 * Results of Cloudflare's Bot Management analysis 9126 */ 9127 botManagement: IncomingRequestCfPropertiesBotManagementBase; 9128 /** 9129 * Duplicate of `botManagement.score`. 9130 * 9131 * @deprecated 9132 */ 9133 clientTrustScore: number; 9134} 9135interface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement { 9136 /** 9137 * Results of Cloudflare's Bot Management analysis 9138 */ 9139 botManagement: IncomingRequestCfPropertiesBotManagementBase & { 9140 /** 9141 * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients 9142 * across different destination IPs, Ports, and X509 certificates. 9143 */ 9144 ja3Hash: string; 9145 }; 9146} 9147interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> { 9148 /** 9149 * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/). 9150 * 9151 * This field is only present if you have Cloudflare for SaaS enabled on your account 9152 * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). 9153 */ 9154 hostMetadata?: HostMetadata; 9155} 9156interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { 9157 /** 9158 * Information about the client certificate presented to Cloudflare. 9159 * 9160 * This is populated when the incoming request is served over TLS using 9161 * either Cloudflare Access or API Shield (mTLS) 9162 * and the presented SSL certificate has a valid 9163 * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number) 9164 * (i.e., not `null` or `""`). 9165 * 9166 * Otherwise, a set of placeholder values are used. 9167 * 9168 * The property `certPresented` will be set to `"1"` when 9169 * the object is populated (i.e. the above conditions were met). 9170 */ 9171 tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; 9172} 9173/** 9174 * Metadata about the request's TLS handshake 9175 */ 9176interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { 9177 /** 9178 * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal 9179 * 9180 * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" 9181 */ 9182 clientHandshake: string; 9183 /** 9184 * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal 9185 * 9186 * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" 9187 */ 9188 serverHandshake: string; 9189 /** 9190 * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal 9191 * 9192 * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" 9193 */ 9194 clientFinished: string; 9195 /** 9196 * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal 9197 * 9198 * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" 9199 */ 9200 serverFinished: string; 9201} 9202/** 9203 * Geographic data about the request's origin. 9204 */ 9205interface IncomingRequestCfPropertiesGeographicInformation { 9206 /** 9207 * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from. 9208 * 9209 * 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. 9210 * 9211 * If Cloudflare is unable to determine where the request originated this property is omitted. 9212 * 9213 * The country code `"T1"` is used for requests originating on TOR. 9214 * 9215 * @example "GB" 9216 */ 9217 country?: Iso3166Alpha2Code | "T1"; 9218 /** 9219 * If present, this property indicates that the request originated in the EU 9220 * 9221 * @example "1" 9222 */ 9223 isEUCountry?: "1"; 9224 /** 9225 * A two-letter code indicating the continent the request originated from. 9226 * 9227 * @example "AN" 9228 */ 9229 continent?: ContinentCode; 9230 /** 9231 * The city the request originated from 9232 * 9233 * @example "Austin" 9234 */ 9235 city?: string; 9236 /** 9237 * Postal code of the incoming request 9238 * 9239 * @example "78701" 9240 */ 9241 postalCode?: string; 9242 /** 9243 * Latitude of the incoming request 9244 * 9245 * @example "30.27130" 9246 */ 9247 latitude?: string; 9248 /** 9249 * Longitude of the incoming request 9250 * 9251 * @example "-97.74260" 9252 */ 9253 longitude?: string; 9254 /** 9255 * Timezone of the incoming request 9256 * 9257 * @example "America/Chicago" 9258 */ 9259 timezone?: string; 9260 /** 9261 * If known, the ISO 3166-2 name for the first level region associated with 9262 * the IP address of the incoming request 9263 * 9264 * @example "Texas" 9265 */ 9266 region?: string; 9267 /** 9268 * If known, the ISO 3166-2 code for the first-level region associated with 9269 * the IP address of the incoming request 9270 * 9271 * @example "TX" 9272 */ 9273 regionCode?: string; 9274 /** 9275 * Metro code (DMA) of the incoming request 9276 * 9277 * @example "635" 9278 */ 9279 metroCode?: string; 9280} 9281/** Data about the incoming request's TLS certificate */ 9282interface IncomingRequestCfPropertiesTLSClientAuth { 9283 /** Always `"1"`, indicating that the certificate was presented */ 9284 certPresented: "1"; 9285 /** 9286 * Result of certificate verification. 9287 * 9288 * @example "FAILED:self signed certificate" 9289 */ 9290 certVerified: Exclude<CertVerificationStatus, "NONE">; 9291 /** The presented certificate's revokation status. 9292 * 9293 * - A value of `"1"` indicates the certificate has been revoked 9294 * - A value of `"0"` indicates the certificate has not been revoked 9295 */ 9296 certRevoked: "1" | "0"; 9297 /** 9298 * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) 9299 * 9300 * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" 9301 */ 9302 certIssuerDN: string; 9303 /** 9304 * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) 9305 * 9306 * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" 9307 */ 9308 certSubjectDN: string; 9309 /** 9310 * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) 9311 * 9312 * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" 9313 */ 9314 certIssuerDNRFC2253: string; 9315 /** 9316 * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) 9317 * 9318 * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" 9319 */ 9320 certSubjectDNRFC2253: string; 9321 /** The certificate issuer's distinguished name (legacy policies) */ 9322 certIssuerDNLegacy: string; 9323 /** The certificate subject's distinguished name (legacy policies) */ 9324 certSubjectDNLegacy: string; 9325 /** 9326 * The certificate's serial number 9327 * 9328 * @example "00936EACBE07F201DF" 9329 */ 9330 certSerial: string; 9331 /** 9332 * The certificate issuer's serial number 9333 * 9334 * @example "2489002934BDFEA34" 9335 */ 9336 certIssuerSerial: string; 9337 /** 9338 * The certificate's Subject Key Identifier 9339 * 9340 * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" 9341 */ 9342 certSKI: string; 9343 /** 9344 * The certificate issuer's Subject Key Identifier 9345 * 9346 * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" 9347 */ 9348 certIssuerSKI: string; 9349 /** 9350 * The certificate's SHA-1 fingerprint 9351 * 9352 * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" 9353 */ 9354 certFingerprintSHA1: string; 9355 /** 9356 * The certificate's SHA-256 fingerprint 9357 * 9358 * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" 9359 */ 9360 certFingerprintSHA256: string; 9361 /** 9362 * The effective starting date of the certificate 9363 * 9364 * @example "Dec 22 19:39:00 2018 GMT" 9365 */ 9366 certNotBefore: string; 9367 /** 9368 * The effective expiration date of the certificate 9369 * 9370 * @example "Dec 22 19:39:00 2018 GMT" 9371 */ 9372 certNotAfter: string; 9373} 9374/** Placeholder values for TLS Client Authorization */ 9375interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { 9376 certPresented: "0"; 9377 certVerified: "NONE"; 9378 certRevoked: "0"; 9379 certIssuerDN: ""; 9380 certSubjectDN: ""; 9381 certIssuerDNRFC2253: ""; 9382 certSubjectDNRFC2253: ""; 9383 certIssuerDNLegacy: ""; 9384 certSubjectDNLegacy: ""; 9385 certSerial: ""; 9386 certIssuerSerial: ""; 9387 certSKI: ""; 9388 certIssuerSKI: ""; 9389 certFingerprintSHA1: ""; 9390 certFingerprintSHA256: ""; 9391 certNotBefore: ""; 9392 certNotAfter: ""; 9393} 9394/** Possible outcomes of TLS verification */ 9395declare type CertVerificationStatus = 9396/** Authentication succeeded */ 9397"SUCCESS" 9398/** No certificate was presented */ 9399 | "NONE" 9400/** Failed because the certificate was self-signed */ 9401 | "FAILED:self signed certificate" 9402/** Failed because the certificate failed a trust chain check */ 9403 | "FAILED:unable to verify the first certificate" 9404/** Failed because the certificate not yet valid */ 9405 | "FAILED:certificate is not yet valid" 9406/** Failed because the certificate is expired */ 9407 | "FAILED:certificate has expired" 9408/** Failed for another unspecified reason */ 9409 | "FAILED"; 9410/** 9411 * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. 9412 */ 9413declare 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 */ 9414/** ISO 3166-1 Alpha-2 codes */ 9415declare 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"; 9416/** The 2-letter continent codes Cloudflare uses */ 9417declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; 9418type CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties; 9419interface D1Meta { 9420 duration: number; 9421 size_after: number; 9422 rows_read: number; 9423 rows_written: number; 9424 last_row_id: number; 9425 changed_db: boolean; 9426 changes: number; 9427 /** 9428 * The region of the database instance that executed the query. 9429 */ 9430 served_by_region?: string; 9431 /** 9432 * True if-and-only-if the database instance that executed the query was the primary. 9433 */ 9434 served_by_primary?: boolean; 9435 timings?: { 9436 /** 9437 * The duration of the SQL query execution by the database instance. It doesn't include any network time. 9438 */ 9439 sql_duration_ms: number; 9440 }; 9441 /** 9442 * Number of total attempts to execute the query, due to automatic retries. 9443 * Note: All other fields in the response like `timings` only apply to the last attempt. 9444 */ 9445 total_attempts?: number; 9446} 9447interface D1Response { 9448 success: true; 9449 meta: D1Meta & Record<string, unknown>; 9450 error?: never; 9451} 9452type D1Result<T = unknown> = D1Response & { 9453 results: T[]; 9454}; 9455interface D1ExecResult { 9456 count: number; 9457 duration: number; 9458} 9459type D1SessionConstraint = 9460// Indicates that the first query should go to the primary, and the rest queries 9461// using the same D1DatabaseSession will go to any replica that is consistent with 9462// the bookmark maintained by the session (returned by the first query). 9463'first-primary' 9464// Indicates that the first query can go anywhere (primary or replica), and the rest queries 9465// using the same D1DatabaseSession will go to any replica that is consistent with 9466// the bookmark maintained by the session (returned by the first query). 9467 | 'first-unconstrained'; 9468type D1SessionBookmark = string; 9469declare abstract class D1Database { 9470 prepare(query: string): D1PreparedStatement; 9471 batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>; 9472 exec(query: string): Promise<D1ExecResult>; 9473 /** 9474 * Creates a new D1 Session anchored at the given constraint or the bookmark. 9475 * All queries executed using the created session will have sequential consistency, 9476 * meaning that all writes done through the session will be visible in subsequent reads. 9477 * 9478 * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session. 9479 */ 9480 withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession; 9481 /** 9482 * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases. 9483 */ 9484 dump(): Promise<ArrayBuffer>; 9485} 9486declare abstract class D1DatabaseSession { 9487 prepare(query: string): D1PreparedStatement; 9488 batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>; 9489 /** 9490 * @returns The latest session bookmark across all executed queries on the session. 9491 * If no query has been executed yet, `null` is returned. 9492 */ 9493 getBookmark(): D1SessionBookmark | null; 9494} 9495declare abstract class D1PreparedStatement { 9496 bind(...values: unknown[]): D1PreparedStatement; 9497 first<T = unknown>(colName: string): Promise<T | null>; 9498 first<T = Record<string, unknown>>(): Promise<T | null>; 9499 run<T = Record<string, unknown>>(): Promise<D1Result<T>>; 9500 all<T = Record<string, unknown>>(): Promise<D1Result<T>>; 9501 raw<T = unknown[]>(options: { 9502 columnNames: true; 9503 }): Promise<[ 9504 string[], 9505 ...T[] 9506 ]>; 9507 raw<T = unknown[]>(options?: { 9508 columnNames?: false; 9509 }): Promise<T[]>; 9510} 9511// `Disposable` was added to TypeScript's standard lib types in version 5.2. 9512// To support older TypeScript versions, define an empty `Disposable` interface. 9513// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2, 9514// but this will ensure type checking on older versions still passes. 9515// TypeScript's interface merging will ensure our empty interface is effectively 9516// ignored when `Disposable` is included in the standard lib. 9517interface Disposable { 9518} 9519/** 9520 * An email message that can be sent from a Worker. 9521 */ 9522interface EmailMessage { 9523 /** 9524 * Envelope From attribute of the email message. 9525 */ 9526 readonly from: string; 9527 /** 9528 * Envelope To attribute of the email message. 9529 */ 9530 readonly to: string; 9531} 9532/** 9533 * An email message that is sent to a consumer Worker and can be rejected/forwarded. 9534 */ 9535interface ForwardableEmailMessage extends EmailMessage { 9536 /** 9537 * Stream of the email message content. 9538 */ 9539 readonly raw: ReadableStream<Uint8Array>; 9540 /** 9541 * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). 9542 */ 9543 readonly headers: Headers; 9544 /** 9545 * Size of the email message content. 9546 */ 9547 readonly rawSize: number; 9548 /** 9549 * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. 9550 * @param reason The reject reason. 9551 * @returns void 9552 */ 9553 setReject(reason: string): void; 9554 /** 9555 * Forward this email message to a verified destination address of the account. 9556 * @param rcptTo Verified destination address. 9557 * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). 9558 * @returns A promise that resolves when the email message is forwarded. 9559 */ 9560 forward(rcptTo: string, headers?: Headers): Promise<void>; 9561 /** 9562 * Reply to the sender of this email message with a new EmailMessage object. 9563 * @param message The reply message. 9564 * @returns A promise that resolves when the email message is replied. 9565 */ 9566 reply(message: EmailMessage): Promise<void>; 9567} 9568/** 9569 * A binding that allows a Worker to send email messages. 9570 */ 9571interface SendEmail { 9572 send(message: EmailMessage): Promise<void>; 9573} 9574declare abstract class EmailEvent extends ExtendableEvent { 9575 readonly message: ForwardableEmailMessage; 9576} 9577declare type EmailExportedHandler<Env = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext) => void | Promise<void>; 9578declare module "cloudflare:email" { 9579 let _EmailMessage: { 9580 prototype: EmailMessage; 9581 new (from: string, to: string, raw: ReadableStream | string): EmailMessage; 9582 }; 9583 export { _EmailMessage as EmailMessage }; 9584} 9585/** 9586 * Hello World binding to serve as an explanatory example. DO NOT USE 9587 */ 9588interface HelloWorldBinding { 9589 /** 9590 * Retrieve the current stored value 9591 */ 9592 get(): Promise<{ 9593 value: string; 9594 ms?: number; 9595 }>; 9596 /** 9597 * Set a new stored value 9598 */ 9599 set(value: string): Promise<void>; 9600} 9601interface Hyperdrive { 9602 /** 9603 * Connect directly to Hyperdrive as if it's your database, returning a TCP socket. 9604 * 9605 * Calling this method returns an idential socket to if you call 9606 * `connect("host:port")` using the `host` and `port` fields from this object. 9607 * Pick whichever approach works better with your preferred DB client library. 9608 * 9609 * Note that this socket is not yet authenticated -- it's expected that your 9610 * code (or preferably, the client library of your choice) will authenticate 9611 * using the information in this class's readonly fields. 9612 */ 9613 connect(): Socket; 9614 /** 9615 * A valid DB connection string that can be passed straight into the typical 9616 * client library/driver/ORM. This will typically be the easiest way to use 9617 * Hyperdrive. 9618 */ 9619 readonly connectionString: string; 9620 /* 9621 * A randomly generated hostname that is only valid within the context of the 9622 * currently running Worker which, when passed into `connect()` function from 9623 * the "cloudflare:sockets" module, will connect to the Hyperdrive instance 9624 * for your database. 9625 */ 9626 readonly host: string; 9627 /* 9628 * The port that must be paired the the host field when connecting. 9629 */ 9630 readonly port: number; 9631 /* 9632 * The username to use when authenticating to your database via Hyperdrive. 9633 * Unlike the host and password, this will be the same every time 9634 */ 9635 readonly user: string; 9636 /* 9637 * The randomly generated password to use when authenticating to your 9638 * database via Hyperdrive. Like the host field, this password is only valid 9639 * within the context of the currently running Worker instance from which 9640 * it's read. 9641 */ 9642 readonly password: string; 9643 /* 9644 * The name of the database to connect to. 9645 */ 9646 readonly database: string; 9647} 9648// Copyright (c) 2024 Cloudflare, Inc. 9649// Licensed under the Apache 2.0 license found in the LICENSE file or at: 9650// https://opensource.org/licenses/Apache-2.0 9651type ImageInfoResponse = { 9652 format: 'image/svg+xml'; 9653} | { 9654 format: string; 9655 fileSize: number; 9656 width: number; 9657 height: number; 9658}; 9659type ImageTransform = { 9660 width?: number; 9661 height?: number; 9662 background?: string; 9663 blur?: number; 9664 border?: { 9665 color?: string; 9666 width?: number; 9667 } | { 9668 top?: number; 9669 bottom?: number; 9670 left?: number; 9671 right?: number; 9672 }; 9673 brightness?: number; 9674 contrast?: number; 9675 fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop'; 9676 flip?: 'h' | 'v' | 'hv'; 9677 gamma?: number; 9678 segment?: 'foreground'; 9679 gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | { 9680 x?: number; 9681 y?: number; 9682 mode: 'remainder' | 'box-center'; 9683 }; 9684 rotate?: 0 | 90 | 180 | 270; 9685 saturation?: number; 9686 sharpen?: number; 9687 trim?: 'border' | { 9688 top?: number; 9689 bottom?: number; 9690 left?: number; 9691 right?: number; 9692 width?: number; 9693 height?: number; 9694 border?: boolean | { 9695 color?: string; 9696 tolerance?: number; 9697 keep?: number; 9698 }; 9699 }; 9700}; 9701type ImageDrawOptions = { 9702 opacity?: number; 9703 repeat?: boolean | string; 9704 top?: number; 9705 left?: number; 9706 bottom?: number; 9707 right?: number; 9708}; 9709type ImageInputOptions = { 9710 encoding?: 'base64'; 9711}; 9712type ImageOutputOptions = { 9713 format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba'; 9714 quality?: number; 9715 background?: string; 9716 anim?: boolean; 9717}; 9718interface ImagesBinding { 9719 /** 9720 * Get image metadata (type, width and height) 9721 * @throws {@link ImagesError} with code 9412 if input is not an image 9722 * @param stream The image bytes 9723 */ 9724 info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>; 9725 /** 9726 * Begin applying a series of transformations to an image 9727 * @param stream The image bytes 9728 * @returns A transform handle 9729 */ 9730 input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer; 9731} 9732interface ImageTransformer { 9733 /** 9734 * Apply transform next, returning a transform handle. 9735 * You can then apply more transformations, draw, or retrieve the output. 9736 * @param transform 9737 */ 9738 transform(transform: ImageTransform): ImageTransformer; 9739 /** 9740 * Draw an image on this transformer, returning a transform handle. 9741 * You can then apply more transformations, draw, or retrieve the output. 9742 * @param image The image (or transformer that will give the image) to draw 9743 * @param options The options configuring how to draw the image 9744 */ 9745 draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer; 9746 /** 9747 * Retrieve the image that results from applying the transforms to the 9748 * provided input 9749 * @param options Options that apply to the output e.g. output format 9750 */ 9751 output(options: ImageOutputOptions): Promise<ImageTransformationResult>; 9752} 9753type ImageTransformationOutputOptions = { 9754 encoding?: 'base64'; 9755}; 9756interface ImageTransformationResult { 9757 /** 9758 * The image as a response, ready to store in cache or return to users 9759 */ 9760 response(): Response; 9761 /** 9762 * The content type of the returned image 9763 */ 9764 contentType(): string; 9765 /** 9766 * The bytes of the response 9767 */ 9768 image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>; 9769} 9770interface ImagesError extends Error { 9771 readonly code: number; 9772 readonly message: string; 9773 readonly stack?: string; 9774} 9775/** 9776 * Media binding for transforming media streams. 9777 * Provides the entry point for media transformation operations. 9778 */ 9779interface MediaBinding { 9780 /** 9781 * Creates a media transformer from an input stream. 9782 * @param media - The input media bytes 9783 * @returns A MediaTransformer instance for applying transformations 9784 */ 9785 input(media: ReadableStream<Uint8Array>): MediaTransformer; 9786} 9787/** 9788 * Media transformer for applying transformation operations to media content. 9789 * Handles sizing, fitting, and other input transformation parameters. 9790 */ 9791interface MediaTransformer { 9792 /** 9793 * Applies transformation options to the media content. 9794 * @param transform - Configuration for how the media should be transformed 9795 * @returns A generator for producing the transformed media output 9796 */ 9797 transform(transform: MediaTransformationInputOptions): MediaTransformationGenerator; 9798} 9799/** 9800 * Generator for producing media transformation results. 9801 * Configures the output format and parameters for the transformed media. 9802 */ 9803interface MediaTransformationGenerator { 9804 /** 9805 * Generates the final media output with specified options. 9806 * @param output - Configuration for the output format and parameters 9807 * @returns The final transformation result containing the transformed media 9808 */ 9809 output(output: MediaTransformationOutputOptions): MediaTransformationResult; 9810} 9811/** 9812 * Result of a media transformation operation. 9813 * Provides multiple ways to access the transformed media content. 9814 */ 9815interface MediaTransformationResult { 9816 /** 9817 * Returns the transformed media as a readable stream of bytes. 9818 * @returns A stream containing the transformed media data 9819 */ 9820 media(): ReadableStream<Uint8Array>; 9821 /** 9822 * Returns the transformed media as an HTTP response object. 9823 * @returns The transformed media as a Response, ready to store in cache or return to users 9824 */ 9825 response(): Response; 9826 /** 9827 * Returns the MIME type of the transformed media. 9828 * @returns The content type string (e.g., 'image/jpeg', 'video/mp4') 9829 */ 9830 contentType(): string; 9831} 9832/** 9833 * Configuration options for transforming media input. 9834 * Controls how the media should be resized and fitted. 9835 */ 9836type MediaTransformationInputOptions = { 9837 /** How the media should be resized to fit the specified dimensions */ 9838 fit?: 'contain' | 'cover' | 'scale-down'; 9839 /** Target width in pixels */ 9840 width?: number; 9841 /** Target height in pixels */ 9842 height?: number; 9843}; 9844/** 9845 * Configuration options for Media Transformations output. 9846 * Controls the format, timing, and type of the generated output. 9847 */ 9848type MediaTransformationOutputOptions = { 9849 /** 9850 * Output mode determining the type of media to generate 9851 */ 9852 mode?: 'video' | 'spritesheet' | 'frame' | 'audio'; 9853 /** Whether to include audio in the output */ 9854 audio?: boolean; 9855 /** 9856 * Starting timestamp for frame extraction or start time for clips. (e.g. '2s'). 9857 */ 9858 time?: string; 9859 /** 9860 * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s'). 9861 */ 9862 duration?: string; 9863 /** 9864 * Number of frames in the spritesheet. 9865 */ 9866 imageCount?: number; 9867 /** 9868 * Output format for the generated media. 9869 */ 9870 format?: 'jpg' | 'png' | 'm4a'; 9871}; 9872/** 9873 * Error object for media transformation operations. 9874 * Extends the standard Error interface with additional media-specific information. 9875 */ 9876interface MediaError extends Error { 9877 readonly code: number; 9878 readonly message: string; 9879 readonly stack?: string; 9880} 9881declare module 'cloudflare:node' { 9882 interface NodeStyleServer { 9883 listen(...args: unknown[]): this; 9884 address(): { 9885 port?: number | null | undefined; 9886 }; 9887 } 9888 export function httpServerHandler(port: number): ExportedHandler; 9889 export function httpServerHandler(options: { 9890 port: number; 9891 }): ExportedHandler; 9892 export function httpServerHandler(server: NodeStyleServer): ExportedHandler; 9893} 9894type Params<P extends string = any> = Record<P, string | string[]>; 9895type EventContext<Env, P extends string, Data> = { 9896 request: Request<unknown, IncomingRequestCfProperties<unknown>>; 9897 functionPath: string; 9898 waitUntil: (promise: Promise<any>) => void; 9899 passThroughOnException: () => void; 9900 next: (input?: Request | string, init?: RequestInit) => Promise<Response>; 9901 env: Env & { 9902 ASSETS: { 9903 fetch: typeof fetch; 9904 }; 9905 }; 9906 params: Params<P>; 9907 data: Data; 9908}; 9909type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>; 9910type EventPluginContext<Env, P extends string, Data, PluginArgs> = { 9911 request: Request<unknown, IncomingRequestCfProperties<unknown>>; 9912 functionPath: string; 9913 waitUntil: (promise: Promise<any>) => void; 9914 passThroughOnException: () => void; 9915 next: (input?: Request | string, init?: RequestInit) => Promise<Response>; 9916 env: Env & { 9917 ASSETS: { 9918 fetch: typeof fetch; 9919 }; 9920 }; 9921 params: Params<P>; 9922 data: Data; 9923 pluginArgs: PluginArgs; 9924}; 9925type 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>; 9926declare module "assets:*" { 9927 export const onRequest: PagesFunction; 9928} 9929// Copyright (c) 2022-2023 Cloudflare, Inc. 9930// Licensed under the Apache 2.0 license found in the LICENSE file or at: 9931// https://opensource.org/licenses/Apache-2.0 9932declare module "cloudflare:pipelines" { 9933 export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> { 9934 protected env: Env; 9935 protected ctx: ExecutionContext; 9936 constructor(ctx: ExecutionContext, env: Env); 9937 /** 9938 * run recieves an array of PipelineRecord which can be 9939 * transformed and returned to the pipeline 9940 * @param records Incoming records from the pipeline to be transformed 9941 * @param metadata Information about the specific pipeline calling the transformation entrypoint 9942 * @returns A promise containing the transformed PipelineRecord array 9943 */ 9944 public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>; 9945 } 9946 export type PipelineRecord = Record<string, unknown>; 9947 export type PipelineBatchMetadata = { 9948 pipelineId: string; 9949 pipelineName: string; 9950 }; 9951 export interface Pipeline<T extends PipelineRecord = PipelineRecord> { 9952 /** 9953 * The Pipeline interface represents the type of a binding to a Pipeline 9954 * 9955 * @param records The records to send to the pipeline 9956 */ 9957 send(records: T[]): Promise<void>; 9958 } 9959} 9960// PubSubMessage represents an incoming PubSub message. 9961// The message includes metadata about the broker, the client, and the payload 9962// itself. 9963// https://developers.cloudflare.com/pub-sub/ 9964interface PubSubMessage { 9965 // Message ID 9966 readonly mid: number; 9967 // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT 9968 readonly broker: string; 9969 // The MQTT topic the message was sent on. 9970 readonly topic: string; 9971 // The client ID of the client that published this message. 9972 readonly clientId: string; 9973 // The unique identifier (JWT ID) used by the client to authenticate, if token 9974 // auth was used. 9975 readonly jti?: string; 9976 // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker 9977 // received the message from the client. 9978 readonly receivedAt: number; 9979 // An (optional) string with the MIME type of the payload, if set by the 9980 // client. 9981 readonly contentType: string; 9982 // Set to 1 when the payload is a UTF-8 string 9983 // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 9984 readonly payloadFormatIndicator: number; 9985 // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. 9986 // You can use payloadFormatIndicator to inspect this before decoding. 9987 payload: string | Uint8Array; 9988} 9989// JsonWebKey extended by kid parameter 9990interface JsonWebKeyWithKid extends JsonWebKey { 9991 // Key Identifier of the JWK 9992 readonly kid: string; 9993} 9994interface RateLimitOptions { 9995 key: string; 9996} 9997interface RateLimitOutcome { 9998 success: boolean; 9999} 10000interface RateLimit { 10001 /** 10002 * Rate limit a request based on the provided options. 10003 * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/ 10004 * @returns A promise that resolves with the outcome of the rate limit. 10005 */ 10006 limit(options: RateLimitOptions): Promise<RateLimitOutcome>; 10007} 10008// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need 10009// to referenced by `Fetcher`. This is included in the "importable" version of the types which 10010// strips all `module` blocks. 10011declare namespace Rpc { 10012 // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s. 10013 // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`. 10014 // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to 10015 // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape) 10016 export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND'; 10017 export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND'; 10018 export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND'; 10019 export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND'; 10020 export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND'; 10021 export interface RpcTargetBranded { 10022 [__RPC_TARGET_BRAND]: never; 10023 } 10024 export interface WorkerEntrypointBranded { 10025 [__WORKER_ENTRYPOINT_BRAND]: never; 10026 } 10027 export interface DurableObjectBranded { 10028 [__DURABLE_OBJECT_BRAND]: never; 10029 } 10030 export interface WorkflowEntrypointBranded { 10031 [__WORKFLOW_ENTRYPOINT_BRAND]: never; 10032 } 10033 export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded; 10034 // Types that can be used through `Stub`s 10035 export type Stubable = RpcTargetBranded | ((...args: any[]) => any); 10036 // Types that can be passed over RPC 10037 // The reason for using a generic type here is to build a serializable subset of structured 10038 // cloneable composite types. This allows types defined with the "interface" keyword to pass the 10039 // serializable check as well. Otherwise, only types defined with the "type" keyword would pass. 10040 type Serializable<T> = 10041 // Structured cloneables 10042 BaseType 10043 // Structured cloneable composites 10044 | 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> | { 10045 [K in keyof T]: K extends number | string ? Serializable<T[K]> : never; 10046 } 10047 // Special types 10048 | Stub<Stubable> 10049 // Serialized as stubs, see `Stubify` 10050 | Stubable; 10051 // Base type for all RPC stubs, including common memory management methods. 10052 // `T` is used as a marker type for unwrapping `Stub`s later. 10053 interface StubBase<T extends Stubable> extends Disposable { 10054 [__RPC_STUB_BRAND]: T; 10055 dup(): this; 10056 } 10057 export type Stub<T extends Stubable> = Provider<T> & StubBase<T>; 10058 // This represents all the types that can be sent as-is over an RPC boundary 10059 type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers; 10060 // Recursively rewrite all `Stubable` types with `Stub`s 10061 // prettier-ignore 10062 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 { 10063 [key: string | number]: any; 10064 } ? { 10065 [K in keyof T]: Stubify<T[K]>; 10066 } : T; 10067 // Recursively rewrite all `Stub<T>`s with the corresponding `T`s. 10068 // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies: 10069 // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`. 10070 // prettier-ignore 10071 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 { 10072 [key: string | number]: unknown; 10073 } ? { 10074 [K in keyof T]: Unstubify<T[K]>; 10075 } : T; 10076 type UnstubifyAll<A extends any[]> = { 10077 [I in keyof A]: Unstubify<A[I]>; 10078 }; 10079 // Utility type for adding `Provider`/`Disposable`s to `object` types only. 10080 // Note `unknown & T` is equivalent to `T`. 10081 type MaybeProvider<T> = T extends object ? Provider<T> : unknown; 10082 type MaybeDisposable<T> = T extends object ? Disposable : unknown; 10083 // Type for method return or property on an RPC interface. 10084 // - Stubable types are replaced by stubs. 10085 // - Serializable types are passed by value, with stubable types replaced by stubs 10086 // and a top-level `Disposer`. 10087 // Everything else can't be passed over PRC. 10088 // Technically, we use custom thenables here, but they quack like `Promise`s. 10089 // Intersecting with `(Maybe)Provider` allows pipelining. 10090 // prettier-ignore 10091 type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never; 10092 // Type for method or property on an RPC interface. 10093 // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s. 10094 // Unwrapping `Stub`s allows calling with `Stubable` arguments. 10095 // For properties, rewrite types to be `Result`s. 10096 // In each case, unwrap `Promise`s. 10097 type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>; 10098 // Type for the callable part of an `Provider` if `T` is callable. 10099 // This is intersected with methods/properties. 10100 type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown; 10101 // Base type for all other types providing RPC-like interfaces. 10102 // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types. 10103 // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC. 10104 export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{ 10105 [K in keyof T]: MethodOrProperty<T[K]>; 10106 }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>; 10107} 10108declare namespace Cloudflare { 10109 // Type of `env`. 10110 // 10111 // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript 10112 // will merge all declarations. 10113 // 10114 // You can use `wrangler types` to generate the `Env` type automatically. 10115 interface Env { 10116 } 10117 // Project-specific parameters used to inform types. 10118 // 10119 // This interface is, again, intended to be declared in project-specific files, and then that 10120 // declaration will be merged with this one. 10121 // 10122 // A project should have a declaration like this: 10123 // 10124 // interface GlobalProps { 10125 // // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type 10126 // // of `ctx.exports`. 10127 // mainModule: typeof import("my-main-module"); 10128 // 10129 // // Declares which of the main module's exports are configured with durable storage, and 10130 // // thus should behave as Durable Object namsepace bindings. 10131 // durableNamespaces: "MyDurableObject" | "AnotherDurableObject"; 10132 // } 10133 // 10134 // You can use `wrangler types` to generate `GlobalProps` automatically. 10135 interface GlobalProps { 10136 } 10137 // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not 10138 // present. 10139 type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default; 10140 // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the 10141 // `mainModule` property. 10142 type MainModule = GlobalProp<"mainModule", {}>; 10143 // The type of ctx.exports, which contains loopback bindings for all top-level exports. 10144 type Exports = { 10145 [K in keyof MainModule]: LoopbackForExport<MainModule[K]> 10146 // If the export is listed in `durableNamespaces`, then it is also a 10147 // DurableObjectNamespace. 10148 & (K extends GlobalProp<"durableNamespaces", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {}); 10149 }; 10150} 10151declare namespace CloudflareWorkersModule { 10152 export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>; 10153 export const RpcStub: { 10154 new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>; 10155 }; 10156 export abstract class RpcTarget implements Rpc.RpcTargetBranded { 10157 [Rpc.__RPC_TARGET_BRAND]: never; 10158 } 10159 // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC 10160 export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded { 10161 [Rpc.__WORKER_ENTRYPOINT_BRAND]: never; 10162 protected ctx: ExecutionContext<Props>; 10163 protected env: Env; 10164 constructor(ctx: ExecutionContext, env: Env); 10165 email?(message: ForwardableEmailMessage): void | Promise<void>; 10166 fetch?(request: Request): Response | Promise<Response>; 10167 queue?(batch: MessageBatch<unknown>): void | Promise<void>; 10168 scheduled?(controller: ScheduledController): void | Promise<void>; 10169 tail?(events: TraceItem[]): void | Promise<void>; 10170 tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>; 10171 test?(controller: TestController): void | Promise<void>; 10172 trace?(traces: TraceItem[]): void | Promise<void>; 10173 } 10174 export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded { 10175 [Rpc.__DURABLE_OBJECT_BRAND]: never; 10176 protected ctx: DurableObjectState<Props>; 10177 protected env: Env; 10178 constructor(ctx: DurableObjectState, env: Env); 10179 alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>; 10180 fetch?(request: Request): Response | Promise<Response>; 10181 webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>; 10182 webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>; 10183 webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>; 10184 } 10185 export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; 10186 export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number; 10187 export type WorkflowDelayDuration = WorkflowSleepDuration; 10188 export type WorkflowTimeoutDuration = WorkflowSleepDuration; 10189 export type WorkflowRetentionDuration = WorkflowSleepDuration; 10190 export type WorkflowBackoff = 'constant' | 'linear' | 'exponential'; 10191 export type WorkflowStepConfig = { 10192 retries?: { 10193 limit: number; 10194 delay: WorkflowDelayDuration | number; 10195 backoff?: WorkflowBackoff; 10196 }; 10197 timeout?: WorkflowTimeoutDuration | number; 10198 }; 10199 export type WorkflowEvent<T> = { 10200 payload: Readonly<T>; 10201 timestamp: Date; 10202 instanceId: string; 10203 }; 10204 export type WorkflowStepEvent<T> = { 10205 payload: Readonly<T>; 10206 timestamp: Date; 10207 type: string; 10208 }; 10209 export abstract class WorkflowStep { 10210 do<T extends Rpc.Serializable<T>>(name: string, callback: () => Promise<T>): Promise<T>; 10211 do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: () => Promise<T>): Promise<T>; 10212 sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>; 10213 sleepUntil: (name: string, timestamp: Date | number) => Promise<void>; 10214 waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: { 10215 type: string; 10216 timeout?: WorkflowTimeoutDuration | number; 10217 }): Promise<WorkflowStepEvent<T>>; 10218 } 10219 export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded { 10220 [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never; 10221 protected ctx: ExecutionContext; 10222 protected env: Env; 10223 constructor(ctx: ExecutionContext, env: Env); 10224 run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>; 10225 } 10226 export function waitUntil(promise: Promise<unknown>): void; 10227 export function withEnv(newEnv: unknown, fn: () => unknown): unknown; 10228 export function withExports(newExports: unknown, fn: () => unknown): unknown; 10229 export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown; 10230 export const env: Cloudflare.Env; 10231 export const exports: Cloudflare.Exports; 10232} 10233declare module 'cloudflare:workers' { 10234 export = CloudflareWorkersModule; 10235} 10236interface SecretsStoreSecret { 10237 /** 10238 * Get a secret from the Secrets Store, returning a string of the secret value 10239 * if it exists, or throws an error if it does not exist 10240 */ 10241 get(): Promise<string>; 10242} 10243declare module "cloudflare:sockets" { 10244 function _connect(address: string | SocketAddress, options?: SocketOptions): Socket; 10245 export { _connect as connect }; 10246} 10247type MarkdownDocument = { 10248 name: string; 10249 blob: Blob; 10250}; 10251type ConversionResponse = { 10252 name: string; 10253 mimeType: string; 10254 format: 'markdown'; 10255 tokens: number; 10256 data: string; 10257} | { 10258 name: string; 10259 mimeType: string; 10260 format: 'error'; 10261 error: string; 10262}; 10263type ImageConversionOptions = { 10264 descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de'; 10265}; 10266type EmbeddedImageConversionOptions = ImageConversionOptions & { 10267 convert?: boolean; 10268 maxConvertedImages?: number; 10269}; 10270type ConversionOptions = { 10271 html?: { 10272 images?: EmbeddedImageConversionOptions & { 10273 convertOGImage?: boolean; 10274 }; 10275 }; 10276 docx?: { 10277 images?: EmbeddedImageConversionOptions; 10278 }; 10279 image?: ImageConversionOptions; 10280 pdf?: { 10281 images?: EmbeddedImageConversionOptions; 10282 metadata?: boolean; 10283 }; 10284}; 10285type ConversionRequestOptions = { 10286 gateway?: GatewayOptions; 10287 extraHeaders?: object; 10288 conversionOptions?: ConversionOptions; 10289}; 10290type SupportedFileFormat = { 10291 mimeType: string; 10292 extension: string; 10293}; 10294declare abstract class ToMarkdownService { 10295 transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>; 10296 transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>; 10297 supported(): Promise<SupportedFileFormat[]>; 10298} 10299declare namespace TailStream { 10300 interface Header { 10301 readonly name: string; 10302 readonly value: string; 10303 } 10304 interface FetchEventInfo { 10305 readonly type: "fetch"; 10306 readonly method: string; 10307 readonly url: string; 10308 readonly cfJson?: object; 10309 readonly headers: Header[]; 10310 } 10311 interface JsRpcEventInfo { 10312 readonly type: "jsrpc"; 10313 } 10314 interface ScheduledEventInfo { 10315 readonly type: "scheduled"; 10316 readonly scheduledTime: Date; 10317 readonly cron: string; 10318 } 10319 interface AlarmEventInfo { 10320 readonly type: "alarm"; 10321 readonly scheduledTime: Date; 10322 } 10323 interface QueueEventInfo { 10324 readonly type: "queue"; 10325 readonly queueName: string; 10326 readonly batchSize: number; 10327 } 10328 interface EmailEventInfo { 10329 readonly type: "email"; 10330 readonly mailFrom: string; 10331 readonly rcptTo: string; 10332 readonly rawSize: number; 10333 } 10334 interface TraceEventInfo { 10335 readonly type: "trace"; 10336 readonly traces: (string | null)[]; 10337 } 10338 interface HibernatableWebSocketEventInfoMessage { 10339 readonly type: "message"; 10340 } 10341 interface HibernatableWebSocketEventInfoError { 10342 readonly type: "error"; 10343 } 10344 interface HibernatableWebSocketEventInfoClose { 10345 readonly type: "close"; 10346 readonly code: number; 10347 readonly wasClean: boolean; 10348 } 10349 interface HibernatableWebSocketEventInfo { 10350 readonly type: "hibernatableWebSocket"; 10351 readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage; 10352 } 10353 interface CustomEventInfo { 10354 readonly type: "custom"; 10355 } 10356 interface FetchResponseInfo { 10357 readonly type: "fetch"; 10358 readonly statusCode: number; 10359 } 10360 type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound"; 10361 interface ScriptVersion { 10362 readonly id: string; 10363 readonly tag?: string; 10364 readonly message?: string; 10365 } 10366 interface Onset { 10367 readonly type: "onset"; 10368 readonly attributes: Attribute[]; 10369 // id for the span being opened by this Onset event. 10370 readonly spanId: string; 10371 readonly dispatchNamespace?: string; 10372 readonly entrypoint?: string; 10373 readonly executionModel: string; 10374 readonly scriptName?: string; 10375 readonly scriptTags?: string[]; 10376 readonly scriptVersion?: ScriptVersion; 10377 readonly info: FetchEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo; 10378 } 10379 interface Outcome { 10380 readonly type: "outcome"; 10381 readonly outcome: EventOutcome; 10382 readonly cpuTime: number; 10383 readonly wallTime: number; 10384 } 10385 interface SpanOpen { 10386 readonly type: "spanOpen"; 10387 readonly name: string; 10388 // id for the span being opened by this SpanOpen event. 10389 readonly spanId: string; 10390 readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes; 10391 } 10392 interface SpanClose { 10393 readonly type: "spanClose"; 10394 readonly outcome: EventOutcome; 10395 } 10396 interface DiagnosticChannelEvent { 10397 readonly type: "diagnosticChannel"; 10398 readonly channel: string; 10399 readonly message: any; 10400 } 10401 interface Exception { 10402 readonly type: "exception"; 10403 readonly name: string; 10404 readonly message: string; 10405 readonly stack?: string; 10406 } 10407 interface Log { 10408 readonly type: "log"; 10409 readonly level: "debug" | "error" | "info" | "log" | "warn"; 10410 readonly message: object; 10411 } 10412 // This marks the worker handler return information. 10413 // This is separate from Outcome because the worker invocation can live for a long time after 10414 // returning. For example - Websockets that return an http upgrade response but then continue 10415 // streaming information or SSE http connections. 10416 interface Return { 10417 readonly type: "return"; 10418 readonly info?: FetchResponseInfo; 10419 } 10420 interface Attribute { 10421 readonly name: string; 10422 readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[]; 10423 } 10424 interface Attributes { 10425 readonly type: "attributes"; 10426 readonly info: Attribute[]; 10427 } 10428 type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | Return | Attributes; 10429 // Context in which this trace event lives. 10430 interface SpanContext { 10431 // Single id for the entire top-level invocation 10432 // This should be a new traceId for the first worker stage invoked in the eyeball request and then 10433 // same-account service-bindings should reuse the same traceId but cross-account service-bindings 10434 // should use a new traceId. 10435 readonly traceId: string; 10436 // spanId in which this event is handled 10437 // for Onset and SpanOpen events this would be the parent span id 10438 // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events 10439 // For Hibernate and Mark this would be the span under which they were emitted. 10440 // spanId is not set ONLY if: 10441 // 1. This is an Onset event 10442 // 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation) 10443 readonly spanId?: string; 10444 } 10445 interface TailEvent<Event extends EventType> { 10446 // invocation id of the currently invoked worker stage. 10447 // invocation id will always be unique to every Onset event and will be the same until the Outcome event. 10448 readonly invocationId: string; 10449 // Inherited spanContext for this event. 10450 readonly spanContext: SpanContext; 10451 readonly timestamp: Date; 10452 readonly sequence: number; 10453 readonly event: Event; 10454 } 10455 type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>; 10456 type TailEventHandlerObject = { 10457 outcome?: TailEventHandler<Outcome>; 10458 spanOpen?: TailEventHandler<SpanOpen>; 10459 spanClose?: TailEventHandler<SpanClose>; 10460 diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>; 10461 exception?: TailEventHandler<Exception>; 10462 log?: TailEventHandler<Log>; 10463 return?: TailEventHandler<Return>; 10464 attributes?: TailEventHandler<Attributes>; 10465 }; 10466 type TailEventHandlerType = TailEventHandler | TailEventHandlerObject; 10467} 10468// Copyright (c) 2022-2023 Cloudflare, Inc. 10469// Licensed under the Apache 2.0 license found in the LICENSE file or at: 10470// https://opensource.org/licenses/Apache-2.0 10471/** 10472 * Data types supported for holding vector metadata. 10473 */ 10474type VectorizeVectorMetadataValue = string | number | boolean | string[]; 10475/** 10476 * Additional information to associate with a vector. 10477 */ 10478type VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>; 10479type VectorFloatArray = Float32Array | Float64Array; 10480interface VectorizeError { 10481 code?: number; 10482 error: string; 10483} 10484/** 10485 * Comparison logic/operation to use for metadata filtering. 10486 * 10487 * This list is expected to grow as support for more operations are released. 10488 */ 10489type VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte'; 10490type VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin'; 10491/** 10492 * Filter criteria for vector metadata used to limit the retrieved query result set. 10493 */ 10494type VectorizeVectorMetadataFilter = { 10495 [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | { 10496 [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null; 10497 } | { 10498 [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[]; 10499 }; 10500}; 10501/** 10502 * Supported distance metrics for an index. 10503 * Distance metrics determine how other "similar" vectors are determined. 10504 */ 10505type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product"; 10506/** 10507 * Metadata return levels for a Vectorize query. 10508 * 10509 * Default to "none". 10510 * 10511 * @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. 10512 * @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). 10513 * @property none No indexed metadata will be returned. 10514 */ 10515type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none"; 10516interface VectorizeQueryOptions { 10517 topK?: number; 10518 namespace?: string; 10519 returnValues?: boolean; 10520 returnMetadata?: boolean | VectorizeMetadataRetrievalLevel; 10521 filter?: VectorizeVectorMetadataFilter; 10522} 10523/** 10524 * Information about the configuration of an index. 10525 */ 10526type VectorizeIndexConfig = { 10527 dimensions: number; 10528 metric: VectorizeDistanceMetric; 10529} | { 10530 preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity 10531}; 10532/** 10533 * Metadata about an existing index. 10534 * 10535 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released. 10536 * See {@link VectorizeIndexInfo} for its post-beta equivalent. 10537 */ 10538interface VectorizeIndexDetails { 10539 /** The unique ID of the index */ 10540 readonly id: string; 10541 /** The name of the index. */ 10542 name: string; 10543 /** (optional) A human readable description for the index. */ 10544 description?: string; 10545 /** The index configuration, including the dimension size and distance metric. */ 10546 config: VectorizeIndexConfig; 10547 /** The number of records containing vectors within the index. */ 10548 vectorsCount: number; 10549} 10550/** 10551 * Metadata about an existing index. 10552 */ 10553interface VectorizeIndexInfo { 10554 /** The number of records containing vectors within the index. */ 10555 vectorCount: number; 10556 /** Number of dimensions the index has been configured for. */ 10557 dimensions: number; 10558 /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */ 10559 processedUpToDatetime: number; 10560 /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */ 10561 processedUpToMutation: number; 10562} 10563/** 10564 * Represents a single vector value set along with its associated metadata. 10565 */ 10566interface VectorizeVector { 10567 /** 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. */ 10568 id: string; 10569 /** The vector values */ 10570 values: VectorFloatArray | number[]; 10571 /** The namespace this vector belongs to. */ 10572 namespace?: string; 10573 /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */ 10574 metadata?: Record<string, VectorizeVectorMetadata>; 10575} 10576/** 10577 * Represents a matched vector for a query along with its score and (if specified) the matching vector information. 10578 */ 10579type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> & Omit<VectorizeVector, "values"> & { 10580 /** The score or rank for similarity, when returned as a result */ 10581 score: number; 10582}; 10583/** 10584 * A set of matching {@link VectorizeMatch} for a particular query. 10585 */ 10586interface VectorizeMatches { 10587 matches: VectorizeMatch[]; 10588 count: number; 10589} 10590/** 10591 * Results of an operation that performed a mutation on a set of vectors. 10592 * Here, `ids` is a list of vectors that were successfully processed. 10593 * 10594 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released. 10595 * See {@link VectorizeAsyncMutation} for its post-beta equivalent. 10596 */ 10597interface VectorizeVectorMutation { 10598 /* List of ids of vectors that were successfully processed. */ 10599 ids: string[]; 10600 /* Total count of the number of processed vectors. */ 10601 count: number; 10602} 10603/** 10604 * Result type indicating a mutation on the Vectorize Index. 10605 * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation. 10606 */ 10607interface VectorizeAsyncMutation { 10608 /** The unique identifier for the async mutation operation containing the changeset. */ 10609 mutationId: string; 10610} 10611/** 10612 * A Vectorize Vector Search Index for querying vectors/embeddings. 10613 * 10614 * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released. 10615 * See {@link Vectorize} for its new implementation. 10616 */ 10617declare abstract class VectorizeIndex { 10618 /** 10619 * Get information about the currently bound index. 10620 * @returns A promise that resolves with information about the current index. 10621 */ 10622 public describe(): Promise<VectorizeIndexDetails>; 10623 /** 10624 * Use the provided vector to perform a similarity search across the index. 10625 * @param vector Input vector that will be used to drive the similarity search. 10626 * @param options Configuration options to massage the returned data. 10627 * @returns A promise that resolves with matched and scored vectors. 10628 */ 10629 public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>; 10630 /** 10631 * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown. 10632 * @param vectors List of vectors that will be inserted. 10633 * @returns A promise that resolves with the ids & count of records that were successfully processed. 10634 */ 10635 public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>; 10636 /** 10637 * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values. 10638 * @param vectors List of vectors that will be upserted. 10639 * @returns A promise that resolves with the ids & count of records that were successfully processed. 10640 */ 10641 public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>; 10642 /** 10643 * Delete a list of vectors with a matching id. 10644 * @param ids List of vector ids that should be deleted. 10645 * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted). 10646 */ 10647 public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>; 10648 /** 10649 * Get a list of vectors with a matching id. 10650 * @param ids List of vector ids that should be returned. 10651 * @returns A promise that resolves with the raw unscored vectors matching the id set. 10652 */ 10653 public getByIds(ids: string[]): Promise<VectorizeVector[]>; 10654} 10655/** 10656 * A Vectorize Vector Search Index for querying vectors/embeddings. 10657 * 10658 * Mutations in this version are async, returning a mutation id. 10659 */ 10660declare abstract class Vectorize { 10661 /** 10662 * Get information about the currently bound index. 10663 * @returns A promise that resolves with information about the current index. 10664 */ 10665 public describe(): Promise<VectorizeIndexInfo>; 10666 /** 10667 * Use the provided vector to perform a similarity search across the index. 10668 * @param vector Input vector that will be used to drive the similarity search. 10669 * @param options Configuration options to massage the returned data. 10670 * @returns A promise that resolves with matched and scored vectors. 10671 */ 10672 public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>; 10673 /** 10674 * Use the provided vector-id to perform a similarity search across the index. 10675 * @param vectorId Id for a vector in the index against which the index should be queried. 10676 * @param options Configuration options to massage the returned data. 10677 * @returns A promise that resolves with matched and scored vectors. 10678 */ 10679 public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>; 10680 /** 10681 * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown. 10682 * @param vectors List of vectors that will be inserted. 10683 * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset. 10684 */ 10685 public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>; 10686 /** 10687 * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values. 10688 * @param vectors List of vectors that will be upserted. 10689 * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset. 10690 */ 10691 public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>; 10692 /** 10693 * Delete a list of vectors with a matching id. 10694 * @param ids List of vector ids that should be deleted. 10695 * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset. 10696 */ 10697 public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>; 10698 /** 10699 * Get a list of vectors with a matching id. 10700 * @param ids List of vector ids that should be returned. 10701 * @returns A promise that resolves with the raw unscored vectors matching the id set. 10702 */ 10703 public getByIds(ids: string[]): Promise<VectorizeVector[]>; 10704} 10705/** 10706 * The interface for "version_metadata" binding 10707 * providing metadata about the Worker Version using this binding. 10708 */ 10709type WorkerVersionMetadata = { 10710 /** The ID of the Worker Version using this binding */ 10711 id: string; 10712 /** The tag of the Worker Version using this binding */ 10713 tag: string; 10714 /** The timestamp of when the Worker Version was uploaded */ 10715 timestamp: string; 10716}; 10717interface DynamicDispatchLimits { 10718 /** 10719 * Limit CPU time in milliseconds. 10720 */ 10721 cpuMs?: number; 10722 /** 10723 * Limit number of subrequests. 10724 */ 10725 subRequests?: number; 10726} 10727interface DynamicDispatchOptions { 10728 /** 10729 * Limit resources of invoked Worker script. 10730 */ 10731 limits?: DynamicDispatchLimits; 10732 /** 10733 * Arguments for outbound Worker script, if configured. 10734 */ 10735 outbound?: { 10736 [key: string]: any; 10737 }; 10738} 10739interface DispatchNamespace { 10740 /** 10741 * @param name Name of the Worker script. 10742 * @param args Arguments to Worker script. 10743 * @param options Options for Dynamic Dispatch invocation. 10744 * @returns A Fetcher object that allows you to send requests to the Worker script. 10745 * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown. 10746 */ 10747 get(name: string, args?: { 10748 [key: string]: any; 10749 }, options?: DynamicDispatchOptions): Fetcher; 10750} 10751declare module 'cloudflare:workflows' { 10752 /** 10753 * NonRetryableError allows for a user to throw a fatal error 10754 * that makes a Workflow instance fail immediately without triggering a retry 10755 */ 10756 export class NonRetryableError extends Error { 10757 public constructor(message: string, name?: string); 10758 } 10759} 10760declare abstract class Workflow<PARAMS = unknown> { 10761 /** 10762 * Get a handle to an existing instance of the Workflow. 10763 * @param id Id for the instance of this Workflow 10764 * @returns A promise that resolves with a handle for the Instance 10765 */ 10766 public get(id: string): Promise<WorkflowInstance>; 10767 /** 10768 * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown. 10769 * @param options Options when creating an instance including id and params 10770 * @returns A promise that resolves with a handle for the Instance 10771 */ 10772 public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>; 10773 /** 10774 * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown. 10775 * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached. 10776 * @param batch List of Options when creating an instance including name and params 10777 * @returns A promise that resolves with a list of handles for the created instances. 10778 */ 10779 public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>; 10780} 10781type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; 10782type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number; 10783type WorkflowRetentionDuration = WorkflowSleepDuration; 10784interface WorkflowInstanceCreateOptions<PARAMS = unknown> { 10785 /** 10786 * An id for your Workflow instance. Must be unique within the Workflow. 10787 */ 10788 id?: string; 10789 /** 10790 * The event payload the Workflow instance is triggered with 10791 */ 10792 params?: PARAMS; 10793 /** 10794 * The retention policy for Workflow instance. 10795 * Defaults to the maximum retention period available for the owner's account. 10796 */ 10797 retention?: { 10798 successRetention?: WorkflowRetentionDuration; 10799 errorRetention?: WorkflowRetentionDuration; 10800 }; 10801} 10802type InstanceStatus = { 10803 status: 'queued' // means that instance is waiting to be started (see concurrency limits) 10804 | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running 10805 | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish 10806 | 'waitingForPause' // instance is finishing the current work to pause 10807 | 'unknown'; 10808 error?: { 10809 name: string; 10810 message: string; 10811 }; 10812 output?: unknown; 10813}; 10814interface WorkflowError { 10815 code?: number; 10816 message: string; 10817} 10818declare abstract class WorkflowInstance { 10819 public id: string; 10820 /** 10821 * Pause the instance. 10822 */ 10823 public pause(): Promise<void>; 10824 /** 10825 * Resume the instance. If it is already running, an error will be thrown. 10826 */ 10827 public resume(): Promise<void>; 10828 /** 10829 * Terminate the instance. If it is errored, terminated or complete, an error will be thrown. 10830 */ 10831 public terminate(): Promise<void>; 10832 /** 10833 * Restart the instance. 10834 */ 10835 public restart(): Promise<void>; 10836 /** 10837 * Returns the current status of the instance. 10838 */ 10839 public status(): Promise<InstanceStatus>; 10840 /** 10841 * Send an event to this instance. 10842 */ 10843 public sendEvent({ type, payload, }: { 10844 type: string; 10845 payload: unknown; 10846 }): Promise<void>; 10847}