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