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