From 0900e06799ba1b4c6d85a9b3af418c0a5fac7825 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Thu, 21 Aug 2025 12:02:46 -0400 Subject: [PATCH 1/9] feat: add ably event publishing for mcp worker installs --- mcp-worker/README.md | 7 + mcp-worker/package.json | 1 + mcp-worker/src/auth.ts | 4 + mcp-worker/src/telemetry.ts | 37 + mcp-worker/worker-configuration.d.ts | 8819 +++++++++++++++----------- mcp-worker/wrangler.toml | 5 +- yarn.lock | 70 +- 7 files changed, 5145 insertions(+), 3798 deletions(-) create mode 100644 mcp-worker/src/telemetry.ts diff --git a/mcp-worker/README.md b/mcp-worker/README.md index 89dc783c0..d080e3c5a 100644 --- a/mcp-worker/README.md +++ b/mcp-worker/README.md @@ -126,3 +126,10 @@ All DevCycle CLI MCP tools are available. See [complete reference](../docs/mcp.m **Self-Targeting**: `get_self_targeting_identity`, `update_self_targeting_identity`, `list_self_targeting_overrides`, `set_self_targeting_override`, `clear_feature_self_targeting_overrides` **Analytics**: `get_feature_total_evaluations`, `get_project_total_evaluations`, `get_feature_audit_log_history` + +## Events + +When a user completes OAuth on the hosted MCP Worker, the worker emits a single Ably event for first-time installs. + +- **Channel**: `${orgId}-mcp-install` +- **Event name**: `mcp-install` diff --git a/mcp-worker/package.json b/mcp-worker/package.json index d7750bc7f..241f6f8d4 100644 --- a/mcp-worker/package.json +++ b/mcp-worker/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@cloudflare/workers-oauth-provider": "^0.0.5", + "ably": "^1.2.48", "agents": "^0.0.111", "hono": "^4.8.12", "jose": "^6.0.12", diff --git a/mcp-worker/src/auth.ts b/mcp-worker/src/auth.ts index 01e2c9dbb..d297d41d5 100644 --- a/mcp-worker/src/auth.ts +++ b/mcp-worker/src/auth.ts @@ -3,6 +3,8 @@ import { Hono } from 'hono' import { getCookie, setCookie } from 'hono/cookie' import * as oauth from 'oauth4webapi' import type { UserProps } from './types' +import type { DevCycleJWTClaims } from './types' +import { publishMCPInstallEvent } from './telemetry' import { OAuthHelpers } from '@cloudflare/workers-oauth-provider' import type { AuthRequest, @@ -304,6 +306,8 @@ export async function callback( userId: claims.sub!, }) + c.executionCtx.waitUntil(publishMCPInstallEvent(c.env, claims)) + return Response.redirect(redirectTo, 302) } diff --git a/mcp-worker/src/telemetry.ts b/mcp-worker/src/telemetry.ts new file mode 100644 index 000000000..53e401dc5 --- /dev/null +++ b/mcp-worker/src/telemetry.ts @@ -0,0 +1,37 @@ +import Ably from 'ably/build/ably-webworker.min' +import type { DevCycleJWTClaims } from './types' + +export async function publishMCPInstallEvent( + env: { ABLY_API_KEY?: string }, + claims: DevCycleJWTClaims, +): Promise { + if (!env.ABLY_API_KEY) { + throw new Error('ABLY_API_KEY is required to publish MCP events') + } + if (!claims.org_id) { + throw new Error('org_id is required in claims to publish MCP events') + } + + const channel = `${claims.org_id}-mcp-install` + + try { + const ably = new Ably.Rest.Promise({ key: env.ABLY_API_KEY }) + const ablyChannel = ably.channels.get(channel) + console.log( + `Publishing "mcp-install" event to Ably channel: ${channel}`, + claims, + ) + await ablyChannel.publish('mcp-install', claims) + console.log( + `Successfully published "mcp-install" event to Ably channel: ${channel}`, + ) + } catch (error) { + console.error('Failed to publish ably "mcp-install" event', { + error: + error instanceof Error + ? { message: error.message } + : { message: String(error) }, + channel, + }) + } +} diff --git a/mcp-worker/worker-configuration.d.ts b/mcp-worker/worker-configuration.d.ts index a5937e6f6..7a970528b 100644 --- a/mcp-worker/worker-configuration.d.ts +++ b/mcp-worker/worker-configuration.d.ts @@ -1,10 +1,10 @@ /* eslint-disable */ -// Generated by Wrangler by running `wrangler types` (hash: 1d664210c769c6aac43d5af03f7d45db) +// Generated by Wrangler by running `wrangler types` (hash: 03094dcd0f8a91995e2ac7310c959ef5) // Runtime types generated with workerd@1.20250803.0 2025-06-28 nodejs_compat declare namespace Cloudflare { interface Env { OAUTH_KV: KVNamespace; - NODE_ENV: "production"; + NODE_ENV: "production" | "development"; API_BASE_URL: "https://api.devcycle.com"; AUTH0_DOMAIN: "auth.devcycle.com"; AUTH0_AUDIENCE: "https://api.devcycle.com/"; @@ -12,7 +12,9 @@ declare namespace Cloudflare { ENABLE_OUTPUT_SCHEMAS: "false"; AUTH0_CLIENT_ID: string; AUTH0_CLIENT_SECRET: string; + ABLY_API_KEY: string; MCP_OBJECT: DurableObjectNamespace; + AI: Ai; } } interface Env extends Cloudflare.Env {} @@ -20,7 +22,7 @@ type StringifyValues> = { [Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string; }; declare namespace NodeJS { - interface ProcessEnv extends StringifyValues> {} + interface ProcessEnv extends StringifyValues> {} } // Begin runtime types @@ -40,172 +42,193 @@ and limitations under the License. ***************************************************************************** */ /* eslint-disable */ // noinspection JSUnusedGlobalSymbols -declare var onmessage: never; +declare var onmessage: never /** * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) */ declare class DOMException extends Error { - constructor(message?: string, name?: string); + constructor(message?: string, name?: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */ - readonly message: string; + readonly message: string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */ - readonly name: string; + readonly name: string /** * @deprecated * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) */ - readonly code: number; - static readonly INDEX_SIZE_ERR: number; - static readonly DOMSTRING_SIZE_ERR: number; - static readonly HIERARCHY_REQUEST_ERR: number; - static readonly WRONG_DOCUMENT_ERR: number; - static readonly INVALID_CHARACTER_ERR: number; - static readonly NO_DATA_ALLOWED_ERR: number; - static readonly NO_MODIFICATION_ALLOWED_ERR: number; - static readonly NOT_FOUND_ERR: number; - static readonly NOT_SUPPORTED_ERR: number; - static readonly INUSE_ATTRIBUTE_ERR: number; - static readonly INVALID_STATE_ERR: number; - static readonly SYNTAX_ERR: number; - static readonly INVALID_MODIFICATION_ERR: number; - static readonly NAMESPACE_ERR: number; - static readonly INVALID_ACCESS_ERR: number; - static readonly VALIDATION_ERR: number; - static readonly TYPE_MISMATCH_ERR: number; - static readonly SECURITY_ERR: number; - static readonly NETWORK_ERR: number; - static readonly ABORT_ERR: number; - static readonly URL_MISMATCH_ERR: number; - static readonly QUOTA_EXCEEDED_ERR: number; - static readonly TIMEOUT_ERR: number; - static readonly INVALID_NODE_TYPE_ERR: number; - static readonly DATA_CLONE_ERR: number; - get stack(): any; - set stack(value: any); + readonly code: number + static readonly INDEX_SIZE_ERR: number + static readonly DOMSTRING_SIZE_ERR: number + static readonly HIERARCHY_REQUEST_ERR: number + static readonly WRONG_DOCUMENT_ERR: number + static readonly INVALID_CHARACTER_ERR: number + static readonly NO_DATA_ALLOWED_ERR: number + static readonly NO_MODIFICATION_ALLOWED_ERR: number + static readonly NOT_FOUND_ERR: number + static readonly NOT_SUPPORTED_ERR: number + static readonly INUSE_ATTRIBUTE_ERR: number + static readonly INVALID_STATE_ERR: number + static readonly SYNTAX_ERR: number + static readonly INVALID_MODIFICATION_ERR: number + static readonly NAMESPACE_ERR: number + static readonly INVALID_ACCESS_ERR: number + static readonly VALIDATION_ERR: number + static readonly TYPE_MISMATCH_ERR: number + static readonly SECURITY_ERR: number + static readonly NETWORK_ERR: number + static readonly ABORT_ERR: number + static readonly URL_MISMATCH_ERR: number + static readonly QUOTA_EXCEEDED_ERR: number + static readonly TIMEOUT_ERR: number + static readonly INVALID_NODE_TYPE_ERR: number + static readonly DATA_CLONE_ERR: number + get stack(): any + set stack(value: any) } type WorkerGlobalScopeEventMap = { - fetch: FetchEvent; - scheduled: ScheduledEvent; - queue: QueueEvent; - unhandledrejection: PromiseRejectionEvent; - rejectionhandled: PromiseRejectionEvent; -}; + fetch: FetchEvent + scheduled: ScheduledEvent + queue: QueueEvent + unhandledrejection: PromiseRejectionEvent + rejectionhandled: PromiseRejectionEvent +} declare abstract class WorkerGlobalScope extends EventTarget { - EventTarget: typeof EventTarget; + EventTarget: typeof EventTarget } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */ interface Console { - "assert"(condition?: boolean, ...data: any[]): void; + 'assert'(condition?: boolean, ...data: any[]): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */ - clear(): void; + clear(): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */ - count(label?: string): void; + count(label?: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */ - countReset(label?: string): void; + countReset(label?: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */ - debug(...data: any[]): void; + debug(...data: any[]): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */ - dir(item?: any, options?: any): void; + dir(item?: any, options?: any): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */ - dirxml(...data: any[]): void; + dirxml(...data: any[]): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */ - error(...data: any[]): void; + error(...data: any[]): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */ - group(...data: any[]): void; + group(...data: any[]): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */ - groupCollapsed(...data: any[]): void; + groupCollapsed(...data: any[]): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */ - groupEnd(): void; + groupEnd(): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */ - info(...data: any[]): void; + info(...data: any[]): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */ - log(...data: any[]): void; + log(...data: any[]): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */ - table(tabularData?: any, properties?: string[]): void; + table(tabularData?: any, properties?: string[]): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */ - time(label?: string): void; + time(label?: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */ - timeEnd(label?: string): void; + timeEnd(label?: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */ - timeLog(label?: string, ...data: any[]): void; - timeStamp(label?: string): void; + timeLog(label?: string, ...data: any[]): void + timeStamp(label?: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */ - trace(...data: any[]): void; + trace(...data: any[]): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */ - warn(...data: any[]): void; -} -declare const console: Console; -type BufferSource = ArrayBufferView | ArrayBuffer; -type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; + warn(...data: any[]): void +} +declare const console: Console +type BufferSource = ArrayBufferView | ArrayBuffer +type TypedArray = + | Int8Array + | Uint8Array + | Uint8ClampedArray + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | Float32Array + | Float64Array + | BigInt64Array + | BigUint64Array declare namespace WebAssembly { class CompileError extends Error { - constructor(message?: string); + constructor(message?: string) } class RuntimeError extends Error { - constructor(message?: string); + constructor(message?: string) } - type ValueType = "anyfunc" | "externref" | "f32" | "f64" | "i32" | "i64" | "v128"; + type ValueType = + | 'anyfunc' + | 'externref' + | 'f32' + | 'f64' + | 'i32' + | 'i64' + | 'v128' interface GlobalDescriptor { - value: ValueType; - mutable?: boolean; + value: ValueType + mutable?: boolean } class Global { - constructor(descriptor: GlobalDescriptor, value?: any); - value: any; - valueOf(): any; + constructor(descriptor: GlobalDescriptor, value?: any) + value: any + valueOf(): any } - type ImportValue = ExportValue | number; - type ModuleImports = Record; - type Imports = Record; - type ExportValue = Function | Global | Memory | Table; - type Exports = Record; + type ImportValue = ExportValue | number + type ModuleImports = Record + type Imports = Record + type ExportValue = Function | Global | Memory | Table + type Exports = Record class Instance { - constructor(module: Module, imports?: Imports); - readonly exports: Exports; + constructor(module: Module, imports?: Imports) + readonly exports: Exports } interface MemoryDescriptor { - initial: number; - maximum?: number; - shared?: boolean; + initial: number + maximum?: number + shared?: boolean } class Memory { - constructor(descriptor: MemoryDescriptor); - readonly buffer: ArrayBuffer; - grow(delta: number): number; + constructor(descriptor: MemoryDescriptor) + readonly buffer: ArrayBuffer + grow(delta: number): number } - type ImportExportKind = "function" | "global" | "memory" | "table"; + type ImportExportKind = 'function' | 'global' | 'memory' | 'table' interface ModuleExportDescriptor { - kind: ImportExportKind; - name: string; + kind: ImportExportKind + name: string } interface ModuleImportDescriptor { - kind: ImportExportKind; - module: string; - name: string; + kind: ImportExportKind + module: string + name: string } abstract class Module { - static customSections(module: Module, sectionName: string): ArrayBuffer[]; - static exports(module: Module): ModuleExportDescriptor[]; - static imports(module: Module): ModuleImportDescriptor[]; + static customSections( + module: Module, + sectionName: string, + ): ArrayBuffer[] + static exports(module: Module): ModuleExportDescriptor[] + static imports(module: Module): ModuleImportDescriptor[] } - type TableKind = "anyfunc" | "externref"; + type TableKind = 'anyfunc' | 'externref' interface TableDescriptor { - element: TableKind; - initial: number; - maximum?: number; + element: TableKind + initial: number + maximum?: number } class Table { - constructor(descriptor: TableDescriptor, value?: any); - readonly length: number; - get(index: number): any; - grow(delta: number, value?: any): number; - set(index: number, value?: any): void; + constructor(descriptor: TableDescriptor, value?: any) + readonly length: number + get(index: number): any + grow(delta: number, value?: any): number + set(index: number, value?: any): void } - function instantiate(module: Module, imports?: Imports): Promise; - function validate(bytes: BufferSource): boolean; + function instantiate(module: Module, imports?: Imports): Promise + function validate(bytes: BufferSource): boolean } /** * This ServiceWorker API interface represents the global execution context of a service worker. @@ -214,321 +237,481 @@ declare namespace WebAssembly { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope) */ interface ServiceWorkerGlobalScope extends WorkerGlobalScope { - DOMException: typeof DOMException; - WorkerGlobalScope: typeof WorkerGlobalScope; - btoa(data: string): string; - atob(data: string): string; - setTimeout(callback: (...args: any[]) => void, msDelay?: number): number; - setTimeout(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; - clearTimeout(timeoutId: number | null): void; - setInterval(callback: (...args: any[]) => void, msDelay?: number): number; - setInterval(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; - clearInterval(timeoutId: number | null): void; - queueMicrotask(task: Function): void; - structuredClone(value: T, options?: StructuredSerializeOptions): T; - reportError(error: any): void; - fetch(input: RequestInfo | URL, init?: RequestInit): Promise; - self: ServiceWorkerGlobalScope; - crypto: Crypto; - caches: CacheStorage; - scheduler: Scheduler; - performance: Performance; - Cloudflare: Cloudflare; - readonly origin: string; - Event: typeof Event; - ExtendableEvent: typeof ExtendableEvent; - CustomEvent: typeof CustomEvent; - PromiseRejectionEvent: typeof PromiseRejectionEvent; - FetchEvent: typeof FetchEvent; - TailEvent: typeof TailEvent; - TraceEvent: typeof TailEvent; - ScheduledEvent: typeof ScheduledEvent; - MessageEvent: typeof MessageEvent; - CloseEvent: typeof CloseEvent; - ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader; - ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader; - ReadableStream: typeof ReadableStream; - WritableStream: typeof WritableStream; - WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter; - TransformStream: typeof TransformStream; - ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy; - CountQueuingStrategy: typeof CountQueuingStrategy; - ErrorEvent: typeof ErrorEvent; - EventSource: typeof EventSource; - ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest; - ReadableStreamDefaultController: typeof ReadableStreamDefaultController; - ReadableByteStreamController: typeof ReadableByteStreamController; - WritableStreamDefaultController: typeof WritableStreamDefaultController; - TransformStreamDefaultController: typeof TransformStreamDefaultController; - CompressionStream: typeof CompressionStream; - DecompressionStream: typeof DecompressionStream; - TextEncoderStream: typeof TextEncoderStream; - TextDecoderStream: typeof TextDecoderStream; - Headers: typeof Headers; - Body: typeof Body; - Request: typeof Request; - Response: typeof Response; - WebSocket: typeof WebSocket; - WebSocketPair: typeof WebSocketPair; - WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair; - AbortController: typeof AbortController; - AbortSignal: typeof AbortSignal; - TextDecoder: typeof TextDecoder; - TextEncoder: typeof TextEncoder; - navigator: Navigator; - Navigator: typeof Navigator; - URL: typeof URL; - URLSearchParams: typeof URLSearchParams; - URLPattern: typeof URLPattern; - Blob: typeof Blob; - File: typeof File; - FormData: typeof FormData; - Crypto: typeof Crypto; - SubtleCrypto: typeof SubtleCrypto; - CryptoKey: typeof CryptoKey; - CacheStorage: typeof CacheStorage; - Cache: typeof Cache; - FixedLengthStream: typeof FixedLengthStream; - IdentityTransformStream: typeof IdentityTransformStream; - HTMLRewriter: typeof HTMLRewriter; -} -declare function addEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetAddEventListenerOptions | boolean): void; -declare function removeEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetEventListenerOptions | boolean): void; + DOMException: typeof DOMException + WorkerGlobalScope: typeof WorkerGlobalScope + btoa(data: string): string + atob(data: string): string + setTimeout(callback: (...args: any[]) => void, msDelay?: number): number + setTimeout( + callback: (...args: Args) => void, + msDelay?: number, + ...args: Args + ): number + clearTimeout(timeoutId: number | null): void + setInterval(callback: (...args: any[]) => void, msDelay?: number): number + setInterval( + callback: (...args: Args) => void, + msDelay?: number, + ...args: Args + ): number + clearInterval(timeoutId: number | null): void + queueMicrotask(task: Function): void + structuredClone(value: T, options?: StructuredSerializeOptions): T + reportError(error: any): void + fetch( + input: RequestInfo | URL, + init?: RequestInit, + ): Promise + self: ServiceWorkerGlobalScope + crypto: Crypto + caches: CacheStorage + scheduler: Scheduler + performance: Performance + Cloudflare: Cloudflare + readonly origin: string + Event: typeof Event + ExtendableEvent: typeof ExtendableEvent + CustomEvent: typeof CustomEvent + PromiseRejectionEvent: typeof PromiseRejectionEvent + FetchEvent: typeof FetchEvent + TailEvent: typeof TailEvent + TraceEvent: typeof TailEvent + ScheduledEvent: typeof ScheduledEvent + MessageEvent: typeof MessageEvent + CloseEvent: typeof CloseEvent + ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader + ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader + ReadableStream: typeof ReadableStream + WritableStream: typeof WritableStream + WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter + TransformStream: typeof TransformStream + ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy + CountQueuingStrategy: typeof CountQueuingStrategy + ErrorEvent: typeof ErrorEvent + EventSource: typeof EventSource + ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest + ReadableStreamDefaultController: typeof ReadableStreamDefaultController + ReadableByteStreamController: typeof ReadableByteStreamController + WritableStreamDefaultController: typeof WritableStreamDefaultController + TransformStreamDefaultController: typeof TransformStreamDefaultController + CompressionStream: typeof CompressionStream + DecompressionStream: typeof DecompressionStream + TextEncoderStream: typeof TextEncoderStream + TextDecoderStream: typeof TextDecoderStream + Headers: typeof Headers + Body: typeof Body + Request: typeof Request + Response: typeof Response + WebSocket: typeof WebSocket + WebSocketPair: typeof WebSocketPair + WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair + AbortController: typeof AbortController + AbortSignal: typeof AbortSignal + TextDecoder: typeof TextDecoder + TextEncoder: typeof TextEncoder + navigator: Navigator + Navigator: typeof Navigator + URL: typeof URL + URLSearchParams: typeof URLSearchParams + URLPattern: typeof URLPattern + Blob: typeof Blob + File: typeof File + FormData: typeof FormData + Crypto: typeof Crypto + SubtleCrypto: typeof SubtleCrypto + CryptoKey: typeof CryptoKey + CacheStorage: typeof CacheStorage + Cache: typeof Cache + FixedLengthStream: typeof FixedLengthStream + IdentityTransformStream: typeof IdentityTransformStream + HTMLRewriter: typeof HTMLRewriter +} +declare function addEventListener( + type: Type, + handler: EventListenerOrEventListenerObject< + WorkerGlobalScopeEventMap[Type] + >, + options?: EventTargetAddEventListenerOptions | boolean, +): void +declare function removeEventListener< + Type extends keyof WorkerGlobalScopeEventMap, +>( + type: Type, + handler: EventListenerOrEventListenerObject< + WorkerGlobalScopeEventMap[Type] + >, + options?: EventTargetEventListenerOptions | boolean, +): void /** * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) */ -declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean; +declare function dispatchEvent( + event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap], +): boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */ -declare function btoa(data: string): string; +declare function btoa(data: string): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */ -declare function atob(data: string): string; +declare function atob(data: string): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */ -declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number; +declare function setTimeout( + callback: (...args: any[]) => void, + msDelay?: number, +): number /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */ -declare function setTimeout(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; +declare function setTimeout( + callback: (...args: Args) => void, + msDelay?: number, + ...args: Args +): number /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */ -declare function clearTimeout(timeoutId: number | null): void; +declare function clearTimeout(timeoutId: number | null): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */ -declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number; +declare function setInterval( + callback: (...args: any[]) => void, + msDelay?: number, +): number /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */ -declare function setInterval(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number; +declare function setInterval( + callback: (...args: Args) => void, + msDelay?: number, + ...args: Args +): number /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */ -declare function clearInterval(timeoutId: number | null): void; +declare function clearInterval(timeoutId: number | null): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */ -declare function queueMicrotask(task: Function): void; +declare function queueMicrotask(task: Function): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */ -declare function structuredClone(value: T, options?: StructuredSerializeOptions): T; +declare function structuredClone( + value: T, + options?: StructuredSerializeOptions, +): T /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */ -declare function reportError(error: any): void; +declare function reportError(error: any): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */ -declare function fetch(input: RequestInfo | URL, init?: RequestInit): Promise; -declare const self: ServiceWorkerGlobalScope; +declare function fetch( + input: RequestInfo | URL, + init?: RequestInit, +): Promise +declare const self: ServiceWorkerGlobalScope /** -* The Web Crypto API provides a set of low-level functions for common cryptographic tasks. -* The Workers runtime implements the full surface of this API, but with some differences in -* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms) -* compared to those implemented in most browsers. -* -* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/) -*/ -declare const crypto: Crypto; + * The Web Crypto API provides a set of low-level functions for common cryptographic tasks. + * The Workers runtime implements the full surface of this API, but with some differences in + * the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms) + * compared to those implemented in most browsers. + * + * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/) + */ +declare const crypto: Crypto /** -* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. -* -* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) -*/ -declare const caches: CacheStorage; -declare const scheduler: Scheduler; + * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. + * + * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) + */ +declare const caches: CacheStorage +declare const scheduler: Scheduler /** -* The Workers runtime supports a subset of the Performance API, used to measure timing and performance, -* as well as timing of subrequests and other operations. -* -* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/) -*/ -declare const performance: Performance; -declare const Cloudflare: Cloudflare; -declare const origin: string; -declare const navigator: Navigator; -interface TestController { -} + * The Workers runtime supports a subset of the Performance API, used to measure timing and performance, + * as well as timing of subrequests and other operations. + * + * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/) + */ +declare const performance: Performance +declare const Cloudflare: Cloudflare +declare const origin: string +declare const navigator: Navigator +interface TestController {} interface ExecutionContext { - waitUntil(promise: Promise): void; - passThroughOnException(): void; - props: any; -} -type ExportedHandlerFetchHandler = (request: Request>, env: Env, ctx: ExecutionContext) => Response | Promise; -type ExportedHandlerTailHandler = (events: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise; -type ExportedHandlerTraceHandler = (traces: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise; -type ExportedHandlerTailStreamHandler = (event: TailStream.TailEvent, env: Env, ctx: ExecutionContext) => TailStream.TailEventHandlerType | Promise; -type ExportedHandlerScheduledHandler = (controller: ScheduledController, env: Env, ctx: ExecutionContext) => void | Promise; -type ExportedHandlerQueueHandler = (batch: MessageBatch, env: Env, ctx: ExecutionContext) => void | Promise; -type ExportedHandlerTestHandler = (controller: TestController, env: Env, ctx: ExecutionContext) => void | Promise; -interface ExportedHandler { - fetch?: ExportedHandlerFetchHandler; - tail?: ExportedHandlerTailHandler; - trace?: ExportedHandlerTraceHandler; - tailStream?: ExportedHandlerTailStreamHandler; - scheduled?: ExportedHandlerScheduledHandler; - test?: ExportedHandlerTestHandler; - email?: EmailExportedHandler; - queue?: ExportedHandlerQueueHandler; + waitUntil(promise: Promise): void + passThroughOnException(): void + props: any +} +type ExportedHandlerFetchHandler = ( + request: Request< + CfHostMetadata, + IncomingRequestCfProperties + >, + env: Env, + ctx: ExecutionContext, +) => Response | Promise +type ExportedHandlerTailHandler = ( + events: TraceItem[], + env: Env, + ctx: ExecutionContext, +) => void | Promise +type ExportedHandlerTraceHandler = ( + traces: TraceItem[], + env: Env, + ctx: ExecutionContext, +) => void | Promise +type ExportedHandlerTailStreamHandler = ( + event: TailStream.TailEvent, + env: Env, + ctx: ExecutionContext, +) => TailStream.TailEventHandlerType | Promise +type ExportedHandlerScheduledHandler = ( + controller: ScheduledController, + env: Env, + ctx: ExecutionContext, +) => void | Promise +type ExportedHandlerQueueHandler = ( + batch: MessageBatch, + env: Env, + ctx: ExecutionContext, +) => void | Promise +type ExportedHandlerTestHandler = ( + controller: TestController, + env: Env, + ctx: ExecutionContext, +) => void | Promise +interface ExportedHandler< + Env = unknown, + QueueHandlerMessage = unknown, + CfHostMetadata = unknown, +> { + fetch?: ExportedHandlerFetchHandler + tail?: ExportedHandlerTailHandler + trace?: ExportedHandlerTraceHandler + tailStream?: ExportedHandlerTailStreamHandler + scheduled?: ExportedHandlerScheduledHandler + test?: ExportedHandlerTestHandler + email?: EmailExportedHandler + queue?: ExportedHandlerQueueHandler } interface StructuredSerializeOptions { - transfer?: any[]; + transfer?: any[] } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent) */ declare abstract class PromiseRejectionEvent extends Event { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise) */ - readonly promise: Promise; + readonly promise: Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */ - readonly reason: any; + readonly reason: any } declare abstract class Navigator { - sendBeacon(url: string, body?: (ReadableStream | string | (ArrayBuffer | ArrayBufferView) | Blob | FormData | URLSearchParams | URLSearchParams)): boolean; - readonly userAgent: string; - readonly hardwareConcurrency: number; - readonly language: string; - readonly languages: string[]; + sendBeacon( + url: string, + body?: + | ReadableStream + | string + | (ArrayBuffer | ArrayBufferView) + | Blob + | FormData + | URLSearchParams + | URLSearchParams, + ): boolean + readonly userAgent: string + readonly hardwareConcurrency: number + readonly language: string + readonly languages: string[] } /** -* The Workers runtime supports a subset of the Performance API, used to measure timing and performance, -* as well as timing of subrequests and other operations. -* -* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/) -*/ + * The Workers runtime supports a subset of the Performance API, used to measure timing and performance, + * as well as timing of subrequests and other operations. + * + * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/) + */ interface Performance { /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */ - readonly timeOrigin: number; + readonly timeOrigin: number /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */ - now(): number; + now(): number } interface AlarmInvocationInfo { - readonly isRetry: boolean; - readonly retryCount: number; + readonly isRetry: boolean + readonly retryCount: number } interface Cloudflare { - readonly compatibilityFlags: Record; + readonly compatibilityFlags: Record } interface DurableObject { - fetch(request: Request): Response | Promise; - alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise; - webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise; - webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise; - webSocketError?(ws: WebSocket, error: unknown): void | Promise; -} -type DurableObjectStub = Fetcher & { - readonly id: DurableObjectId; - readonly name?: string; -}; + fetch(request: Request): Response | Promise + alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise + webSocketMessage?( + ws: WebSocket, + message: string | ArrayBuffer, + ): void | Promise + webSocketClose?( + ws: WebSocket, + code: number, + reason: string, + wasClean: boolean, + ): void | Promise + webSocketError?(ws: WebSocket, error: unknown): void | Promise +} +type DurableObjectStub< + T extends Rpc.DurableObjectBranded | undefined = undefined, +> = Fetcher< + T, + 'alarm' | 'webSocketMessage' | 'webSocketClose' | 'webSocketError' +> & { + readonly id: DurableObjectId + readonly name?: string +} interface DurableObjectId { - toString(): string; - equals(other: DurableObjectId): boolean; - readonly name?: string; -} -interface DurableObjectNamespace { - newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId; - idFromName(name: string): DurableObjectId; - idFromString(id: string): DurableObjectId; - get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub; - jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace; -} -type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high"; + toString(): string + equals(other: DurableObjectId): boolean + readonly name?: string +} +interface DurableObjectNamespace< + T extends Rpc.DurableObjectBranded | undefined = undefined, +> { + newUniqueId( + options?: DurableObjectNamespaceNewUniqueIdOptions, + ): DurableObjectId + idFromName(name: string): DurableObjectId + idFromString(id: string): DurableObjectId + get( + id: DurableObjectId, + options?: DurableObjectNamespaceGetDurableObjectOptions, + ): DurableObjectStub + jurisdiction( + jurisdiction: DurableObjectJurisdiction, + ): DurableObjectNamespace +} +type DurableObjectJurisdiction = 'eu' | 'fedramp' | 'fedramp-high' interface DurableObjectNamespaceNewUniqueIdOptions { - jurisdiction?: DurableObjectJurisdiction; -} -type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "oc" | "afr" | "me"; + jurisdiction?: DurableObjectJurisdiction +} +type DurableObjectLocationHint = + | 'wnam' + | 'enam' + | 'sam' + | 'weur' + | 'eeur' + | 'apac' + | 'oc' + | 'afr' + | 'me' interface DurableObjectNamespaceGetDurableObjectOptions { - locationHint?: DurableObjectLocationHint; + locationHint?: DurableObjectLocationHint } interface DurableObjectState { - waitUntil(promise: Promise): void; - readonly id: DurableObjectId; - readonly storage: DurableObjectStorage; - container?: Container; - blockConcurrencyWhile(callback: () => Promise): Promise; - acceptWebSocket(ws: WebSocket, tags?: string[]): void; - getWebSockets(tag?: string): WebSocket[]; - setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void; - getWebSocketAutoResponse(): WebSocketRequestResponsePair | null; - getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null; - setHibernatableWebSocketEventTimeout(timeoutMs?: number): void; - getHibernatableWebSocketEventTimeout(): number | null; - getTags(ws: WebSocket): string[]; - abort(reason?: string): void; + waitUntil(promise: Promise): void + readonly id: DurableObjectId + readonly storage: DurableObjectStorage + container?: Container + blockConcurrencyWhile(callback: () => Promise): Promise + acceptWebSocket(ws: WebSocket, tags?: string[]): void + getWebSockets(tag?: string): WebSocket[] + setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void + getWebSocketAutoResponse(): WebSocketRequestResponsePair | null + getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null + setHibernatableWebSocketEventTimeout(timeoutMs?: number): void + getHibernatableWebSocketEventTimeout(): number | null + getTags(ws: WebSocket): string[] + abort(reason?: string): void } interface DurableObjectTransaction { - get(key: string, options?: DurableObjectGetOptions): Promise; - get(keys: string[], options?: DurableObjectGetOptions): Promise>; - list(options?: DurableObjectListOptions): Promise>; - put(key: string, value: T, options?: DurableObjectPutOptions): Promise; - put(entries: Record, options?: DurableObjectPutOptions): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - rollback(): void; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; + get( + key: string, + options?: DurableObjectGetOptions, + ): Promise + get( + keys: string[], + options?: DurableObjectGetOptions, + ): Promise> + list( + options?: DurableObjectListOptions, + ): Promise> + put( + key: string, + value: T, + options?: DurableObjectPutOptions, + ): Promise + put( + entries: Record, + options?: DurableObjectPutOptions, + ): Promise + delete(key: string, options?: DurableObjectPutOptions): Promise + delete(keys: string[], options?: DurableObjectPutOptions): Promise + rollback(): void + getAlarm(options?: DurableObjectGetAlarmOptions): Promise + setAlarm( + scheduledTime: number | Date, + options?: DurableObjectSetAlarmOptions, + ): Promise + deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise } interface DurableObjectStorage { - get(key: string, options?: DurableObjectGetOptions): Promise; - get(keys: string[], options?: DurableObjectGetOptions): Promise>; - list(options?: DurableObjectListOptions): Promise>; - put(key: string, value: T, options?: DurableObjectPutOptions): Promise; - put(entries: Record, options?: DurableObjectPutOptions): Promise; - delete(key: string, options?: DurableObjectPutOptions): Promise; - delete(keys: string[], options?: DurableObjectPutOptions): Promise; - deleteAll(options?: DurableObjectPutOptions): Promise; - transaction(closure: (txn: DurableObjectTransaction) => Promise): Promise; - getAlarm(options?: DurableObjectGetAlarmOptions): Promise; - setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise; - deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise; - sync(): Promise; - sql: SqlStorage; - transactionSync(closure: () => T): T; - getCurrentBookmark(): Promise; - getBookmarkForTime(timestamp: number | Date): Promise; - onNextSessionRestoreBookmark(bookmark: string): Promise; + get( + key: string, + options?: DurableObjectGetOptions, + ): Promise + get( + keys: string[], + options?: DurableObjectGetOptions, + ): Promise> + list( + options?: DurableObjectListOptions, + ): Promise> + put( + key: string, + value: T, + options?: DurableObjectPutOptions, + ): Promise + put( + entries: Record, + options?: DurableObjectPutOptions, + ): Promise + delete(key: string, options?: DurableObjectPutOptions): Promise + delete(keys: string[], options?: DurableObjectPutOptions): Promise + deleteAll(options?: DurableObjectPutOptions): Promise + transaction( + closure: (txn: DurableObjectTransaction) => Promise, + ): Promise + getAlarm(options?: DurableObjectGetAlarmOptions): Promise + setAlarm( + scheduledTime: number | Date, + options?: DurableObjectSetAlarmOptions, + ): Promise + deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise + sync(): Promise + sql: SqlStorage + transactionSync(closure: () => T): T + getCurrentBookmark(): Promise + getBookmarkForTime(timestamp: number | Date): Promise + onNextSessionRestoreBookmark(bookmark: string): Promise } interface DurableObjectListOptions { - start?: string; - startAfter?: string; - end?: string; - prefix?: string; - reverse?: boolean; - limit?: number; - allowConcurrency?: boolean; - noCache?: boolean; + start?: string + startAfter?: string + end?: string + prefix?: string + reverse?: boolean + limit?: number + allowConcurrency?: boolean + noCache?: boolean } interface DurableObjectGetOptions { - allowConcurrency?: boolean; - noCache?: boolean; + allowConcurrency?: boolean + noCache?: boolean } interface DurableObjectGetAlarmOptions { - allowConcurrency?: boolean; + allowConcurrency?: boolean } interface DurableObjectPutOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; - noCache?: boolean; + allowConcurrency?: boolean + allowUnconfirmed?: boolean + noCache?: boolean } interface DurableObjectSetAlarmOptions { - allowConcurrency?: boolean; - allowUnconfirmed?: boolean; + allowConcurrency?: boolean + allowUnconfirmed?: boolean } declare class WebSocketRequestResponsePair { - constructor(request: string, response: string); - get request(): string; - get response(): string; + constructor(request: string, response: string) + get request(): string + get response(): string } interface AnalyticsEngineDataset { - writeDataPoint(event?: AnalyticsEngineDataPoint): void; + writeDataPoint(event?: AnalyticsEngineDataPoint): void } interface AnalyticsEngineDataPoint { - indexes?: ((ArrayBuffer | string) | null)[]; - doubles?: number[]; - blobs?: ((ArrayBuffer | string) | null)[]; + indexes?: ((ArrayBuffer | string) | null)[] + doubles?: number[] + blobs?: ((ArrayBuffer | string) | null)[] } /** * An event which takes place in the DOM. @@ -536,137 +719,141 @@ interface AnalyticsEngineDataPoint { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event) */ declare class Event { - constructor(type: string, init?: EventInit); + constructor(type: string, init?: EventInit) /** * Returns the type of event, e.g. "click", "hashchange", or "submit". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type) */ - get type(): string; + get type(): string /** * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase) */ - get eventPhase(): number; + get eventPhase(): number /** * Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed) */ - get composed(): boolean; + get composed(): boolean /** * Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles) */ - get bubbles(): boolean; + get bubbles(): boolean /** * Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable) */ - get cancelable(): boolean; + get cancelable(): boolean /** * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented) */ - get defaultPrevented(): boolean; + get defaultPrevented(): boolean /** * @deprecated * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue) */ - get returnValue(): boolean; + get returnValue(): boolean /** * Returns the object whose event listener's callback is currently being invoked. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget) */ - get currentTarget(): EventTarget | undefined; + get currentTarget(): EventTarget | undefined /** * Returns the object to which event is dispatched (its target). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target) */ - get target(): EventTarget | undefined; + get target(): EventTarget | undefined /** * @deprecated * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement) */ - get srcElement(): EventTarget | undefined; + get srcElement(): EventTarget | undefined /** * Returns the event's timestamp as the number of milliseconds measured relative to the time origin. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp) */ - get timeStamp(): number; + get timeStamp(): number /** * Returns true if event was dispatched by the user agent, and false otherwise. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted) */ - get isTrusted(): boolean; + get isTrusted(): boolean /** * @deprecated * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) */ - get cancelBubble(): boolean; + get cancelBubble(): boolean /** * @deprecated * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) */ - set cancelBubble(value: boolean); + set cancelBubble(value: boolean) /** * Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation) */ - stopImmediatePropagation(): void; + stopImmediatePropagation(): void /** * If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault) */ - preventDefault(): void; + preventDefault(): void /** * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation) */ - stopPropagation(): void; + stopPropagation(): void /** * Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath) */ - composedPath(): EventTarget[]; - static readonly NONE: number; - static readonly CAPTURING_PHASE: number; - static readonly AT_TARGET: number; - static readonly BUBBLING_PHASE: number; + composedPath(): EventTarget[] + static readonly NONE: number + static readonly CAPTURING_PHASE: number + static readonly AT_TARGET: number + static readonly BUBBLING_PHASE: number } interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; + bubbles?: boolean + cancelable?: boolean + composed?: boolean } -type EventListener = (event: EventType) => void; +type EventListener = (event: EventType) => void interface EventListenerObject { - handleEvent(event: EventType): void; + handleEvent(event: EventType): void } -type EventListenerOrEventListenerObject = EventListener | EventListenerObject; +type EventListenerOrEventListenerObject = + | EventListener + | EventListenerObject /** * EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget) */ -declare class EventTarget = Record> { - constructor(); +declare class EventTarget< + EventMap extends Record = Record, +> { + constructor() /** * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. * @@ -684,31 +871,39 @@ declare class EventTarget = Record(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetAddEventListenerOptions | boolean): void; + addEventListener( + type: Type, + handler: EventListenerOrEventListenerObject, + options?: EventTargetAddEventListenerOptions | boolean, + ): void /** * Removes the event listener in target's event listener list with the same type, callback, and options. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) */ - removeEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetEventListenerOptions | boolean): void; + removeEventListener( + type: Type, + handler: EventListenerOrEventListenerObject, + options?: EventTargetEventListenerOptions | boolean, + ): void /** * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) */ - dispatchEvent(event: EventMap[keyof EventMap]): boolean; + dispatchEvent(event: EventMap[keyof EventMap]): boolean } interface EventTargetEventListenerOptions { - capture?: boolean; + capture?: boolean } interface EventTargetAddEventListenerOptions { - capture?: boolean; - passive?: boolean; - once?: boolean; - signal?: AbortSignal; + capture?: boolean + passive?: boolean + once?: boolean + signal?: AbortSignal } interface EventTargetHandlerObject { - handleEvent: (event: Event) => any | undefined; + handleEvent: (event: Event) => any | undefined } /** * A controller object that allows you to abort one or more DOM requests as and when desired. @@ -716,19 +911,19 @@ interface EventTargetHandlerObject { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController) */ declare class AbortController { - constructor(); + constructor() /** * Returns the AbortSignal object associated with this object. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal) */ - get signal(): AbortSignal; + get signal(): AbortSignal /** * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort) */ - abort(reason?: any): void; + abort(reason?: any): void } /** * A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. @@ -737,31 +932,31 @@ declare class AbortController { */ declare abstract class AbortSignal extends EventTarget { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */ - static abort(reason?: any): AbortSignal; + static abort(reason?: any): AbortSignal /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */ - static timeout(delay: number): AbortSignal; + static timeout(delay: number): AbortSignal /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */ - static any(signals: AbortSignal[]): AbortSignal; + static any(signals: AbortSignal[]): AbortSignal /** * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) */ - get aborted(): boolean; + get aborted(): boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */ - get reason(): any; + get reason(): any /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ - get onabort(): any | null; + get onabort(): any | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ - set onabort(value: any | null); + set onabort(value: any | null) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */ - throwIfAborted(): void; + throwIfAborted(): void } interface Scheduler { - wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; + wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise } interface SchedulerWaitOptions { - signal?: AbortSignal; + signal?: AbortSignal } /** * Extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries. @@ -770,23 +965,23 @@ interface SchedulerWaitOptions { */ declare abstract class ExtendableEvent extends Event { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */ - waitUntil(promise: Promise): void; + waitUntil(promise: Promise): void } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) */ declare class CustomEvent extends Event { - constructor(type: string, init?: CustomEventCustomEventInit); + constructor(type: string, init?: CustomEventCustomEventInit) /** * Returns any custom data event was created with. Typically used for synthetic events. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail) */ - get detail(): T; + get detail(): T } interface CustomEventCustomEventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; - detail?: any; + bubbles?: boolean + cancelable?: boolean + composed?: boolean + detail?: any } /** * A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. @@ -794,24 +989,27 @@ interface CustomEventCustomEventInit { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob) */ declare class Blob { - constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions); + constructor( + type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], + options?: BlobOptions, + ) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */ - get size(): number; + get size(): number /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */ - get type(): string; + get type(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */ - slice(start?: number, end?: number, type?: string): Blob; + slice(start?: number, end?: number, type?: string): Blob /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */ - arrayBuffer(): Promise; + arrayBuffer(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes) */ - bytes(): Promise; + bytes(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */ - text(): Promise; + text(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */ - stream(): ReadableStream; + stream(): ReadableStream } interface BlobOptions { - type?: string; + type?: string } /** * Provides information about files and allows JavaScript in a web page to access their content. @@ -819,66 +1017,86 @@ interface BlobOptions { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File) */ declare class File extends Blob { - constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions); + constructor( + bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, + name: string, + options?: FileOptions, + ) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */ - get name(): string; + get name(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */ - get lastModified(): number; + get lastModified(): number } interface FileOptions { - type?: string; - lastModified?: number; + type?: string + lastModified?: number } /** -* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. -* -* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) -*/ + * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. + * + * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) + */ declare abstract class CacheStorage { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */ - open(cacheName: string): Promise; - readonly default: Cache; + open(cacheName: string): Promise + readonly default: Cache } /** -* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. -* -* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) -*/ + * The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache. + * + * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) + */ declare abstract class Cache { /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */ - delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise; + delete( + request: RequestInfo | URL, + options?: CacheQueryOptions, + ): Promise /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */ - match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise; + match( + request: RequestInfo | URL, + options?: CacheQueryOptions, + ): Promise /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */ - put(request: RequestInfo | URL, response: Response): Promise; + put(request: RequestInfo | URL, response: Response): Promise } interface CacheQueryOptions { - ignoreMethod?: boolean; + ignoreMethod?: boolean } /** -* The Web Crypto API provides a set of low-level functions for common cryptographic tasks. -* The Workers runtime implements the full surface of this API, but with some differences in -* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms) -* compared to those implemented in most browsers. -* -* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/) -*/ + * The Web Crypto API provides a set of low-level functions for common cryptographic tasks. + * The Workers runtime implements the full surface of this API, but with some differences in + * the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms) + * compared to those implemented in most browsers. + * + * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/) + */ declare abstract class Crypto { /** * Available only in secure contexts. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle) */ - get subtle(): SubtleCrypto; + get subtle(): SubtleCrypto /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */ - getRandomValues(buffer: T): T; + getRandomValues< + T extends + | Int8Array + | Uint8Array + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | BigInt64Array + | BigUint64Array, + >(buffer: T): T /** * Available only in secure contexts. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID) */ - randomUUID(): string; - DigestStream: typeof DigestStream; + randomUUID(): string + DigestStream: typeof DigestStream } /** * This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). @@ -888,30 +1106,86 @@ declare abstract class Crypto { */ declare abstract class SubtleCrypto { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt) */ - encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise; + encrypt( + algorithm: string | SubtleCryptoEncryptAlgorithm, + key: CryptoKey, + plainText: ArrayBuffer | ArrayBufferView, + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) */ - decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise; + decrypt( + algorithm: string | SubtleCryptoEncryptAlgorithm, + key: CryptoKey, + cipherText: ArrayBuffer | ArrayBufferView, + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign) */ - sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise; + sign( + algorithm: string | SubtleCryptoSignAlgorithm, + key: CryptoKey, + data: ArrayBuffer | ArrayBufferView, + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify) */ - verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise; + verify( + algorithm: string | SubtleCryptoSignAlgorithm, + key: CryptoKey, + signature: ArrayBuffer | ArrayBufferView, + data: ArrayBuffer | ArrayBufferView, + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) */ - digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise; + digest( + algorithm: string | SubtleCryptoHashAlgorithm, + data: ArrayBuffer | ArrayBufferView, + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */ - generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise; + generateKey( + algorithm: string | SubtleCryptoGenerateKeyAlgorithm, + extractable: boolean, + keyUsages: string[], + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */ - deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise; + deriveKey( + algorithm: string | SubtleCryptoDeriveKeyAlgorithm, + baseKey: CryptoKey, + derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, + extractable: boolean, + keyUsages: string[], + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) */ - deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise; + deriveBits( + algorithm: string | SubtleCryptoDeriveKeyAlgorithm, + baseKey: CryptoKey, + length?: number | null, + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */ - importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise; + importKey( + format: string, + keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, + algorithm: string | SubtleCryptoImportKeyAlgorithm, + extractable: boolean, + keyUsages: string[], + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) */ - exportKey(format: string, key: CryptoKey): Promise; + exportKey(format: string, key: CryptoKey): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) */ - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise; + wrapKey( + format: string, + key: CryptoKey, + wrappingKey: CryptoKey, + wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */ - unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise; - timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean; + unwrapKey( + format: string, + wrappedKey: ArrayBuffer | ArrayBufferView, + unwrappingKey: CryptoKey, + unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, + unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, + extractable: boolean, + keyUsages: string[], + ): Promise + timingSafeEqual( + a: ArrayBuffer | ArrayBufferView, + b: ArrayBuffer | ArrayBufferView, + ): boolean } /** * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. @@ -921,116 +1195,124 @@ declare abstract class SubtleCrypto { */ declare abstract class CryptoKey { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */ - readonly type: string; + readonly type: string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */ - readonly extractable: boolean; + readonly extractable: boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */ - readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm; + readonly algorithm: + | CryptoKeyKeyAlgorithm + | CryptoKeyAesKeyAlgorithm + | CryptoKeyHmacKeyAlgorithm + | CryptoKeyRsaKeyAlgorithm + | CryptoKeyEllipticKeyAlgorithm + | CryptoKeyArbitraryKeyAlgorithm /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */ - readonly usages: string[]; + readonly usages: string[] } interface CryptoKeyPair { - publicKey: CryptoKey; - privateKey: CryptoKey; + publicKey: CryptoKey + privateKey: CryptoKey } interface JsonWebKey { - kty: string; - use?: string; - key_ops?: string[]; - alg?: string; - ext?: boolean; - crv?: string; - x?: string; - y?: string; - d?: string; - n?: string; - e?: string; - p?: string; - q?: string; - dp?: string; - dq?: string; - qi?: string; - oth?: RsaOtherPrimesInfo[]; - k?: string; + kty: string + use?: string + key_ops?: string[] + alg?: string + ext?: boolean + crv?: string + x?: string + y?: string + d?: string + n?: string + e?: string + p?: string + q?: string + dp?: string + dq?: string + qi?: string + oth?: RsaOtherPrimesInfo[] + k?: string } interface RsaOtherPrimesInfo { - r?: string; - d?: string; - t?: string; + r?: string + d?: string + t?: string } interface SubtleCryptoDeriveKeyAlgorithm { - name: string; - salt?: (ArrayBuffer | ArrayBufferView); - iterations?: number; - hash?: (string | SubtleCryptoHashAlgorithm); - $public?: CryptoKey; - info?: (ArrayBuffer | ArrayBufferView); + name: string + salt?: ArrayBuffer | ArrayBufferView + iterations?: number + hash?: string | SubtleCryptoHashAlgorithm + $public?: CryptoKey + info?: ArrayBuffer | ArrayBufferView } interface SubtleCryptoEncryptAlgorithm { - name: string; - iv?: (ArrayBuffer | ArrayBufferView); - additionalData?: (ArrayBuffer | ArrayBufferView); - tagLength?: number; - counter?: (ArrayBuffer | ArrayBufferView); - length?: number; - label?: (ArrayBuffer | ArrayBufferView); + name: string + iv?: ArrayBuffer | ArrayBufferView + additionalData?: ArrayBuffer | ArrayBufferView + tagLength?: number + counter?: ArrayBuffer | ArrayBufferView + length?: number + label?: ArrayBuffer | ArrayBufferView } interface SubtleCryptoGenerateKeyAlgorithm { - name: string; - hash?: (string | SubtleCryptoHashAlgorithm); - modulusLength?: number; - publicExponent?: (ArrayBuffer | ArrayBufferView); - length?: number; - namedCurve?: string; + name: string + hash?: string | SubtleCryptoHashAlgorithm + modulusLength?: number + publicExponent?: ArrayBuffer | ArrayBufferView + length?: number + namedCurve?: string } interface SubtleCryptoHashAlgorithm { - name: string; + name: string } interface SubtleCryptoImportKeyAlgorithm { - name: string; - hash?: (string | SubtleCryptoHashAlgorithm); - length?: number; - namedCurve?: string; - compressed?: boolean; + name: string + hash?: string | SubtleCryptoHashAlgorithm + length?: number + namedCurve?: string + compressed?: boolean } interface SubtleCryptoSignAlgorithm { - name: string; - hash?: (string | SubtleCryptoHashAlgorithm); - dataLength?: number; - saltLength?: number; + name: string + hash?: string | SubtleCryptoHashAlgorithm + dataLength?: number + saltLength?: number } interface CryptoKeyKeyAlgorithm { - name: string; + name: string } interface CryptoKeyAesKeyAlgorithm { - name: string; - length: number; + name: string + length: number } interface CryptoKeyHmacKeyAlgorithm { - name: string; - hash: CryptoKeyKeyAlgorithm; - length: number; + name: string + hash: CryptoKeyKeyAlgorithm + length: number } interface CryptoKeyRsaKeyAlgorithm { - name: string; - modulusLength: number; - publicExponent: ArrayBuffer | ArrayBufferView; - hash?: CryptoKeyKeyAlgorithm; + name: string + modulusLength: number + publicExponent: ArrayBuffer | ArrayBufferView + hash?: CryptoKeyKeyAlgorithm } interface CryptoKeyEllipticKeyAlgorithm { - name: string; - namedCurve: string; + name: string + namedCurve: string } interface CryptoKeyArbitraryKeyAlgorithm { - name: string; - hash?: CryptoKeyKeyAlgorithm; - namedCurve?: string; - length?: number; -} -declare class DigestStream extends WritableStream { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); - readonly digest: Promise; - get bytesWritten(): number | bigint; + name: string + hash?: CryptoKeyKeyAlgorithm + namedCurve?: string + length?: number +} +declare class DigestStream extends WritableStream< + ArrayBuffer | ArrayBufferView +> { + constructor(algorithm: string | SubtleCryptoHashAlgorithm) + readonly digest: Promise + get bytesWritten(): number | bigint } /** * A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. @@ -1038,7 +1320,7 @@ declare class DigestStream extends WritableStream * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder) */ declare class TextDecoder { - constructor(label?: string, options?: TextDecoderConstructorOptions); + constructor(label?: string, options?: TextDecoderConstructorOptions) /** * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments. * @@ -1054,10 +1336,13 @@ declare class TextDecoder { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode) */ - decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string; - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; + decode( + input?: ArrayBuffer | ArrayBufferView, + options?: TextDecoderDecodeOptions, + ): string + get encoding(): string + get fatal(): boolean + get ignoreBOM(): boolean } /** * TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. @@ -1065,31 +1350,34 @@ declare class TextDecoder { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder) */ declare class TextEncoder { - constructor(); + constructor() /** * Returns the result of running UTF-8's encoder. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode) */ - encode(input?: string): Uint8Array; + encode(input?: string): Uint8Array /** * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto) */ - encodeInto(input: string, buffer: ArrayBuffer | ArrayBufferView): TextEncoderEncodeIntoResult; - get encoding(): string; + encodeInto( + input: string, + buffer: ArrayBuffer | ArrayBufferView, + ): TextEncoderEncodeIntoResult + get encoding(): string } interface TextDecoderConstructorOptions { - fatal: boolean; - ignoreBOM: boolean; + fatal: boolean + ignoreBOM: boolean } interface TextDecoderDecodeOptions { - stream: boolean; + stream: boolean } interface TextEncoderEncodeIntoResult { - read: number; - written: number; + read: number + written: number } /** * Events providing information related to errors in scripts or in files. @@ -1097,24 +1385,24 @@ interface TextEncoderEncodeIntoResult { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent) */ declare class ErrorEvent extends Event { - constructor(type: string, init?: ErrorEventErrorEventInit); + constructor(type: string, init?: ErrorEventErrorEventInit) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */ - get filename(): string; + get filename(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */ - get message(): string; + get message(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */ - get lineno(): number; + get lineno(): number /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */ - get colno(): number; + get colno(): number /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */ - get error(): any; + get error(): any } interface ErrorEventErrorEventInit { - message?: string; - filename?: string; - lineno?: number; - colno?: number; - error?: any; + message?: string + filename?: string + lineno?: number + colno?: number + error?: any } /** * A message received by a target object. @@ -1122,40 +1410,40 @@ interface ErrorEventErrorEventInit { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent) */ declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); + constructor(type: string, initializer: MessageEventInit) /** * Returns the data of the message. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data) */ - readonly data: any; + readonly data: any /** * Returns the origin of the message, for server-sent events and cross-document messaging. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin) */ - readonly origin: string | null; + readonly origin: string | null /** * Returns the last event ID string, for server-sent events. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId) */ - readonly lastEventId: string; + readonly lastEventId: string /** * Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source) */ - readonly source: MessagePort | null; + readonly source: MessagePort | null /** * Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports) */ - readonly ports: MessagePort[]; + readonly ports: MessagePort[] } interface MessageEventInit { - data: ArrayBuffer | string; + data: ArrayBuffer | string } /** * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". @@ -1163,107 +1451,145 @@ interface MessageEventInit { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData) */ declare class FormData { - constructor(); + constructor() /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */ - append(name: string, value: string): void; + append(name: string, value: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */ - append(name: string, value: Blob, filename?: string): void; + append(name: string, value: Blob, filename?: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) */ - delete(name: string): void; + delete(name: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) */ - get(name: string): (File | string) | null; + get(name: string): (File | string) | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) */ - getAll(name: string): (File | string)[]; + getAll(name: string): (File | string)[] /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) */ - has(name: string): boolean; + has(name: string): boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */ - set(name: string, value: string): void; + set(name: string, value: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */ - set(name: string, value: Blob, filename?: string): void; + set(name: string, value: Blob, filename?: string): void /* Returns an array of key, value pairs for every entry in the list. */ - entries(): IterableIterator<[ - key: string, - value: File | string - ]>; + entries(): IterableIterator<[key: string, value: File | string]> /* Returns a list of keys in the list. */ - keys(): IterableIterator; + keys(): IterableIterator /* Returns a list of values in the list. */ - values(): IterableIterator<(File | string)>; - forEach(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void; - [Symbol.iterator](): IterableIterator<[ - key: string, - value: File | string - ]>; + values(): IterableIterator + forEach( + callback: ( + this: This, + value: File | string, + key: string, + parent: FormData, + ) => void, + thisArg?: This, + ): void + [Symbol.iterator](): IterableIterator<[key: string, value: File | string]> } interface ContentOptions { - html?: boolean; + html?: boolean } declare class HTMLRewriter { - constructor(); - on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter; - onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter; - transform(response: Response): Response; + constructor() + on( + selector: string, + handlers: HTMLRewriterElementContentHandlers, + ): HTMLRewriter + onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter + transform(response: Response): Response } interface HTMLRewriterElementContentHandlers { - element?(element: Element): void | Promise; - comments?(comment: Comment): void | Promise; - text?(element: Text): void | Promise; + element?(element: Element): void | Promise + comments?(comment: Comment): void | Promise + text?(element: Text): void | Promise } interface HTMLRewriterDocumentContentHandlers { - doctype?(doctype: Doctype): void | Promise; - comments?(comment: Comment): void | Promise; - text?(text: Text): void | Promise; - end?(end: DocumentEnd): void | Promise; + doctype?(doctype: Doctype): void | Promise + comments?(comment: Comment): void | Promise + text?(text: Text): void | Promise + end?(end: DocumentEnd): void | Promise } interface Doctype { - readonly name: string | null; - readonly publicId: string | null; - readonly systemId: string | null; + readonly name: string | null + readonly publicId: string | null + readonly systemId: string | null } interface Element { - tagName: string; - readonly attributes: IterableIterator; - readonly removed: boolean; - readonly namespaceURI: string; - getAttribute(name: string): string | null; - hasAttribute(name: string): boolean; - setAttribute(name: string, value: string): Element; - removeAttribute(name: string): Element; - before(content: string | ReadableStream | Response, options?: ContentOptions): Element; - after(content: string | ReadableStream | Response, options?: ContentOptions): Element; - prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element; - append(content: string | ReadableStream | Response, options?: ContentOptions): Element; - replace(content: string | ReadableStream | Response, options?: ContentOptions): Element; - remove(): Element; - removeAndKeepContent(): Element; - setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element; - onEndTag(handler: (tag: EndTag) => void | Promise): void; + tagName: string + readonly attributes: IterableIterator + readonly removed: boolean + readonly namespaceURI: string + getAttribute(name: string): string | null + hasAttribute(name: string): boolean + setAttribute(name: string, value: string): Element + removeAttribute(name: string): Element + before( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): Element + after( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): Element + prepend( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): Element + append( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): Element + replace( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): Element + remove(): Element + removeAndKeepContent(): Element + setInnerContent( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): Element + onEndTag(handler: (tag: EndTag) => void | Promise): void } interface EndTag { - name: string; - before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag; - after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag; - remove(): EndTag; + name: string + before( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): EndTag + after( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): EndTag + remove(): EndTag } interface Comment { - text: string; - readonly removed: boolean; - before(content: string, options?: ContentOptions): Comment; - after(content: string, options?: ContentOptions): Comment; - replace(content: string, options?: ContentOptions): Comment; - remove(): Comment; + text: string + readonly removed: boolean + before(content: string, options?: ContentOptions): Comment + after(content: string, options?: ContentOptions): Comment + replace(content: string, options?: ContentOptions): Comment + remove(): Comment } interface Text { - readonly text: string; - readonly lastInTextNode: boolean; - readonly removed: boolean; - before(content: string | ReadableStream | Response, options?: ContentOptions): Text; - after(content: string | ReadableStream | Response, options?: ContentOptions): Text; - replace(content: string | ReadableStream | Response, options?: ContentOptions): Text; - remove(): Text; + readonly text: string + readonly lastInTextNode: boolean + readonly removed: boolean + before( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): Text + after( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): Text + replace( + content: string | ReadableStream | Response, + options?: ContentOptions, + ): Text + remove(): Text } interface DocumentEnd { - append(content: string, options?: ContentOptions): DocumentEnd; + append(content: string, options?: ContentOptions): DocumentEnd } /** * This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch. @@ -1272,65 +1598,74 @@ interface DocumentEnd { */ declare abstract class FetchEvent extends ExtendableEvent { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */ - readonly request: Request; + readonly request: Request /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */ - respondWith(promise: Response | Promise): void; - passThroughOnException(): void; + respondWith(promise: Response | Promise): void + passThroughOnException(): void } -type HeadersInit = Headers | Iterable> | Record; +type HeadersInit = Headers | Iterable> | Record /** * This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers) */ declare class Headers { - constructor(init?: HeadersInit); + constructor(init?: HeadersInit) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get) */ - get(name: string): string | null; - getAll(name: string): string[]; + get(name: string): string | null + getAll(name: string): string[] /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie) */ - getSetCookie(): string[]; + getSetCookie(): string[] /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has) */ - has(name: string): boolean; + has(name: string): boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set) */ - set(name: string, value: string): void; + set(name: string, value: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append) */ - append(name: string, value: string): void; + append(name: string, value: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete) */ - delete(name: string): void; - forEach(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void; + delete(name: string): void + forEach( + callback: ( + this: This, + value: string, + key: string, + parent: Headers, + ) => void, + thisArg?: This, + ): void /* Returns an iterator allowing to go through all key/value pairs contained in this object. */ - entries(): IterableIterator<[ - key: string, - value: string - ]>; + entries(): IterableIterator<[key: string, value: string]> /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */ - keys(): IterableIterator; + keys(): IterableIterator /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[ - key: string, - value: string - ]>; -} -type BodyInit = ReadableStream | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData; + values(): IterableIterator + [Symbol.iterator](): IterableIterator<[key: string, value: string]> +} +type BodyInit = + | ReadableStream + | string + | ArrayBuffer + | ArrayBufferView + | Blob + | URLSearchParams + | FormData declare abstract class Body { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */ - get body(): ReadableStream | null; + get body(): ReadableStream | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */ - get bodyUsed(): boolean; + get bodyUsed(): boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */ - arrayBuffer(): Promise; + arrayBuffer(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */ - bytes(): Promise; + bytes(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */ - text(): Promise; + text(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */ - json(): Promise; + json(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */ - formData(): Promise; + formData(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */ - blob(): Promise; + blob(): Promise } /** * This Fetch API interface represents the response to a request. @@ -1338,12 +1673,12 @@ declare abstract class Body { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response) */ declare var Response: { - prototype: Response; - new (body?: BodyInit | null, init?: ResponseInit): Response; - error(): Response; - redirect(url: string, status?: number): Response; - json(any: any, maybeInit?: (ResponseInit | Response)): Response; -}; + prototype: Response + new (body?: BodyInit | null, init?: ResponseInit): Response + error(): Response + redirect(url: string, status?: number): Response + json(any: any, maybeInit?: ResponseInit | Response): Response +} /** * This Fetch API interface represents the response to a request. * @@ -1351,414 +1686,576 @@ declare var Response: { */ interface Response extends Body { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */ - clone(): Response; + clone(): Response /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */ - status: number; + status: number /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */ - statusText: string; + statusText: string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */ - headers: Headers; + headers: Headers /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */ - ok: boolean; + ok: boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */ - redirected: boolean; + redirected: boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */ - url: string; - webSocket: WebSocket | null; - cf: any | undefined; + url: string + webSocket: WebSocket | null + cf: any | undefined /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type) */ - type: "default" | "error"; + type: 'default' | 'error' } interface ResponseInit { - status?: number; - statusText?: string; - headers?: HeadersInit; - cf?: any; - webSocket?: (WebSocket | null); - encodeBody?: "automatic" | "manual"; -} -type RequestInfo> = Request | string; + status?: number + statusText?: string + headers?: HeadersInit + cf?: any + webSocket?: WebSocket | null + encodeBody?: 'automatic' | 'manual' +} +type RequestInfo> = + | Request + | string /** * This Fetch API interface represents a resource request. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request) */ declare var Request: { - prototype: Request; - new >(input: RequestInfo | URL, init?: RequestInit): Request; -}; + prototype: Request + new >( + input: RequestInfo | URL, + init?: RequestInit, + ): Request +} /** * This Fetch API interface represents a resource request. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request) */ -interface Request> extends Body { +interface Request> + extends Body { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */ - clone(): Request; + clone(): Request /** * Returns request's HTTP method, which is "GET" by default. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method) */ - method: string; + method: string /** * Returns the URL of request as a string. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url) */ - url: string; + url: string /** * Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers) */ - headers: Headers; + headers: Headers /** * Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect) */ - redirect: string; - fetcher: Fetcher | null; + redirect: string + fetcher: Fetcher | null /** * Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal) */ - signal: AbortSignal; - cf: Cf | undefined; + signal: AbortSignal + cf: Cf | undefined /** * Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity) */ - integrity: string; + integrity: string /** * Returns a boolean indicating whether or not request can outlive the global in which it was created. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive) */ - keepalive: boolean; + keepalive: boolean /** * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache) */ - cache?: "no-store"; + cache?: 'no-store' } interface RequestInit { /* A string to set request's method. */ - method?: string; + method?: string /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */ - headers?: HeadersInit; + headers?: HeadersInit /* A BodyInit object or null to set request's body. */ - body?: BodyInit | null; + body?: BodyInit | null /* 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. */ - redirect?: string; - fetcher?: (Fetcher | null); - cf?: Cf; + redirect?: string + fetcher?: Fetcher | null + cf?: Cf /* A string indicating how the request will interact with the browser's cache to set request's cache. */ - cache?: "no-store"; + cache?: 'no-store' /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */ - integrity?: string; + integrity?: string /* An AbortSignal to set request's signal. */ - signal?: (AbortSignal | null); - encodeResponseBody?: "automatic" | "manual"; + signal?: AbortSignal | null + encodeResponseBody?: 'automatic' | 'manual' +} +type Service< + T extends + | (new (...args: any[]) => Rpc.WorkerEntrypointBranded) + | Rpc.WorkerEntrypointBranded + | ExportedHandler + | undefined = undefined, +> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded + ? Fetcher> + : T extends Rpc.WorkerEntrypointBranded + ? Fetcher + : T extends Exclude + ? never + : Fetcher +type Fetcher< + T extends Rpc.EntrypointBranded | undefined = undefined, + Reserved extends string = never, +> = (T extends Rpc.EntrypointBranded + ? Rpc.Provider + : unknown) & { + fetch(input: RequestInfo | URL, init?: RequestInit): Promise + connect(address: SocketAddress | string, options?: SocketOptions): Socket } -type Service Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher> : T extends Rpc.WorkerEntrypointBranded ? Fetcher : T extends Exclude ? never : Fetcher; -type Fetcher = (T extends Rpc.EntrypointBranded ? Rpc.Provider : unknown) & { - fetch(input: RequestInfo | URL, init?: RequestInit): Promise; - connect(address: SocketAddress | string, options?: SocketOptions): Socket; -}; interface KVNamespaceListKey { - name: Key; - expiration?: number; - metadata?: Metadata; -} -type KVNamespaceListResult = { - list_complete: false; - keys: KVNamespaceListKey[]; - cursor: string; - cacheStatus: string | null; -} | { - list_complete: true; - keys: KVNamespaceListKey[]; - cacheStatus: string | null; -}; + name: Key + expiration?: number + metadata?: Metadata +} +type KVNamespaceListResult = + | { + list_complete: false + keys: KVNamespaceListKey[] + cursor: string + cacheStatus: string | null + } + | { + list_complete: true + keys: KVNamespaceListKey[] + cacheStatus: string | null + } interface KVNamespace { - get(key: Key, options?: Partial>): Promise; - get(key: Key, type: "text"): Promise; - get(key: Key, type: "json"): Promise; - get(key: Key, type: "arrayBuffer"): Promise; - get(key: Key, type: "stream"): Promise; - get(key: Key, options?: KVNamespaceGetOptions<"text">): Promise; - get(key: Key, options?: KVNamespaceGetOptions<"json">): Promise; - get(key: Key, options?: KVNamespaceGetOptions<"arrayBuffer">): Promise; - get(key: Key, options?: KVNamespaceGetOptions<"stream">): Promise; - get(key: Array, type: "text"): Promise>; - get(key: Array, type: "json"): Promise>; - get(key: Array, options?: Partial>): Promise>; - get(key: Array, options?: KVNamespaceGetOptions<"text">): Promise>; - get(key: Array, options?: KVNamespaceGetOptions<"json">): Promise>; - list(options?: KVNamespaceListOptions): Promise>; - put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise; - getWithMetadata(key: Key, options?: Partial>): Promise>; - getWithMetadata(key: Key, type: "text"): Promise>; - getWithMetadata(key: Key, type: "json"): Promise>; - getWithMetadata(key: Key, type: "arrayBuffer"): Promise>; - getWithMetadata(key: Key, type: "stream"): Promise>; - getWithMetadata(key: Key, options: KVNamespaceGetOptions<"text">): Promise>; - getWithMetadata(key: Key, options: KVNamespaceGetOptions<"json">): Promise>; - getWithMetadata(key: Key, options: KVNamespaceGetOptions<"arrayBuffer">): Promise>; - getWithMetadata(key: Key, options: KVNamespaceGetOptions<"stream">): Promise>; - getWithMetadata(key: Array, type: "text"): Promise>>; - getWithMetadata(key: Array, type: "json"): Promise>>; - getWithMetadata(key: Array, options?: Partial>): Promise>>; - getWithMetadata(key: Array, options?: KVNamespaceGetOptions<"text">): Promise>>; - getWithMetadata(key: Array, options?: KVNamespaceGetOptions<"json">): Promise>>; - delete(key: Key): Promise; + get( + key: Key, + options?: Partial>, + ): Promise + get(key: Key, type: 'text'): Promise + get( + key: Key, + type: 'json', + ): Promise + get(key: Key, type: 'arrayBuffer'): Promise + get(key: Key, type: 'stream'): Promise + get( + key: Key, + options?: KVNamespaceGetOptions<'text'>, + ): Promise + get( + key: Key, + options?: KVNamespaceGetOptions<'json'>, + ): Promise + get( + key: Key, + options?: KVNamespaceGetOptions<'arrayBuffer'>, + ): Promise + get( + key: Key, + options?: KVNamespaceGetOptions<'stream'>, + ): Promise + get(key: Array, type: 'text'): Promise> + get( + key: Array, + type: 'json', + ): Promise> + get( + key: Array, + options?: Partial>, + ): Promise> + get( + key: Array, + options?: KVNamespaceGetOptions<'text'>, + ): Promise> + get( + key: Array, + options?: KVNamespaceGetOptions<'json'>, + ): Promise> + list( + options?: KVNamespaceListOptions, + ): Promise> + put( + key: Key, + value: string | ArrayBuffer | ArrayBufferView | ReadableStream, + options?: KVNamespacePutOptions, + ): Promise + getWithMetadata( + key: Key, + options?: Partial>, + ): Promise> + getWithMetadata( + key: Key, + type: 'text', + ): Promise> + getWithMetadata( + key: Key, + type: 'json', + ): Promise> + getWithMetadata( + key: Key, + type: 'arrayBuffer', + ): Promise> + getWithMetadata( + key: Key, + type: 'stream', + ): Promise> + getWithMetadata( + key: Key, + options: KVNamespaceGetOptions<'text'>, + ): Promise> + getWithMetadata( + key: Key, + options: KVNamespaceGetOptions<'json'>, + ): Promise> + getWithMetadata( + key: Key, + options: KVNamespaceGetOptions<'arrayBuffer'>, + ): Promise> + getWithMetadata( + key: Key, + options: KVNamespaceGetOptions<'stream'>, + ): Promise> + getWithMetadata( + key: Array, + type: 'text', + ): Promise>> + getWithMetadata( + key: Array, + type: 'json', + ): Promise< + Map> + > + getWithMetadata( + key: Array, + options?: Partial>, + ): Promise>> + getWithMetadata( + key: Array, + options?: KVNamespaceGetOptions<'text'>, + ): Promise>> + getWithMetadata( + key: Array, + options?: KVNamespaceGetOptions<'json'>, + ): Promise< + Map> + > + delete(key: Key): Promise } interface KVNamespaceListOptions { - limit?: number; - prefix?: (string | null); - cursor?: (string | null); + limit?: number + prefix?: string | null + cursor?: string | null } interface KVNamespaceGetOptions { - type: Type; - cacheTtl?: number; + type: Type + cacheTtl?: number } interface KVNamespacePutOptions { - expiration?: number; - expirationTtl?: number; - metadata?: (any | null); + expiration?: number + expirationTtl?: number + metadata?: any | null } interface KVNamespaceGetWithMetadataResult { - value: Value | null; - metadata: Metadata | null; - cacheStatus: string | null; + value: Value | null + metadata: Metadata | null + cacheStatus: string | null } -type QueueContentType = "text" | "bytes" | "json" | "v8"; +type QueueContentType = 'text' | 'bytes' | 'json' | 'v8' interface Queue { - send(message: Body, options?: QueueSendOptions): Promise; - sendBatch(messages: Iterable>, options?: QueueSendBatchOptions): Promise; + send(message: Body, options?: QueueSendOptions): Promise + sendBatch( + messages: Iterable>, + options?: QueueSendBatchOptions, + ): Promise } interface QueueSendOptions { - contentType?: QueueContentType; - delaySeconds?: number; + contentType?: QueueContentType + delaySeconds?: number } interface QueueSendBatchOptions { - delaySeconds?: number; + delaySeconds?: number } interface MessageSendRequest { - body: Body; - contentType?: QueueContentType; - delaySeconds?: number; + body: Body + contentType?: QueueContentType + delaySeconds?: number } interface QueueRetryOptions { - delaySeconds?: number; + delaySeconds?: number } interface Message { - readonly id: string; - readonly timestamp: Date; - readonly body: Body; - readonly attempts: number; - retry(options?: QueueRetryOptions): void; - ack(): void; + readonly id: string + readonly timestamp: Date + readonly body: Body + readonly attempts: number + retry(options?: QueueRetryOptions): void + ack(): void } interface QueueEvent extends ExtendableEvent { - readonly messages: readonly Message[]; - readonly queue: string; - retryAll(options?: QueueRetryOptions): void; - ackAll(): void; + readonly messages: readonly Message[] + readonly queue: string + retryAll(options?: QueueRetryOptions): void + ackAll(): void } interface MessageBatch { - readonly messages: readonly Message[]; - readonly queue: string; - retryAll(options?: QueueRetryOptions): void; - ackAll(): void; + readonly messages: readonly Message[] + readonly queue: string + retryAll(options?: QueueRetryOptions): void + ackAll(): void } interface R2Error extends Error { - readonly name: string; - readonly code: number; - readonly message: string; - readonly action: string; - readonly stack: any; + readonly name: string + readonly code: number + readonly message: string + readonly action: string + readonly stack: any } interface R2ListOptions { - limit?: number; - prefix?: string; - cursor?: string; - delimiter?: string; - startAfter?: string; - include?: ("httpMetadata" | "customMetadata")[]; + limit?: number + prefix?: string + cursor?: string + delimiter?: string + startAfter?: string + include?: ('httpMetadata' | 'customMetadata')[] } declare abstract class R2Bucket { - head(key: string): Promise; - get(key: string, options: R2GetOptions & { - onlyIf: R2Conditional | Headers; - }): Promise; - get(key: string, options?: R2GetOptions): Promise; - put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & { - onlyIf: R2Conditional | Headers; - }): Promise; - put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise; - createMultipartUpload(key: string, options?: R2MultipartOptions): Promise; - resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload; - delete(keys: string | string[]): Promise; - list(options?: R2ListOptions): Promise; + head(key: string): Promise + get( + key: string, + options: R2GetOptions & { + onlyIf: R2Conditional | Headers + }, + ): Promise + get(key: string, options?: R2GetOptions): Promise + put( + key: string, + value: + | ReadableStream + | ArrayBuffer + | ArrayBufferView + | string + | null + | Blob, + options?: R2PutOptions & { + onlyIf: R2Conditional | Headers + }, + ): Promise + put( + key: string, + value: + | ReadableStream + | ArrayBuffer + | ArrayBufferView + | string + | null + | Blob, + options?: R2PutOptions, + ): Promise + createMultipartUpload( + key: string, + options?: R2MultipartOptions, + ): Promise + resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload + delete(keys: string | string[]): Promise + list(options?: R2ListOptions): Promise } interface R2MultipartUpload { - readonly key: string; - readonly uploadId: string; - uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise; - abort(): Promise; - complete(uploadedParts: R2UploadedPart[]): Promise; + readonly key: string + readonly uploadId: string + uploadPart( + partNumber: number, + value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, + options?: R2UploadPartOptions, + ): Promise + abort(): Promise + complete(uploadedParts: R2UploadedPart[]): Promise } interface R2UploadedPart { - partNumber: number; - etag: string; + partNumber: number + etag: string } declare abstract class R2Object { - readonly key: string; - readonly version: string; - readonly size: number; - readonly etag: string; - readonly httpEtag: string; - readonly checksums: R2Checksums; - readonly uploaded: Date; - readonly httpMetadata?: R2HTTPMetadata; - readonly customMetadata?: Record; - readonly range?: R2Range; - readonly storageClass: string; - readonly ssecKeyMd5?: string; - writeHttpMetadata(headers: Headers): void; + readonly key: string + readonly version: string + readonly size: number + readonly etag: string + readonly httpEtag: string + readonly checksums: R2Checksums + readonly uploaded: Date + readonly httpMetadata?: R2HTTPMetadata + readonly customMetadata?: Record + readonly range?: R2Range + readonly storageClass: string + readonly ssecKeyMd5?: string + writeHttpMetadata(headers: Headers): void } interface R2ObjectBody extends R2Object { - get body(): ReadableStream; - get bodyUsed(): boolean; - arrayBuffer(): Promise; - bytes(): Promise; - text(): Promise; - json(): Promise; - blob(): Promise; -} -type R2Range = { - offset: number; - length?: number; -} | { - offset?: number; - length: number; -} | { - suffix: number; -}; + get body(): ReadableStream + get bodyUsed(): boolean + arrayBuffer(): Promise + bytes(): Promise + text(): Promise + json(): Promise + blob(): Promise +} +type R2Range = + | { + offset: number + length?: number + } + | { + offset?: number + length: number + } + | { + suffix: number + } interface R2Conditional { - etagMatches?: string; - etagDoesNotMatch?: string; - uploadedBefore?: Date; - uploadedAfter?: Date; - secondsGranularity?: boolean; + etagMatches?: string + etagDoesNotMatch?: string + uploadedBefore?: Date + uploadedAfter?: Date + secondsGranularity?: boolean } interface R2GetOptions { - onlyIf?: (R2Conditional | Headers); - range?: (R2Range | Headers); - ssecKey?: (ArrayBuffer | string); + onlyIf?: R2Conditional | Headers + range?: R2Range | Headers + ssecKey?: ArrayBuffer | string } interface R2PutOptions { - onlyIf?: (R2Conditional | Headers); - httpMetadata?: (R2HTTPMetadata | Headers); - customMetadata?: Record; - md5?: ((ArrayBuffer | ArrayBufferView) | string); - sha1?: ((ArrayBuffer | ArrayBufferView) | string); - sha256?: ((ArrayBuffer | ArrayBufferView) | string); - sha384?: ((ArrayBuffer | ArrayBufferView) | string); - sha512?: ((ArrayBuffer | ArrayBufferView) | string); - storageClass?: string; - ssecKey?: (ArrayBuffer | string); + onlyIf?: R2Conditional | Headers + httpMetadata?: R2HTTPMetadata | Headers + customMetadata?: Record + md5?: (ArrayBuffer | ArrayBufferView) | string + sha1?: (ArrayBuffer | ArrayBufferView) | string + sha256?: (ArrayBuffer | ArrayBufferView) | string + sha384?: (ArrayBuffer | ArrayBufferView) | string + sha512?: (ArrayBuffer | ArrayBufferView) | string + storageClass?: string + ssecKey?: ArrayBuffer | string } interface R2MultipartOptions { - httpMetadata?: (R2HTTPMetadata | Headers); - customMetadata?: Record; - storageClass?: string; - ssecKey?: (ArrayBuffer | string); + httpMetadata?: R2HTTPMetadata | Headers + customMetadata?: Record + storageClass?: string + ssecKey?: ArrayBuffer | string } interface R2Checksums { - readonly md5?: ArrayBuffer; - readonly sha1?: ArrayBuffer; - readonly sha256?: ArrayBuffer; - readonly sha384?: ArrayBuffer; - readonly sha512?: ArrayBuffer; - toJSON(): R2StringChecksums; + readonly md5?: ArrayBuffer + readonly sha1?: ArrayBuffer + readonly sha256?: ArrayBuffer + readonly sha384?: ArrayBuffer + readonly sha512?: ArrayBuffer + toJSON(): R2StringChecksums } interface R2StringChecksums { - md5?: string; - sha1?: string; - sha256?: string; - sha384?: string; - sha512?: string; + md5?: string + sha1?: string + sha256?: string + sha384?: string + sha512?: string } interface R2HTTPMetadata { - contentType?: string; - contentLanguage?: string; - contentDisposition?: string; - contentEncoding?: string; - cacheControl?: string; - cacheExpiry?: Date; + contentType?: string + contentLanguage?: string + contentDisposition?: string + contentEncoding?: string + cacheControl?: string + cacheExpiry?: Date } type R2Objects = { - objects: R2Object[]; - delimitedPrefixes: string[]; -} & ({ - truncated: true; - cursor: string; -} | { - truncated: false; -}); + objects: R2Object[] + delimitedPrefixes: string[] +} & ( + | { + truncated: true + cursor: string + } + | { + truncated: false + } +) interface R2UploadPartOptions { - ssecKey?: (ArrayBuffer | string); + ssecKey?: ArrayBuffer | string } declare abstract class ScheduledEvent extends ExtendableEvent { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; + readonly scheduledTime: number + readonly cron: string + noRetry(): void } interface ScheduledController { - readonly scheduledTime: number; - readonly cron: string; - noRetry(): void; + readonly scheduledTime: number + readonly cron: string + noRetry(): void } interface QueuingStrategy { - highWaterMark?: (number | bigint); - size?: (chunk: T) => number | bigint; + highWaterMark?: number | bigint + size?: (chunk: T) => number | bigint } interface UnderlyingSink { - type?: string; - start?: (controller: WritableStreamDefaultController) => void | Promise; - write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise; - abort?: (reason: any) => void | Promise; - close?: () => void | Promise; + type?: string + start?: ( + controller: WritableStreamDefaultController, + ) => void | Promise + write?: ( + chunk: W, + controller: WritableStreamDefaultController, + ) => void | Promise + abort?: (reason: any) => void | Promise + close?: () => void | Promise } interface UnderlyingByteSource { - type: "bytes"; - autoAllocateChunkSize?: number; - start?: (controller: ReadableByteStreamController) => void | Promise; - pull?: (controller: ReadableByteStreamController) => void | Promise; - cancel?: (reason: any) => void | Promise; + type: 'bytes' + autoAllocateChunkSize?: number + start?: (controller: ReadableByteStreamController) => void | Promise + pull?: (controller: ReadableByteStreamController) => void | Promise + cancel?: (reason: any) => void | Promise } interface UnderlyingSource { - type?: "" | undefined; - start?: (controller: ReadableStreamDefaultController) => void | Promise; - pull?: (controller: ReadableStreamDefaultController) => void | Promise; - cancel?: (reason: any) => void | Promise; - expectedLength?: (number | bigint); + type?: '' | undefined + start?: ( + controller: ReadableStreamDefaultController, + ) => void | Promise + pull?: ( + controller: ReadableStreamDefaultController, + ) => void | Promise + cancel?: (reason: any) => void | Promise + expectedLength?: number | bigint } interface Transformer { - readableType?: string; - writableType?: string; - start?: (controller: TransformStreamDefaultController) => void | Promise; - transform?: (chunk: I, controller: TransformStreamDefaultController) => void | Promise; - flush?: (controller: TransformStreamDefaultController) => void | Promise; - cancel?: (reason: any) => void | Promise; - expectedLength?: number; + readableType?: string + writableType?: string + start?: ( + controller: TransformStreamDefaultController, + ) => void | Promise + transform?: ( + chunk: I, + controller: TransformStreamDefaultController, + ) => void | Promise + flush?: ( + controller: TransformStreamDefaultController, + ) => void | Promise + cancel?: (reason: any) => void | Promise + expectedLength?: number } interface StreamPipeOptions { /** @@ -1778,18 +2275,20 @@ interface StreamPipeOptions { * * 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. */ - preventClose?: boolean; - preventAbort?: boolean; - preventCancel?: boolean; - signal?: AbortSignal; -} -type ReadableStreamReadResult = { - done: false; - value: R; -} | { - done: true; - value?: undefined; -}; + preventClose?: boolean + preventAbort?: boolean + preventCancel?: boolean + signal?: AbortSignal +} +type ReadableStreamReadResult = + | { + done: false + value: R + } + | { + done: true + value?: undefined + } /** * This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. * @@ -1797,24 +2296,29 @@ type ReadableStreamReadResult = { */ interface ReadableStream { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */ - get locked(): boolean; + get locked(): boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */ - cancel(reason?: any): Promise; + cancel(reason?: any): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */ - getReader(): ReadableStreamDefaultReader; + getReader(): ReadableStreamDefaultReader /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */ - getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader; + getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */ - pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; + pipeThrough( + transform: ReadableWritablePair, + options?: StreamPipeOptions, + ): ReadableStream /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */ - pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; + pipeTo( + destination: WritableStream, + options?: StreamPipeOptions, + ): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */ - tee(): [ - ReadableStream, - ReadableStream - ]; - values(options?: ReadableStreamValuesOptions): AsyncIterableIterator; - [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator; + tee(): [ReadableStream, ReadableStream] + values(options?: ReadableStreamValuesOptions): AsyncIterableIterator + [Symbol.asyncIterator]( + options?: ReadableStreamValuesOptions, + ): AsyncIterableIterator } /** * This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. @@ -1822,33 +2326,44 @@ interface ReadableStream { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream) */ declare const ReadableStream: { - prototype: ReadableStream; - new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy): ReadableStream; - new (underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; -}; + prototype: ReadableStream + new ( + underlyingSource: UnderlyingByteSource, + strategy?: QueuingStrategy, + ): ReadableStream + new ( + underlyingSource?: UnderlyingSource, + strategy?: QueuingStrategy, + ): ReadableStream +} /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader) */ declare class ReadableStreamDefaultReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; + constructor(stream: ReadableStream) + get closed(): Promise + cancel(reason?: any): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */ - read(): Promise>; + read(): Promise> /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */ - releaseLock(): void; + releaseLock(): void } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */ declare class ReadableStreamBYOBReader { - constructor(stream: ReadableStream); - get closed(): Promise; - cancel(reason?: any): Promise; + constructor(stream: ReadableStream) + get closed(): Promise + cancel(reason?: any): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */ - read(view: T): Promise>; + read( + view: T, + ): Promise> /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */ - releaseLock(): void; - readAtLeast(minElements: number, view: T): Promise>; + releaseLock(): void + readAtLeast( + minElements: number, + view: T, + ): Promise> } interface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions { - min?: number; + min?: number } interface ReadableStreamGetReaderOptions { /** @@ -1856,41 +2371,41 @@ interface ReadableStreamGetReaderOptions { * * 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. */ - mode: "byob"; + mode: 'byob' } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */ declare abstract class ReadableStreamBYOBRequest { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */ - get view(): Uint8Array | null; + get view(): Uint8Array | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */ - respond(bytesWritten: number): void; + respond(bytesWritten: number): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */ - respondWithNewView(view: ArrayBuffer | ArrayBufferView): void; - get atLeast(): number | null; + respondWithNewView(view: ArrayBuffer | ArrayBufferView): void + get atLeast(): number | null } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) */ declare abstract class ReadableStreamDefaultController { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */ - get desiredSize(): number | null; + get desiredSize(): number | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */ - close(): void; + close(): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */ - enqueue(chunk?: R): void; + enqueue(chunk?: R): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */ - error(reason: any): void; + error(reason: any): void } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) */ declare abstract class ReadableByteStreamController { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */ - get byobRequest(): ReadableStreamBYOBRequest | null; + get byobRequest(): ReadableStreamBYOBRequest | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */ - get desiredSize(): number | null; + get desiredSize(): number | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */ - close(): void; + close(): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */ - enqueue(chunk: ArrayBuffer | ArrayBufferView): void; + enqueue(chunk: ArrayBuffer | ArrayBufferView): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */ - error(reason: any): void; + error(reason: any): void } /** * This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. @@ -1899,20 +2414,20 @@ declare abstract class ReadableByteStreamController { */ declare abstract class WritableStreamDefaultController { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */ - get signal(): AbortSignal; + get signal(): AbortSignal /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */ - error(reason?: any): void; + error(reason?: any): void } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */ declare abstract class TransformStreamDefaultController { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */ - get desiredSize(): number | null; + get desiredSize(): number | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */ - enqueue(chunk?: O): void; + enqueue(chunk?: O): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */ - error(reason: any): void; + error(reason: any): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */ - terminate(): void; + terminate(): void } interface ReadableWritablePair { /** @@ -1920,8 +2435,8 @@ interface ReadableWritablePair { * * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. */ - writable: WritableStream; - readable: ReadableStream; + writable: WritableStream + readable: ReadableStream } /** * This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. @@ -1929,15 +2444,18 @@ interface ReadableWritablePair { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream) */ declare class WritableStream { - constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy); + constructor( + underlyingSink?: UnderlyingSink, + queuingStrategy?: QueuingStrategy, + ) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */ - get locked(): boolean; + get locked(): boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */ - abort(reason?: any): Promise; + abort(reason?: any): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */ - close(): Promise; + close(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */ - getWriter(): WritableStreamDefaultWriter; + getWriter(): WritableStreamDefaultWriter } /** * This Streams API interface 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. @@ -1945,77 +2463,101 @@ declare class WritableStream { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter) */ declare class WritableStreamDefaultWriter { - constructor(stream: WritableStream); + constructor(stream: WritableStream) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */ - get closed(): Promise; + get closed(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */ - get ready(): Promise; + get ready(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */ - get desiredSize(): number | null; + get desiredSize(): number | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */ - abort(reason?: any): Promise; + abort(reason?: any): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */ - close(): Promise; + close(): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */ - write(chunk?: W): Promise; + write(chunk?: W): Promise /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */ - releaseLock(): void; + releaseLock(): void } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream) */ declare class TransformStream { - constructor(transformer?: Transformer, writableStrategy?: QueuingStrategy, readableStrategy?: QueuingStrategy); + constructor( + transformer?: Transformer, + writableStrategy?: QueuingStrategy, + readableStrategy?: QueuingStrategy, + ) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */ - get readable(): ReadableStream; + get readable(): ReadableStream /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */ - get writable(): WritableStream; + get writable(): WritableStream } declare class FixedLengthStream extends IdentityTransformStream { - constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy); + constructor( + expectedLength: number | bigint, + queuingStrategy?: IdentityTransformStreamQueuingStrategy, + ) } -declare class IdentityTransformStream extends TransformStream { - constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy); +declare class IdentityTransformStream extends TransformStream< + ArrayBuffer | ArrayBufferView, + Uint8Array +> { + constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy) } interface IdentityTransformStreamQueuingStrategy { - highWaterMark?: (number | bigint); + highWaterMark?: number | bigint } interface ReadableStreamValuesOptions { - preventCancel?: boolean; + preventCancel?: boolean } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) */ -declare class CompressionStream extends TransformStream { - constructor(format: "gzip" | "deflate" | "deflate-raw"); +declare class CompressionStream extends TransformStream< + ArrayBuffer | ArrayBufferView, + Uint8Array +> { + constructor(format: 'gzip' | 'deflate' | 'deflate-raw') } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) */ -declare class DecompressionStream extends TransformStream { - constructor(format: "gzip" | "deflate" | "deflate-raw"); +declare class DecompressionStream extends TransformStream< + ArrayBuffer | ArrayBufferView, + Uint8Array +> { + constructor(format: 'gzip' | 'deflate' | 'deflate-raw') } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream) */ declare class TextEncoderStream extends TransformStream { - constructor(); - get encoding(): string; + constructor() + get encoding(): string } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream) */ -declare class TextDecoderStream extends TransformStream { - constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit); - get encoding(): string; - get fatal(): boolean; - get ignoreBOM(): boolean; +declare class TextDecoderStream extends TransformStream< + ArrayBuffer | ArrayBufferView, + string +> { + constructor( + label?: string, + options?: TextDecoderStreamTextDecoderStreamInit, + ) + get encoding(): string + get fatal(): boolean + get ignoreBOM(): boolean } interface TextDecoderStreamTextDecoderStreamInit { - fatal?: boolean; - ignoreBOM?: boolean; + fatal?: boolean + ignoreBOM?: boolean } /** * This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy) */ -declare class ByteLengthQueuingStrategy implements QueuingStrategy { - constructor(init: QueuingStrategyInit); +declare class ByteLengthQueuingStrategy + implements QueuingStrategy +{ + constructor(init: QueuingStrategyInit) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */ - get highWaterMark(): number; + get highWaterMark(): number /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */ - get size(): (chunk?: any) => number; + get size(): (chunk?: any) => number } /** * This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. @@ -2023,11 +2565,11 @@ declare class ByteLengthQueuingStrategy implements QueuingStrategy number; + get size(): (chunk?: any) => number } interface QueuingStrategyInit { /** @@ -2035,111 +2577,125 @@ interface QueuingStrategyInit { * * 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. */ - highWaterMark: number; + highWaterMark: number } interface ScriptVersion { - id?: string; - tag?: string; - message?: string; + id?: string + tag?: string + message?: string } declare abstract class TailEvent extends ExtendableEvent { - readonly events: TraceItem[]; - readonly traces: TraceItem[]; + readonly events: TraceItem[] + readonly traces: TraceItem[] } interface TraceItem { - readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null; - readonly eventTimestamp: number | null; - readonly logs: TraceLog[]; - readonly exceptions: TraceException[]; - readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[]; - readonly scriptName: string | null; - readonly entrypoint?: string; - readonly scriptVersion?: ScriptVersion; - readonly dispatchNamespace?: string; - readonly scriptTags?: string[]; - readonly outcome: string; - readonly executionModel: string; - readonly truncated: boolean; - readonly cpuTime: number; - readonly wallTime: number; + readonly event: + | ( + | TraceItemFetchEventInfo + | TraceItemJsRpcEventInfo + | TraceItemScheduledEventInfo + | TraceItemAlarmEventInfo + | TraceItemQueueEventInfo + | TraceItemEmailEventInfo + | TraceItemTailEventInfo + | TraceItemCustomEventInfo + | TraceItemHibernatableWebSocketEventInfo + ) + | null + readonly eventTimestamp: number | null + readonly logs: TraceLog[] + readonly exceptions: TraceException[] + readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[] + readonly scriptName: string | null + readonly entrypoint?: string + readonly scriptVersion?: ScriptVersion + readonly dispatchNamespace?: string + readonly scriptTags?: string[] + readonly outcome: string + readonly executionModel: string + readonly truncated: boolean + readonly cpuTime: number + readonly wallTime: number } interface TraceItemAlarmEventInfo { - readonly scheduledTime: Date; -} -interface TraceItemCustomEventInfo { + readonly scheduledTime: Date } +interface TraceItemCustomEventInfo {} interface TraceItemScheduledEventInfo { - readonly scheduledTime: number; - readonly cron: string; + readonly scheduledTime: number + readonly cron: string } interface TraceItemQueueEventInfo { - readonly queue: string; - readonly batchSize: number; + readonly queue: string + readonly batchSize: number } interface TraceItemEmailEventInfo { - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; + readonly mailFrom: string + readonly rcptTo: string + readonly rawSize: number } interface TraceItemTailEventInfo { - readonly consumedEvents: TraceItemTailEventInfoTailItem[]; + readonly consumedEvents: TraceItemTailEventInfoTailItem[] } interface TraceItemTailEventInfoTailItem { - readonly scriptName: string | null; + readonly scriptName: string | null } interface TraceItemFetchEventInfo { - readonly response?: TraceItemFetchEventInfoResponse; - readonly request: TraceItemFetchEventInfoRequest; + readonly response?: TraceItemFetchEventInfoResponse + readonly request: TraceItemFetchEventInfoRequest } interface TraceItemFetchEventInfoRequest { - readonly cf?: any; - readonly headers: Record; - readonly method: string; - readonly url: string; - getUnredacted(): TraceItemFetchEventInfoRequest; + readonly cf?: any + readonly headers: Record + readonly method: string + readonly url: string + getUnredacted(): TraceItemFetchEventInfoRequest } interface TraceItemFetchEventInfoResponse { - readonly status: number; + readonly status: number } interface TraceItemJsRpcEventInfo { - readonly rpcMethod: string; + readonly rpcMethod: string } interface TraceItemHibernatableWebSocketEventInfo { - readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError; + readonly getWebSocketEvent: + | TraceItemHibernatableWebSocketEventInfoMessage + | TraceItemHibernatableWebSocketEventInfoClose + | TraceItemHibernatableWebSocketEventInfoError } interface TraceItemHibernatableWebSocketEventInfoMessage { - readonly webSocketEventType: string; + readonly webSocketEventType: string } interface TraceItemHibernatableWebSocketEventInfoClose { - readonly webSocketEventType: string; - readonly code: number; - readonly wasClean: boolean; + readonly webSocketEventType: string + readonly code: number + readonly wasClean: boolean } interface TraceItemHibernatableWebSocketEventInfoError { - readonly webSocketEventType: string; + readonly webSocketEventType: string } interface TraceLog { - readonly timestamp: number; - readonly level: string; - readonly message: any; + readonly timestamp: number + readonly level: string + readonly message: any } interface TraceException { - readonly timestamp: number; - readonly message: string; - readonly name: string; - readonly stack?: string; + readonly timestamp: number + readonly message: string + readonly name: string + readonly stack?: string } interface TraceDiagnosticChannelEvent { - readonly timestamp: number; - readonly channel: string; - readonly message: any; + readonly timestamp: number + readonly channel: string + readonly message: any } interface TraceMetrics { - readonly cpuTime: number; - readonly wallTime: number; + readonly cpuTime: number + readonly wallTime: number } interface UnsafeTraceMetrics { - fromTrace(item: TraceItem): TraceMetrics; + fromTrace(item: TraceItem): TraceMetrics } /** * The URL interface represents an object providing static methods used for creating object URLs. @@ -2147,166 +2703,177 @@ interface UnsafeTraceMetrics { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL) */ declare class URL { - constructor(url: string | URL, base?: string | URL); + constructor(url: string | URL, base?: string | URL) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */ - get origin(): string; + get origin(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */ - get href(): string; + get href(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */ - set href(value: string); + set href(value: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */ - get protocol(): string; + get protocol(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */ - set protocol(value: string); + set protocol(value: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */ - get username(): string; + get username(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */ - set username(value: string); + set username(value: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */ - get password(): string; + get password(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */ - set password(value: string); + set password(value: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */ - get host(): string; + get host(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */ - set host(value: string); + set host(value: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */ - get hostname(): string; + get hostname(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */ - set hostname(value: string); + set hostname(value: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */ - get port(): string; + get port(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */ - set port(value: string); + set port(value: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */ - get pathname(): string; + get pathname(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */ - set pathname(value: string); + set pathname(value: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */ - get search(): string; + get search(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */ - set search(value: string); + set search(value: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */ - get hash(): string; + get hash(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */ - set hash(value: string); + set hash(value: string) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */ - get searchParams(): URLSearchParams; + get searchParams(): URLSearchParams /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */ - toJSON(): string; + toJSON(): string /*function toString() { [native code] }*/ - toString(): string; + toString(): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */ - static canParse(url: string, base?: string): boolean; + static canParse(url: string, base?: string): boolean /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static) */ - static parse(url: string, base?: string): URL | null; + static parse(url: string, base?: string): URL | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static) */ - static createObjectURL(object: File | Blob): string; + static createObjectURL(object: File | Blob): string /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static) */ - static revokeObjectURL(object_url: string): void; + static revokeObjectURL(object_url: string): void } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */ declare class URLSearchParams { - constructor(init?: (Iterable> | Record | string)); + constructor( + init?: Iterable> | Record | string, + ) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */ - get size(): number; + get size(): number /** * Appends a specified key/value pair as a new search parameter. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append) */ - append(name: string, value: string): void; + append(name: string, value: string): void /** * Deletes the given search parameter, and its associated value, from the list of all search parameters. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete) */ - delete(name: string, value?: string): void; + delete(name: string, value?: string): void /** * Returns the first value associated to the given search parameter. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get) */ - get(name: string): string | null; + get(name: string): string | null /** * Returns all the values association with a given search parameter. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll) */ - getAll(name: string): string[]; + getAll(name: string): string[] /** * Returns a Boolean indicating if such a search parameter exists. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has) */ - has(name: string, value?: string): boolean; + has(name: string, value?: string): boolean /** * Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set) */ - set(name: string, value: string): void; + set(name: string, value: string): void /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */ - sort(): void; + sort(): void /* Returns an array of key, value pairs for every entry in the search params. */ - entries(): IterableIterator<[ - key: string, - value: string - ]>; + entries(): IterableIterator<[key: string, value: string]> /* Returns a list of keys in the search params. */ - keys(): IterableIterator; + keys(): IterableIterator /* Returns a list of values in the search params. */ - values(): IterableIterator; - forEach(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void; + values(): IterableIterator + forEach( + callback: ( + this: This, + value: string, + key: string, + parent: URLSearchParams, + ) => void, + thisArg?: This, + ): void /*function toString() { [native code] } Returns a string containing a query string suitable for use in a URL. Does not include the question mark. */ - toString(): string; - [Symbol.iterator](): IterableIterator<[ - key: string, - value: string - ]>; + toString(): string + [Symbol.iterator](): IterableIterator<[key: string, value: string]> } declare class URLPattern { - constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions); - get protocol(): string; - get username(): string; - get password(): string; - get hostname(): string; - get port(): string; - get pathname(): string; - get search(): string; - get hash(): string; - get hasRegExpGroups(): boolean; - test(input?: (string | URLPatternInit), baseURL?: string): boolean; - exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null; + constructor( + input?: string | URLPatternInit, + baseURL?: string | URLPatternOptions, + patternOptions?: URLPatternOptions, + ) + get protocol(): string + get username(): string + get password(): string + get hostname(): string + get port(): string + get pathname(): string + get search(): string + get hash(): string + get hasRegExpGroups(): boolean + test(input?: string | URLPatternInit, baseURL?: string): boolean + exec( + input?: string | URLPatternInit, + baseURL?: string, + ): URLPatternResult | null } interface URLPatternInit { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - pathname?: string; - search?: string; - hash?: string; - baseURL?: string; + protocol?: string + username?: string + password?: string + hostname?: string + port?: string + pathname?: string + search?: string + hash?: string + baseURL?: string } interface URLPatternComponentResult { - input: string; - groups: Record; + input: string + groups: Record } interface URLPatternResult { - inputs: (string | URLPatternInit)[]; - protocol: URLPatternComponentResult; - username: URLPatternComponentResult; - password: URLPatternComponentResult; - hostname: URLPatternComponentResult; - port: URLPatternComponentResult; - pathname: URLPatternComponentResult; - search: URLPatternComponentResult; - hash: URLPatternComponentResult; + inputs: (string | URLPatternInit)[] + protocol: URLPatternComponentResult + username: URLPatternComponentResult + password: URLPatternComponentResult + hostname: URLPatternComponentResult + port: URLPatternComponentResult + pathname: URLPatternComponentResult + search: URLPatternComponentResult + hash: URLPatternComponentResult } interface URLPatternOptions { - ignoreCase?: boolean; + ignoreCase?: boolean } /** * A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. @@ -2314,217 +2881,223 @@ interface URLPatternOptions { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent) */ declare class CloseEvent extends Event { - constructor(type: string, initializer?: CloseEventInit); + constructor(type: string, initializer?: CloseEventInit) /** * Returns the WebSocket connection close code provided by the server. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) */ - readonly code: number; + readonly code: number /** * Returns the WebSocket connection close reason provided by the server. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason) */ - readonly reason: string; + readonly reason: string /** * Returns true if the connection closed cleanly; false otherwise. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean) */ - readonly wasClean: boolean; + readonly wasClean: boolean } interface CloseEventInit { - code?: number; - reason?: string; - wasClean?: boolean; + code?: number + reason?: string + wasClean?: boolean } type WebSocketEventMap = { - close: CloseEvent; - message: MessageEvent; - open: Event; - error: ErrorEvent; -}; + close: CloseEvent + message: MessageEvent + open: Event + error: ErrorEvent +} /** * Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket) */ declare var WebSocket: { - prototype: WebSocket; - new (url: string, protocols?: (string[] | string)): WebSocket; - readonly READY_STATE_CONNECTING: number; - readonly CONNECTING: number; - readonly READY_STATE_OPEN: number; - readonly OPEN: number; - readonly READY_STATE_CLOSING: number; - readonly CLOSING: number; - readonly READY_STATE_CLOSED: number; - readonly CLOSED: number; -}; + prototype: WebSocket + new (url: string, protocols?: string[] | string): WebSocket + readonly READY_STATE_CONNECTING: number + readonly CONNECTING: number + readonly READY_STATE_OPEN: number + readonly OPEN: number + readonly READY_STATE_CLOSING: number + readonly CLOSING: number + readonly READY_STATE_CLOSED: number + readonly CLOSED: number +} /** * Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket) */ interface WebSocket extends EventTarget { - accept(): void; + accept(): void /** * Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send) */ - send(message: (ArrayBuffer | ArrayBufferView) | string): void; + send(message: (ArrayBuffer | ArrayBufferView) | string): void /** * Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close) */ - close(code?: number, reason?: string): void; - serializeAttachment(attachment: any): void; - deserializeAttachment(): any | null; + close(code?: number, reason?: string): void + serializeAttachment(attachment: any): void + deserializeAttachment(): any | null /** * Returns the state of the WebSocket object's connection. It can have the values described below. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState) */ - readyState: number; + readyState: number /** * Returns the URL that was used to establish the WebSocket connection. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url) */ - url: string | null; + url: string | null /** * Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol) */ - protocol: string | null; + protocol: string | null /** * Returns the extensions selected by the server, if any. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions) */ - extensions: string | null; + extensions: string | null } declare const WebSocketPair: { new (): { - 0: WebSocket; - 1: WebSocket; - }; -}; + 0: WebSocket + 1: WebSocket + } +} interface SqlStorage { - exec>(query: string, ...bindings: any[]): SqlStorageCursor; - get databaseSize(): number; - Cursor: typeof SqlStorageCursor; - Statement: typeof SqlStorageStatement; -} -declare abstract class SqlStorageStatement { -} -type SqlStorageValue = ArrayBuffer | string | number | null; -declare abstract class SqlStorageCursor> { - next(): { - done?: false; - value: T; - } | { - done: true; - value?: never; - }; - toArray(): T[]; - one(): T; - raw(): IterableIterator; - columnNames: string[]; - get rowsRead(): number; - get rowsWritten(): number; - [Symbol.iterator](): IterableIterator; + exec>( + query: string, + ...bindings: any[] + ): SqlStorageCursor + get databaseSize(): number + Cursor: typeof SqlStorageCursor + Statement: typeof SqlStorageStatement +} +declare abstract class SqlStorageStatement {} +type SqlStorageValue = ArrayBuffer | string | number | null +declare abstract class SqlStorageCursor< + T extends Record, +> { + next(): + | { + done?: false + value: T + } + | { + done: true + value?: never + } + toArray(): T[] + one(): T + raw(): IterableIterator + columnNames: string[] + get rowsRead(): number + get rowsWritten(): number + [Symbol.iterator](): IterableIterator } interface Socket { - get readable(): ReadableStream; - get writable(): WritableStream; - get closed(): Promise; - get opened(): Promise; - get upgraded(): boolean; - get secureTransport(): "on" | "off" | "starttls"; - close(): Promise; - startTls(options?: TlsOptions): Socket; + get readable(): ReadableStream + get writable(): WritableStream + get closed(): Promise + get opened(): Promise + get upgraded(): boolean + get secureTransport(): 'on' | 'off' | 'starttls' + close(): Promise + startTls(options?: TlsOptions): Socket } interface SocketOptions { - secureTransport?: string; - allowHalfOpen: boolean; - highWaterMark?: (number | bigint); + secureTransport?: string + allowHalfOpen: boolean + highWaterMark?: number | bigint } interface SocketAddress { - hostname: string; - port: number; + hostname: string + port: number } interface TlsOptions { - expectedServerHostname?: string; + expectedServerHostname?: string } interface SocketInfo { - remoteAddress?: string; - localAddress?: string; + remoteAddress?: string + localAddress?: string } /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */ declare class EventSource extends EventTarget { - constructor(url: string, init?: EventSourceEventSourceInit); + constructor(url: string, init?: EventSourceEventSourceInit) /** * Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close) */ - close(): void; + close(): void /** * Returns the URL providing the event stream. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url) */ - get url(): string; + get url(): string /** * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials) */ - get withCredentials(): boolean; + get withCredentials(): boolean /** * Returns the state of this EventSource object's connection. It can have the values described below. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState) */ - get readyState(): number; + get readyState(): number /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ - get onopen(): any | null; + get onopen(): any | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ - set onopen(value: any | null); + set onopen(value: any | null) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ - get onmessage(): any | null; + get onmessage(): any | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ - set onmessage(value: any | null); + set onmessage(value: any | null) /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ - get onerror(): any | null; + get onerror(): any | null /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ - set onerror(value: any | null); - static readonly CONNECTING: number; - static readonly OPEN: number; - static readonly CLOSED: number; - static from(stream: ReadableStream): EventSource; + set onerror(value: any | null) + static readonly CONNECTING: number + static readonly OPEN: number + static readonly CLOSED: number + static from(stream: ReadableStream): EventSource } interface EventSourceEventSourceInit { - withCredentials?: boolean; - fetcher?: Fetcher; + withCredentials?: boolean + fetcher?: Fetcher } interface Container { - get running(): boolean; - start(options?: ContainerStartupOptions): void; - monitor(): Promise; - destroy(error?: any): Promise; - signal(signo: number): void; - getTcpPort(port: number): Fetcher; + get running(): boolean + start(options?: ContainerStartupOptions): void + monitor(): Promise + destroy(error?: any): Promise + signal(signo: number): void + getTcpPort(port: number): Fetcher } interface ContainerStartupOptions { - entrypoint?: string[]; - enableInternet: boolean; - env?: Record; + entrypoint?: string[] + enableInternet: boolean + env?: Record } /** * This Channel Messaging API interface 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. @@ -2539,629 +3112,667 @@ interface MessagePort extends EventTarget { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage) */ - postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void; + postMessage( + data?: any, + options?: any[] | MessagePortPostMessageOptions, + ): void /** * Disconnects the port, so that it is no longer active. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close) */ - close(): void; + close(): void /** * Begins dispatching messages received on the port. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start) */ - start(): void; - get onmessage(): any | null; - set onmessage(value: any | null); + start(): void + get onmessage(): any | null + set onmessage(value: any | null) } interface MessagePortPostMessageOptions { - transfer?: any[]; + transfer?: any[] } type AiImageClassificationInput = { - image: number[]; -}; + image: number[] +} type AiImageClassificationOutput = { - score?: number; - label?: string; -}[]; + score?: number + label?: string +}[] declare abstract class BaseAiImageClassification { - inputs: AiImageClassificationInput; - postProcessedOutputs: AiImageClassificationOutput; + inputs: AiImageClassificationInput + postProcessedOutputs: AiImageClassificationOutput } type AiImageToTextInput = { - image: number[]; - prompt?: string; - max_tokens?: number; - temperature?: number; - top_p?: number; - top_k?: number; - seed?: number; - repetition_penalty?: number; - frequency_penalty?: number; - presence_penalty?: number; - raw?: boolean; - messages?: RoleScopedChatInput[]; -}; + image: number[] + prompt?: string + max_tokens?: number + temperature?: number + top_p?: number + top_k?: number + seed?: number + repetition_penalty?: number + frequency_penalty?: number + presence_penalty?: number + raw?: boolean + messages?: RoleScopedChatInput[] +} type AiImageToTextOutput = { - description: string; -}; + description: string +} declare abstract class BaseAiImageToText { - inputs: AiImageToTextInput; - postProcessedOutputs: AiImageToTextOutput; + inputs: AiImageToTextInput + postProcessedOutputs: AiImageToTextOutput } type AiImageTextToTextInput = { - image: string; - prompt?: string; - max_tokens?: number; - temperature?: number; - ignore_eos?: boolean; - top_p?: number; - top_k?: number; - seed?: number; - repetition_penalty?: number; - frequency_penalty?: number; - presence_penalty?: number; - raw?: boolean; - messages?: RoleScopedChatInput[]; -}; + image: string + prompt?: string + max_tokens?: number + temperature?: number + ignore_eos?: boolean + top_p?: number + top_k?: number + seed?: number + repetition_penalty?: number + frequency_penalty?: number + presence_penalty?: number + raw?: boolean + messages?: RoleScopedChatInput[] +} type AiImageTextToTextOutput = { - description: string; -}; + description: string +} declare abstract class BaseAiImageTextToText { - inputs: AiImageTextToTextInput; - postProcessedOutputs: AiImageTextToTextOutput; + inputs: AiImageTextToTextInput + postProcessedOutputs: AiImageTextToTextOutput } type AiObjectDetectionInput = { - image: number[]; -}; + image: number[] +} type AiObjectDetectionOutput = { - score?: number; - label?: string; -}[]; + score?: number + label?: string +}[] declare abstract class BaseAiObjectDetection { - inputs: AiObjectDetectionInput; - postProcessedOutputs: AiObjectDetectionOutput; + inputs: AiObjectDetectionInput + postProcessedOutputs: AiObjectDetectionOutput } type AiSentenceSimilarityInput = { - source: string; - sentences: string[]; -}; -type AiSentenceSimilarityOutput = number[]; + source: string + sentences: string[] +} +type AiSentenceSimilarityOutput = number[] declare abstract class BaseAiSentenceSimilarity { - inputs: AiSentenceSimilarityInput; - postProcessedOutputs: AiSentenceSimilarityOutput; + inputs: AiSentenceSimilarityInput + postProcessedOutputs: AiSentenceSimilarityOutput } type AiAutomaticSpeechRecognitionInput = { - audio: number[]; -}; + audio: number[] +} type AiAutomaticSpeechRecognitionOutput = { - text?: string; + text?: string words?: { - word: string; - start: number; - end: number; - }[]; - vtt?: string; -}; + word: string + start: number + end: number + }[] + vtt?: string +} declare abstract class BaseAiAutomaticSpeechRecognition { - inputs: AiAutomaticSpeechRecognitionInput; - postProcessedOutputs: AiAutomaticSpeechRecognitionOutput; + inputs: AiAutomaticSpeechRecognitionInput + postProcessedOutputs: AiAutomaticSpeechRecognitionOutput } type AiSummarizationInput = { - input_text: string; - max_length?: number; -}; + input_text: string + max_length?: number +} type AiSummarizationOutput = { - summary: string; -}; + summary: string +} declare abstract class BaseAiSummarization { - inputs: AiSummarizationInput; - postProcessedOutputs: AiSummarizationOutput; + inputs: AiSummarizationInput + postProcessedOutputs: AiSummarizationOutput } type AiTextClassificationInput = { - text: string; -}; + text: string +} type AiTextClassificationOutput = { - score?: number; - label?: string; -}[]; + score?: number + label?: string +}[] declare abstract class BaseAiTextClassification { - inputs: AiTextClassificationInput; - postProcessedOutputs: AiTextClassificationOutput; + inputs: AiTextClassificationInput + postProcessedOutputs: AiTextClassificationOutput } type AiTextEmbeddingsInput = { - text: string | string[]; -}; + text: string | string[] +} type AiTextEmbeddingsOutput = { - shape: number[]; - data: number[][]; -}; + shape: number[] + data: number[][] +} declare abstract class BaseAiTextEmbeddings { - inputs: AiTextEmbeddingsInput; - postProcessedOutputs: AiTextEmbeddingsOutput; + inputs: AiTextEmbeddingsInput + postProcessedOutputs: AiTextEmbeddingsOutput } type RoleScopedChatInput = { - role: "user" | "assistant" | "system" | "tool" | (string & NonNullable); - content: string; - name?: string; -}; + role: + | 'user' + | 'assistant' + | 'system' + | 'tool' + | (string & NonNullable) + content: string + name?: string +} type AiTextGenerationToolLegacyInput = { - name: string; - description: string; + name: string + description: string parameters?: { - type: "object" | (string & NonNullable); + type: 'object' | (string & NonNullable) properties: { [key: string]: { - type: string; - description?: string; - }; - }; - required: string[]; - }; -}; + type: string + description?: string + } + } + required: string[] + } +} type AiTextGenerationToolInput = { - type: "function" | (string & NonNullable); + type: 'function' | (string & NonNullable) function: { - name: string; - description: string; + name: string + description: string parameters?: { - type: "object" | (string & NonNullable); + type: 'object' | (string & NonNullable) properties: { [key: string]: { - type: string; - description?: string; - }; - }; - required: string[]; - }; - }; -}; + type: string + description?: string + } + } + required: string[] + } + } +} type AiTextGenerationFunctionsInput = { - name: string; - code: string; -}; + name: string + code: string +} type AiTextGenerationResponseFormat = { - type: string; - json_schema?: any; -}; + type: string + json_schema?: any +} type AiTextGenerationInput = { - prompt?: string; - raw?: boolean; - stream?: boolean; - max_tokens?: number; - temperature?: number; - top_p?: number; - top_k?: number; - seed?: number; - repetition_penalty?: number; - frequency_penalty?: number; - presence_penalty?: number; - messages?: RoleScopedChatInput[]; - response_format?: AiTextGenerationResponseFormat; - tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable); - functions?: AiTextGenerationFunctionsInput[]; -}; + prompt?: string + raw?: boolean + stream?: boolean + max_tokens?: number + temperature?: number + top_p?: number + top_k?: number + seed?: number + repetition_penalty?: number + frequency_penalty?: number + presence_penalty?: number + messages?: RoleScopedChatInput[] + response_format?: AiTextGenerationResponseFormat + tools?: + | AiTextGenerationToolInput[] + | AiTextGenerationToolLegacyInput[] + | (object & NonNullable) + functions?: AiTextGenerationFunctionsInput[] +} type AiTextGenerationOutput = { - response?: string; + response?: string tool_calls?: { - name: string; - arguments: unknown; - }[]; -}; + name: string + arguments: unknown + }[] +} declare abstract class BaseAiTextGeneration { - inputs: AiTextGenerationInput; - postProcessedOutputs: AiTextGenerationOutput; + inputs: AiTextGenerationInput + postProcessedOutputs: AiTextGenerationOutput } type AiTextToSpeechInput = { - prompt: string; - lang?: string; -}; -type AiTextToSpeechOutput = Uint8Array | { - audio: string; -}; + prompt: string + lang?: string +} +type AiTextToSpeechOutput = + | Uint8Array + | { + audio: string + } declare abstract class BaseAiTextToSpeech { - inputs: AiTextToSpeechInput; - postProcessedOutputs: AiTextToSpeechOutput; + inputs: AiTextToSpeechInput + postProcessedOutputs: AiTextToSpeechOutput } type AiTextToImageInput = { - prompt: string; - negative_prompt?: string; - height?: number; - width?: number; - image?: number[]; - image_b64?: string; - mask?: number[]; - num_steps?: number; - strength?: number; - guidance?: number; - seed?: number; -}; -type AiTextToImageOutput = ReadableStream; + prompt: string + negative_prompt?: string + height?: number + width?: number + image?: number[] + image_b64?: string + mask?: number[] + num_steps?: number + strength?: number + guidance?: number + seed?: number +} +type AiTextToImageOutput = ReadableStream declare abstract class BaseAiTextToImage { - inputs: AiTextToImageInput; - postProcessedOutputs: AiTextToImageOutput; + inputs: AiTextToImageInput + postProcessedOutputs: AiTextToImageOutput } type AiTranslationInput = { - text: string; - target_lang: string; - source_lang?: string; -}; + text: string + target_lang: string + source_lang?: string +} type AiTranslationOutput = { - translated_text?: string; -}; -declare abstract class BaseAiTranslation { - inputs: AiTranslationInput; - postProcessedOutputs: AiTranslationOutput; + translated_text?: string } -type Ai_Cf_Baai_Bge_Base_En_V1_5_Input = { - text: string | string[]; - /** - * 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. - */ - pooling?: "mean" | "cls"; -} | { - /** - * Batch of the embeddings requests to run using async-queue - */ - requests: { - text: string | string[]; - /** - * 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. - */ - pooling?: "mean" | "cls"; - }[]; -}; -type Ai_Cf_Baai_Bge_Base_En_V1_5_Output = { - shape?: number[]; - /** - * Embeddings of the requested text values - */ - data?: number[][]; - /** - * The pooling method used in the embedding process. - */ - pooling?: "mean" | "cls"; -} | AsyncResponse; +declare abstract class BaseAiTranslation { + inputs: AiTranslationInput + postProcessedOutputs: AiTranslationOutput +} +type Ai_Cf_Baai_Bge_Base_En_V1_5_Input = + | { + text: string | string[] + /** + * 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. + */ + pooling?: 'mean' | 'cls' + } + | { + /** + * Batch of the embeddings requests to run using async-queue + */ + requests: { + text: string | string[] + /** + * 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. + */ + pooling?: 'mean' | 'cls' + }[] + } +type Ai_Cf_Baai_Bge_Base_En_V1_5_Output = + | { + shape?: number[] + /** + * Embeddings of the requested text values + */ + data?: number[][] + /** + * The pooling method used in the embedding process. + */ + pooling?: 'mean' | 'cls' + } + | AsyncResponse interface AsyncResponse { /** * The async request id that can be used to obtain the results. */ - request_id?: string; + request_id?: string } declare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 { - inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input; - postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output; -} -type Ai_Cf_Openai_Whisper_Input = string | { - /** - * An array of integers that represent the audio data constrained to 8-bit unsigned integer values - */ - audio: number[]; -}; + inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input + postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output +} +type Ai_Cf_Openai_Whisper_Input = + | string + | { + /** + * An array of integers that represent the audio data constrained to 8-bit unsigned integer values + */ + audio: number[] + } interface Ai_Cf_Openai_Whisper_Output { /** * The transcription */ - text: string; - word_count?: number; + text: string + word_count?: number words?: { - word?: string; + word?: string /** * The second this word begins in the recording */ - start?: number; + start?: number /** * The ending second when the word completes */ - end?: number; - }[]; - vtt?: string; + end?: number + }[] + vtt?: string } declare abstract class Base_Ai_Cf_Openai_Whisper { - inputs: Ai_Cf_Openai_Whisper_Input; - postProcessedOutputs: Ai_Cf_Openai_Whisper_Output; -} -type Ai_Cf_Meta_M2M100_1_2B_Input = { - /** - * The text to be translated - */ - text: string; - /** - * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified - */ - source_lang?: string; - /** - * The language code to translate the text into (e.g., 'es' for Spanish) - */ - target_lang: string; -} | { - /** - * Batch of the embeddings requests to run using async-queue - */ - requests: { - /** - * The text to be translated - */ - text: string; - /** - * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified - */ - source_lang?: string; - /** - * The language code to translate the text into (e.g., 'es' for Spanish) - */ - target_lang: string; - }[]; -}; -type Ai_Cf_Meta_M2M100_1_2B_Output = { - /** - * The translated text in the target language - */ - translated_text?: string; -} | AsyncResponse; + inputs: Ai_Cf_Openai_Whisper_Input + postProcessedOutputs: Ai_Cf_Openai_Whisper_Output +} +type Ai_Cf_Meta_M2M100_1_2B_Input = + | { + /** + * The text to be translated + */ + text: string + /** + * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified + */ + source_lang?: string + /** + * The language code to translate the text into (e.g., 'es' for Spanish) + */ + target_lang: string + } + | { + /** + * Batch of the embeddings requests to run using async-queue + */ + requests: { + /** + * The text to be translated + */ + text: string + /** + * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified + */ + source_lang?: string + /** + * The language code to translate the text into (e.g., 'es' for Spanish) + */ + target_lang: string + }[] + } +type Ai_Cf_Meta_M2M100_1_2B_Output = + | { + /** + * The translated text in the target language + */ + translated_text?: string + } + | AsyncResponse declare abstract class Base_Ai_Cf_Meta_M2M100_1_2B { - inputs: Ai_Cf_Meta_M2M100_1_2B_Input; - postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output; -} -type Ai_Cf_Baai_Bge_Small_En_V1_5_Input = { - text: string | string[]; - /** - * 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. - */ - pooling?: "mean" | "cls"; -} | { - /** - * Batch of the embeddings requests to run using async-queue - */ - requests: { - text: string | string[]; - /** - * 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. - */ - pooling?: "mean" | "cls"; - }[]; -}; -type Ai_Cf_Baai_Bge_Small_En_V1_5_Output = { - shape?: number[]; - /** - * Embeddings of the requested text values - */ - data?: number[][]; - /** - * The pooling method used in the embedding process. - */ - pooling?: "mean" | "cls"; -} | AsyncResponse; + inputs: Ai_Cf_Meta_M2M100_1_2B_Input + postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output +} +type Ai_Cf_Baai_Bge_Small_En_V1_5_Input = + | { + text: string | string[] + /** + * 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. + */ + pooling?: 'mean' | 'cls' + } + | { + /** + * Batch of the embeddings requests to run using async-queue + */ + requests: { + text: string | string[] + /** + * 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. + */ + pooling?: 'mean' | 'cls' + }[] + } +type Ai_Cf_Baai_Bge_Small_En_V1_5_Output = + | { + shape?: number[] + /** + * Embeddings of the requested text values + */ + data?: number[][] + /** + * The pooling method used in the embedding process. + */ + pooling?: 'mean' | 'cls' + } + | AsyncResponse declare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 { - inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input; - postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output; -} -type Ai_Cf_Baai_Bge_Large_En_V1_5_Input = { - text: string | string[]; - /** - * 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. - */ - pooling?: "mean" | "cls"; -} | { - /** - * Batch of the embeddings requests to run using async-queue - */ - requests: { - text: string | string[]; - /** - * 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. - */ - pooling?: "mean" | "cls"; - }[]; -}; -type Ai_Cf_Baai_Bge_Large_En_V1_5_Output = { - shape?: number[]; - /** - * Embeddings of the requested text values - */ - data?: number[][]; - /** - * The pooling method used in the embedding process. - */ - pooling?: "mean" | "cls"; -} | AsyncResponse; + inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input + postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output +} +type Ai_Cf_Baai_Bge_Large_En_V1_5_Input = + | { + text: string | string[] + /** + * 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. + */ + pooling?: 'mean' | 'cls' + } + | { + /** + * Batch of the embeddings requests to run using async-queue + */ + requests: { + text: string | string[] + /** + * 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. + */ + pooling?: 'mean' | 'cls' + }[] + } +type Ai_Cf_Baai_Bge_Large_En_V1_5_Output = + | { + shape?: number[] + /** + * Embeddings of the requested text values + */ + data?: number[][] + /** + * The pooling method used in the embedding process. + */ + pooling?: 'mean' | 'cls' + } + | AsyncResponse declare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 { - inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input; - postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output; -} -type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | { - /** - * The input text prompt for the model to generate a response. - */ - prompt?: string; - /** - * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. - */ - raw?: boolean; - /** - * 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. - */ - top_p?: number; - /** - * 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. - */ - top_k?: number; - /** - * Random seed for reproducibility of the generation. - */ - seed?: number; - /** - * Penalty for repeated tokens; higher values discourage repetition. - */ - repetition_penalty?: number; - /** - * Decreases the likelihood of the model repeating the same lines verbatim. - */ - frequency_penalty?: number; - /** - * Increases the likelihood of the model introducing new topics. - */ - presence_penalty?: number; - image: number[] | (string & NonNullable); - /** - * The maximum number of tokens to generate in the response. - */ - max_tokens?: number; -}; + inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input + postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output +} +type Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = + | string + | { + /** + * The input text prompt for the model to generate a response. + */ + prompt?: string + /** + * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + */ + raw?: boolean + /** + * 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. + */ + top_p?: number + /** + * 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. + */ + top_k?: number + /** + * Random seed for reproducibility of the generation. + */ + seed?: number + /** + * Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number + /** + * Decreases the likelihood of the model repeating the same lines verbatim. + */ + frequency_penalty?: number + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number + image: number[] | (string & NonNullable) + /** + * The maximum number of tokens to generate in the response. + */ + max_tokens?: number + } interface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output { - description?: string; + description?: string } declare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M { - inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input; - postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output; -} -type Ai_Cf_Openai_Whisper_Tiny_En_Input = string | { - /** - * An array of integers that represent the audio data constrained to 8-bit unsigned integer values - */ - audio: number[]; -}; + inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input + postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output +} +type Ai_Cf_Openai_Whisper_Tiny_En_Input = + | string + | { + /** + * An array of integers that represent the audio data constrained to 8-bit unsigned integer values + */ + audio: number[] + } interface Ai_Cf_Openai_Whisper_Tiny_En_Output { /** * The transcription */ - text: string; - word_count?: number; + text: string + word_count?: number words?: { - word?: string; + word?: string /** * The second this word begins in the recording */ - start?: number; + start?: number /** * The ending second when the word completes */ - end?: number; - }[]; - vtt?: string; + end?: number + }[] + vtt?: string } declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En { - inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input; - postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output; + inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input + postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output } interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input { /** * Base64 encoded value of the audio data. */ - audio: string; + audio: string /** * Supported tasks are 'translate' or 'transcribe'. */ - task?: string; + task?: string /** * The language of the audio being transcribed or translated. */ - language?: string; + language?: string /** * Preprocess the audio with a voice activity detection model. */ - vad_filter?: boolean; + vad_filter?: boolean /** * A text prompt to help provide context to the model on the contents of the audio. */ - initial_prompt?: string; + initial_prompt?: string /** * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result. */ - prefix?: string; + prefix?: string } interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output { transcription_info?: { /** * The language of the audio being transcribed or translated. */ - language?: string; + language?: string /** * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1. */ - language_probability?: number; + language_probability?: number /** * The total duration of the original audio file, in seconds. */ - duration?: number; + duration?: number /** * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds. */ - duration_after_vad?: number; - }; + duration_after_vad?: number + } /** * The complete transcription of the audio. */ - text: string; + text: string /** * The total number of words in the transcription. */ - word_count?: number; + word_count?: number segments?: { /** * The starting time of the segment within the audio, in seconds. */ - start?: number; + start?: number /** * The ending time of the segment within the audio, in seconds. */ - end?: number; + end?: number /** * The transcription of the segment. */ - text?: string; + text?: string /** * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs. */ - temperature?: number; + temperature?: number /** * The average log probability of the predictions for the words in this segment, indicating overall confidence. */ - avg_logprob?: number; + avg_logprob?: number /** * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process. */ - compression_ratio?: number; + compression_ratio?: number /** * The probability that the segment contains no speech, represented as a decimal between 0 and 1. */ - no_speech_prob?: number; + no_speech_prob?: number words?: { /** * The individual word transcribed from the audio. */ - word?: string; + word?: string /** * The starting time of the word within the audio, in seconds. */ - start?: number; + start?: number /** * The ending time of the word within the audio, in seconds. */ - end?: number; - }[]; - }[]; + end?: number + }[] + }[] /** * The transcription in WebVTT format, which includes timing and text information for use in subtitles. */ - vtt?: string; + vtt?: string } declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo { - inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input; - postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output; -} -type Ai_Cf_Baai_Bge_M3_Input = BGEM3InputQueryAndContexts | BGEM3InputEmbedding | { - /** - * Batch of the embeddings requests to run using async-queue - */ - requests: (BGEM3InputQueryAndContexts1 | BGEM3InputEmbedding1)[]; -}; + inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input + postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output +} +type Ai_Cf_Baai_Bge_M3_Input = + | BGEM3InputQueryAndContexts + | BGEM3InputEmbedding + | { + /** + * Batch of the embeddings requests to run using async-queue + */ + requests: (BGEM3InputQueryAndContexts1 | BGEM3InputEmbedding1)[] + } interface BGEM3InputQueryAndContexts { /** * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts */ - query?: string; + query?: string /** * List of provided contexts. Note that the index in this array is important, as the response will refer to it. */ @@ -3169,25 +3780,25 @@ interface BGEM3InputQueryAndContexts { /** * One of the provided context content */ - text?: string; - }[]; + text?: string + }[] /** * When provided with too long context should the model error out or truncate the context to fit? */ - truncate_inputs?: boolean; + truncate_inputs?: boolean } interface BGEM3InputEmbedding { - text: string | string[]; + text: string | string[] /** * When provided with too long context should the model error out or truncate the context to fit? */ - truncate_inputs?: boolean; + truncate_inputs?: boolean } interface BGEM3InputQueryAndContexts1 { /** * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts */ - query?: string; + query?: string /** * List of provided contexts. Note that the index in this array is important, as the response will refer to it. */ @@ -3195,127 +3806,131 @@ interface BGEM3InputQueryAndContexts1 { /** * One of the provided context content */ - text?: string; - }[]; + text?: string + }[] /** * When provided with too long context should the model error out or truncate the context to fit? */ - truncate_inputs?: boolean; + truncate_inputs?: boolean } interface BGEM3InputEmbedding1 { - text: string | string[]; + text: string | string[] /** * When provided with too long context should the model error out or truncate the context to fit? */ - truncate_inputs?: boolean; + truncate_inputs?: boolean } -type Ai_Cf_Baai_Bge_M3_Output = BGEM3OuputQuery | BGEM3OutputEmbeddingForContexts | BGEM3OuputEmbedding | AsyncResponse; +type Ai_Cf_Baai_Bge_M3_Output = + | BGEM3OuputQuery + | BGEM3OutputEmbeddingForContexts + | BGEM3OuputEmbedding + | AsyncResponse interface BGEM3OuputQuery { response?: { /** * Index of the context in the request */ - id?: number; + id?: number /** * Score of the context under the index. */ - score?: number; - }[]; + score?: number + }[] } interface BGEM3OutputEmbeddingForContexts { - response?: number[][]; - shape?: number[]; + response?: number[][] + shape?: number[] /** * The pooling method used in the embedding process. */ - pooling?: "mean" | "cls"; + pooling?: 'mean' | 'cls' } interface BGEM3OuputEmbedding { - shape?: number[]; + shape?: number[] /** * Embeddings of the requested text values */ - data?: number[][]; + data?: number[][] /** * The pooling method used in the embedding process. */ - pooling?: "mean" | "cls"; + pooling?: 'mean' | 'cls' } declare abstract class Base_Ai_Cf_Baai_Bge_M3 { - inputs: Ai_Cf_Baai_Bge_M3_Input; - postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output; + inputs: Ai_Cf_Baai_Bge_M3_Input + postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output } interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input { /** * A text description of the image you want to generate. */ - prompt: string; + prompt: string /** * The number of diffusion steps; higher values can improve quality but take longer. */ - steps?: number; + steps?: number } interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output { /** * The generated image in Base64 format. */ - image?: string; + image?: string } declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell { - inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input; - postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output; + inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input + postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output } -type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages; +type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages interface Prompt { /** * The input text prompt for the model to generate a response. */ - prompt: string; - image?: number[] | (string & NonNullable); + prompt: string + image?: number[] | (string & NonNullable) /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number /** * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. */ - lora?: string; + lora?: string } interface Messages { /** @@ -3325,171 +3940,177 @@ interface Messages { /** * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). */ - role?: string; + role?: string /** * 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 */ - tool_call_id?: string; - content?: string | { - /** - * Type of the content provided - */ - type?: string; - text?: string; - image_url?: { - /** - * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted - */ - url?: string; - }; - }[] | { - /** - * Type of the content provided - */ - type?: string; - text?: string; - image_url?: { - /** - * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted - */ - url?: string; - }; - }; - }[]; - image?: number[] | (string & NonNullable); + tool_call_id?: string + content?: + | string + | { + /** + * Type of the content provided + */ + type?: string + text?: string + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string + } + }[] + | { + /** + * Type of the content provided + */ + type?: string + text?: string + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string + } + } + }[] + image?: number[] | (string & NonNullable) functions?: { - name: string; - code: string; - }[]; + name: string + code: string + }[] /** * A list of tools available for the assistant to use. */ - tools?: ({ - /** - * The name of the tool. More descriptive the better. - */ - name: string; - /** - * A brief description of what the tool does. - */ - description: string; - /** - * Schema defining the parameters accepted by the tool. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - } | { - /** - * Specifies the type of tool (e.g., 'function'). - */ - type: string; - /** - * Details of the function tool. - */ - function: { - /** - * The name of the function. - */ - name: string; - /** - * A brief description of what the function does. - */ - description: string; - /** - * Schema defining the parameters accepted by the function. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - }; - })[]; + tools?: ( + | { + /** + * The name of the tool. More descriptive the better. + */ + name: string + /** + * A brief description of what the tool does. + */ + description: string + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string + /** + * A brief description of what the function does. + */ + description: string + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + } + )[] /** * If true, the response will be streamed back incrementally. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = { /** * The generated text response from the model */ - response?: string; + response?: string /** * An array of tool calls requests made during the response generation */ @@ -3497,72 +4118,75 @@ type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = { /** * The arguments passed to be passed to the tool call request */ - arguments?: object; + arguments?: object /** * The name of the tool to be called */ - name?: string; - }[]; -}; + name?: string + }[] +} declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct { - inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input; - postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output; + inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input + postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output } -type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt | Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages | AsyncBatch; +type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = + | Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt + | Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages + | AsyncBatch interface Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt { /** * The input text prompt for the model to generate a response. */ - prompt: string; + prompt: string /** * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. */ - lora?: string; - response_format?: JSONMode; + lora?: string + response_format?: JSONMode /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } interface JSONMode { - type?: "json_object" | "json_schema"; - json_schema?: unknown; + type?: 'json_object' | 'json_schema' + json_schema?: unknown } interface Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages { /** @@ -3572,229 +4196,234 @@ interface Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages { /** * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). */ - role: string; + role: string /** * The content of the message as a string. */ - content: string; - }[]; + content: string + }[] functions?: { - name: string; - code: string; - }[]; + name: string + code: string + }[] /** * A list of tools available for the assistant to use. */ - tools?: ({ - /** - * The name of the tool. More descriptive the better. - */ - name: string; - /** - * A brief description of what the tool does. - */ - description: string; - /** - * Schema defining the parameters accepted by the tool. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - } | { - /** - * Specifies the type of tool (e.g., 'function'). - */ - type: string; - /** - * Details of the function tool. - */ - function: { - /** - * The name of the function. - */ - name: string; - /** - * A brief description of what the function does. - */ - description: string; - /** - * Schema defining the parameters accepted by the function. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - }; - })[]; - response_format?: JSONMode; + tools?: ( + | { + /** + * The name of the tool. More descriptive the better. + */ + name: string + /** + * A brief description of what the tool does. + */ + description: string + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string + /** + * A brief description of what the function does. + */ + description: string + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + } + )[] + response_format?: JSONMode /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } interface AsyncBatch { requests?: { /** * 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. */ - external_reference?: string; + external_reference?: string /** * Prompt for the text generation model */ - prompt?: string; + prompt?: string /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; - /** - * Penalty for repeated tokens; higher values discourage repetition. - */ - repetition_penalty?: number; - /** - * Decreases the likelihood of the model repeating the same lines verbatim. - */ - frequency_penalty?: number; - /** - * Increases the likelihood of the model introducing new topics. - */ - presence_penalty?: number; - response_format?: JSONMode; - }[]; -} -type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = { - /** - * The generated text response from the model - */ - response: string; - /** - * Usage statistics for the inference request - */ - usage?: { - /** - * Total number of tokens in input - */ - prompt_tokens?: number; - /** - * Total number of tokens in output - */ - completion_tokens?: number; - /** - * Total number of input and output tokens - */ - total_tokens?: number; - }; - /** - * An array of tool calls requests made during the response generation - */ - tool_calls?: { + seed?: number /** - * The arguments passed to be passed to the tool call request + * Penalty for repeated tokens; higher values discourage repetition. */ - arguments?: object; + repetition_penalty?: number /** - * The name of the tool to be called + * Decreases the likelihood of the model repeating the same lines verbatim. */ - name?: string; - }[]; -} | AsyncResponse; + frequency_penalty?: number + /** + * Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number + response_format?: JSONMode + }[] +} +type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = + | { + /** + * The generated text response from the model + */ + response: string + /** + * Usage statistics for the inference request + */ + usage?: { + /** + * Total number of tokens in input + */ + prompt_tokens?: number + /** + * Total number of tokens in output + */ + completion_tokens?: number + /** + * Total number of input and output tokens + */ + total_tokens?: number + } + /** + * An array of tool calls requests made during the response generation + */ + tool_calls?: { + /** + * The arguments passed to be passed to the tool call request + */ + arguments?: object + /** + * The name of the tool to be called + */ + name?: string + }[] + } + | AsyncResponse declare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast { - inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input; - postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output; + inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input + postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output } interface Ai_Cf_Meta_Llama_Guard_3_8B_Input { /** @@ -3804,20 +4433,20 @@ interface Ai_Cf_Meta_Llama_Guard_3_8B_Input { /** * The role of the message sender must alternate between 'user' and 'assistant'. */ - role: "user" | "assistant"; + role: 'user' | 'assistant' /** * The content of the message as a string. */ - content: string; - }[]; + content: string + }[] /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * Dictate the output format of the generated response. */ @@ -3825,20 +4454,22 @@ interface Ai_Cf_Meta_Llama_Guard_3_8B_Input { /** * Set to json_object to process and output generated text as JSON. */ - type?: string; - }; + type?: string + } } interface Ai_Cf_Meta_Llama_Guard_3_8B_Output { - response?: string | { - /** - * Whether the conversation is safe or not. - */ - safe?: boolean; - /** - * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe. - */ - categories?: string[]; - }; + response?: + | string + | { + /** + * Whether the conversation is safe or not. + */ + safe?: boolean + /** + * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe. + */ + categories?: string[] + } /** * Usage statistics for the inference request */ @@ -3846,30 +4477,30 @@ interface Ai_Cf_Meta_Llama_Guard_3_8B_Output { /** * Total number of tokens in input */ - prompt_tokens?: number; + prompt_tokens?: number /** * Total number of tokens in output */ - completion_tokens?: number; + completion_tokens?: number /** * Total number of input and output tokens */ - total_tokens?: number; - }; + total_tokens?: number + } } declare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B { - inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input; - postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output; + inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input + postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output } interface Ai_Cf_Baai_Bge_Reranker_Base_Input { /** * A query you wish to perform against the provided contexts. */ - query: string; + query: string /** * Number of returned results starting with the best score. */ - top_k?: number; + top_k?: number /** * List of provided contexts. Note that the index in this array is important, as the response will refer to it. */ @@ -3877,76 +4508,78 @@ interface Ai_Cf_Baai_Bge_Reranker_Base_Input { /** * One of the provided context content */ - text?: string; - }[]; + text?: string + }[] } interface Ai_Cf_Baai_Bge_Reranker_Base_Output { response?: { /** * Index of the context in the request */ - id?: number; + id?: number /** * Score of the context under the index. */ - score?: number; - }[]; + score?: number + }[] } declare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base { - inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input; - postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output; + inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input + postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output } -type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Qwen2_5_Coder_32B_Instruct_Prompt | Qwen2_5_Coder_32B_Instruct_Messages; +type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = + | Qwen2_5_Coder_32B_Instruct_Prompt + | Qwen2_5_Coder_32B_Instruct_Messages interface Qwen2_5_Coder_32B_Instruct_Prompt { /** * The input text prompt for the model to generate a response. */ - prompt: string; + prompt: string /** * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. */ - lora?: string; - response_format?: JSONMode; + lora?: string + response_format?: JSONMode /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } interface Qwen2_5_Coder_32B_Instruct_Messages { /** @@ -3956,150 +4589,153 @@ interface Qwen2_5_Coder_32B_Instruct_Messages { /** * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). */ - role: string; + role: string /** * The content of the message as a string. */ - content: string; - }[]; + content: string + }[] functions?: { - name: string; - code: string; - }[]; + name: string + code: string + }[] /** * A list of tools available for the assistant to use. */ - tools?: ({ - /** - * The name of the tool. More descriptive the better. - */ - name: string; - /** - * A brief description of what the tool does. - */ - description: string; - /** - * Schema defining the parameters accepted by the tool. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - } | { - /** - * Specifies the type of tool (e.g., 'function'). - */ - type: string; - /** - * Details of the function tool. - */ - function: { - /** - * The name of the function. - */ - name: string; - /** - * A brief description of what the function does. - */ - description: string; - /** - * Schema defining the parameters accepted by the function. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - }; - })[]; - response_format?: JSONMode; + tools?: ( + | { + /** + * The name of the tool. More descriptive the better. + */ + name: string + /** + * A brief description of what the tool does. + */ + description: string + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string + /** + * A brief description of what the function does. + */ + description: string + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + } + )[] + response_format?: JSONMode /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = { /** * The generated text response from the model */ - response: string; + response: string /** * Usage statistics for the inference request */ @@ -4107,16 +4743,16 @@ type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = { /** * Total number of tokens in input */ - prompt_tokens?: number; + prompt_tokens?: number /** * Total number of tokens in output */ - completion_tokens?: number; + completion_tokens?: number /** * Total number of input and output tokens */ - total_tokens?: number; - }; + total_tokens?: number + } /** * An array of tool calls requests made during the response generation */ @@ -4124,67 +4760,67 @@ type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = { /** * The arguments passed to be passed to the tool call request */ - arguments?: object; + arguments?: object /** * The name of the tool to be called */ - name?: string; - }[]; -}; + name?: string + }[] +} declare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct { - inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input; - postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output; + inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input + postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output } -type Ai_Cf_Qwen_Qwq_32B_Input = Qwen_Qwq_32B_Prompt | Qwen_Qwq_32B_Messages; +type Ai_Cf_Qwen_Qwq_32B_Input = Qwen_Qwq_32B_Prompt | Qwen_Qwq_32B_Messages interface Qwen_Qwq_32B_Prompt { /** * The input text prompt for the model to generate a response. */ - prompt: string; + prompt: string /** * JSON schema that should be fulfilled for the response. */ - guided_json?: object; + guided_json?: object /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } interface Qwen_Qwq_32B_Messages { /** @@ -4194,178 +4830,184 @@ interface Qwen_Qwq_32B_Messages { /** * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). */ - role?: string; + role?: string /** * 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 */ - tool_call_id?: string; - content?: string | { - /** - * Type of the content provided - */ - type?: string; - text?: string; - image_url?: { - /** - * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted - */ - url?: string; - }; - }[] | { - /** - * Type of the content provided - */ - type?: string; - text?: string; - image_url?: { - /** - * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted - */ - url?: string; - }; - }; - }[]; + tool_call_id?: string + content?: + | string + | { + /** + * Type of the content provided + */ + type?: string + text?: string + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string + } + }[] + | { + /** + * Type of the content provided + */ + type?: string + text?: string + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string + } + } + }[] functions?: { - name: string; - code: string; - }[]; + name: string + code: string + }[] /** * A list of tools available for the assistant to use. */ - tools?: ({ - /** - * The name of the tool. More descriptive the better. - */ - name: string; - /** - * A brief description of what the tool does. - */ - description: string; - /** - * Schema defining the parameters accepted by the tool. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - } | { - /** - * Specifies the type of tool (e.g., 'function'). - */ - type: string; - /** - * Details of the function tool. - */ - function: { - /** - * The name of the function. - */ - name: string; - /** - * A brief description of what the function does. - */ - description: string; - /** - * Schema defining the parameters accepted by the function. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - }; - })[]; + tools?: ( + | { + /** + * The name of the tool. More descriptive the better. + */ + name: string + /** + * A brief description of what the tool does. + */ + description: string + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string + /** + * A brief description of what the function does. + */ + description: string + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + } + )[] /** * JSON schema that should be fufilled for the response. */ - guided_json?: object; + guided_json?: object /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } type Ai_Cf_Qwen_Qwq_32B_Output = { /** * The generated text response from the model */ - response: string; + response: string /** * Usage statistics for the inference request */ @@ -4373,16 +5015,16 @@ type Ai_Cf_Qwen_Qwq_32B_Output = { /** * Total number of tokens in input */ - prompt_tokens?: number; + prompt_tokens?: number /** * Total number of tokens in output */ - completion_tokens?: number; + completion_tokens?: number /** * Total number of input and output tokens */ - total_tokens?: number; - }; + total_tokens?: number + } /** * An array of tool calls requests made during the response generation */ @@ -4390,67 +5032,69 @@ type Ai_Cf_Qwen_Qwq_32B_Output = { /** * The arguments passed to be passed to the tool call request */ - arguments?: object; + arguments?: object /** * The name of the tool to be called */ - name?: string; - }[]; -}; + name?: string + }[] +} declare abstract class Base_Ai_Cf_Qwen_Qwq_32B { - inputs: Ai_Cf_Qwen_Qwq_32B_Input; - postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output; + inputs: Ai_Cf_Qwen_Qwq_32B_Input + postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output } -type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = Mistral_Small_3_1_24B_Instruct_Prompt | Mistral_Small_3_1_24B_Instruct_Messages; +type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = + | Mistral_Small_3_1_24B_Instruct_Prompt + | Mistral_Small_3_1_24B_Instruct_Messages interface Mistral_Small_3_1_24B_Instruct_Prompt { /** * The input text prompt for the model to generate a response. */ - prompt: string; + prompt: string /** * JSON schema that should be fulfilled for the response. */ - guided_json?: object; + guided_json?: object /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } interface Mistral_Small_3_1_24B_Instruct_Messages { /** @@ -4460,178 +5104,184 @@ interface Mistral_Small_3_1_24B_Instruct_Messages { /** * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). */ - role?: string; + role?: string /** * 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 */ - tool_call_id?: string; - content?: string | { - /** - * Type of the content provided - */ - type?: string; - text?: string; - image_url?: { - /** - * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted - */ - url?: string; - }; - }[] | { - /** - * Type of the content provided - */ - type?: string; - text?: string; - image_url?: { - /** - * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted - */ - url?: string; - }; - }; - }[]; + tool_call_id?: string + content?: + | string + | { + /** + * Type of the content provided + */ + type?: string + text?: string + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string + } + }[] + | { + /** + * Type of the content provided + */ + type?: string + text?: string + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string + } + } + }[] functions?: { - name: string; - code: string; - }[]; + name: string + code: string + }[] /** * A list of tools available for the assistant to use. */ - tools?: ({ - /** - * The name of the tool. More descriptive the better. - */ - name: string; - /** - * A brief description of what the tool does. - */ - description: string; - /** - * Schema defining the parameters accepted by the tool. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - } | { - /** - * Specifies the type of tool (e.g., 'function'). - */ - type: string; - /** - * Details of the function tool. - */ - function: { - /** - * The name of the function. - */ - name: string; - /** - * A brief description of what the function does. - */ - description: string; - /** - * Schema defining the parameters accepted by the function. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - }; - })[]; + tools?: ( + | { + /** + * The name of the tool. More descriptive the better. + */ + name: string + /** + * A brief description of what the tool does. + */ + description: string + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string + /** + * A brief description of what the function does. + */ + description: string + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + } + )[] /** * JSON schema that should be fufilled for the response. */ - guided_json?: object; + guided_json?: object /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = { /** * The generated text response from the model */ - response: string; + response: string /** * Usage statistics for the inference request */ @@ -4639,16 +5289,16 @@ type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = { /** * Total number of tokens in input */ - prompt_tokens?: number; + prompt_tokens?: number /** * Total number of tokens in output */ - completion_tokens?: number; + completion_tokens?: number /** * Total number of input and output tokens */ - total_tokens?: number; - }; + total_tokens?: number + } /** * An array of tool calls requests made during the response generation */ @@ -4656,67 +5306,69 @@ type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = { /** * The arguments passed to be passed to the tool call request */ - arguments?: object; + arguments?: object /** * The name of the tool to be called */ - name?: string; - }[]; -}; + name?: string + }[] +} declare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct { - inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input; - postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output; + inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input + postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output } -type Ai_Cf_Google_Gemma_3_12B_It_Input = Google_Gemma_3_12B_It_Prompt | Google_Gemma_3_12B_It_Messages; +type Ai_Cf_Google_Gemma_3_12B_It_Input = + | Google_Gemma_3_12B_It_Prompt + | Google_Gemma_3_12B_It_Messages interface Google_Gemma_3_12B_It_Prompt { /** * The input text prompt for the model to generate a response. */ - prompt: string; + prompt: string /** * JSON schema that should be fufilled for the response. */ - guided_json?: object; + guided_json?: object /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } interface Google_Gemma_3_12B_It_Messages { /** @@ -4726,174 +5378,180 @@ interface Google_Gemma_3_12B_It_Messages { /** * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). */ - role?: string; - content?: string | { - /** - * Type of the content provided - */ - type?: string; - text?: string; - image_url?: { - /** - * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted - */ - url?: string; - }; - }[] | { - /** - * Type of the content provided - */ - type?: string; - text?: string; - image_url?: { - /** - * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted - */ - url?: string; - }; - }; - }[]; + role?: string + content?: + | string + | { + /** + * Type of the content provided + */ + type?: string + text?: string + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string + } + }[] + | { + /** + * Type of the content provided + */ + type?: string + text?: string + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string + } + } + }[] functions?: { - name: string; - code: string; - }[]; + name: string + code: string + }[] /** * A list of tools available for the assistant to use. */ - tools?: ({ - /** - * The name of the tool. More descriptive the better. - */ - name: string; - /** - * A brief description of what the tool does. - */ - description: string; - /** - * Schema defining the parameters accepted by the tool. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - } | { - /** - * Specifies the type of tool (e.g., 'function'). - */ - type: string; - /** - * Details of the function tool. - */ - function: { - /** - * The name of the function. - */ - name: string; - /** - * A brief description of what the function does. - */ - description: string; - /** - * Schema defining the parameters accepted by the function. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - }; - })[]; + tools?: ( + | { + /** + * The name of the tool. More descriptive the better. + */ + name: string + /** + * A brief description of what the tool does. + */ + description: string + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string + /** + * A brief description of what the function does. + */ + description: string + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + } + )[] /** * JSON schema that should be fufilled for the response. */ - guided_json?: object; + guided_json?: object /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } type Ai_Cf_Google_Gemma_3_12B_It_Output = { /** * The generated text response from the model */ - response: string; + response: string /** * Usage statistics for the inference request */ @@ -4901,16 +5559,16 @@ type Ai_Cf_Google_Gemma_3_12B_It_Output = { /** * Total number of tokens in input */ - prompt_tokens?: number; + prompt_tokens?: number /** * Total number of tokens in output */ - completion_tokens?: number; + completion_tokens?: number /** * Total number of input and output tokens */ - total_tokens?: number; - }; + total_tokens?: number + } /** * An array of tool calls requests made during the response generation */ @@ -4918,68 +5576,70 @@ type Ai_Cf_Google_Gemma_3_12B_It_Output = { /** * The arguments passed to be passed to the tool call request */ - arguments?: object; + arguments?: object /** * The name of the tool to be called */ - name?: string; - }[]; -}; + name?: string + }[] +} declare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It { - inputs: Ai_Cf_Google_Gemma_3_12B_It_Input; - postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output; + inputs: Ai_Cf_Google_Gemma_3_12B_It_Input + postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output } -type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_4_Prompt | Ai_Cf_Meta_Llama_4_Messages; +type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = + | Ai_Cf_Meta_Llama_4_Prompt + | Ai_Cf_Meta_Llama_4_Messages interface Ai_Cf_Meta_Llama_4_Prompt { /** * The input text prompt for the model to generate a response. */ - prompt: string; + prompt: string /** * JSON schema that should be fulfilled for the response. */ - guided_json?: object; - response_format?: JSONMode; + guided_json?: object + response_format?: JSONMode /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } interface Ai_Cf_Meta_Llama_4_Messages { /** @@ -4989,179 +5649,185 @@ interface Ai_Cf_Meta_Llama_4_Messages { /** * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). */ - role?: string; + role?: string /** * The tool call id. If you don't know what to put here you can fall back to 000000001 */ - tool_call_id?: string; - content?: string | { - /** - * Type of the content provided - */ - type?: string; - text?: string; - image_url?: { - /** - * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted - */ - url?: string; - }; - }[] | { - /** - * Type of the content provided - */ - type?: string; - text?: string; - image_url?: { - /** - * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted - */ - url?: string; - }; - }; - }[]; + tool_call_id?: string + content?: + | string + | { + /** + * Type of the content provided + */ + type?: string + text?: string + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string + } + }[] + | { + /** + * Type of the content provided + */ + type?: string + text?: string + image_url?: { + /** + * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted + */ + url?: string + } + } + }[] functions?: { - name: string; - code: string; - }[]; + name: string + code: string + }[] /** * A list of tools available for the assistant to use. */ - tools?: ({ - /** - * The name of the tool. More descriptive the better. - */ - name: string; - /** - * A brief description of what the tool does. - */ - description: string; - /** - * Schema defining the parameters accepted by the tool. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - } | { - /** - * Specifies the type of tool (e.g., 'function'). - */ - type: string; - /** - * Details of the function tool. - */ - function: { - /** - * The name of the function. - */ - name: string; - /** - * A brief description of what the function does. - */ - description: string; - /** - * Schema defining the parameters accepted by the function. - */ - parameters: { - /** - * The type of the parameters object (usually 'object'). - */ - type: string; - /** - * List of required parameter names. - */ - required?: string[]; - /** - * Definitions of each parameter. - */ - properties: { - [k: string]: { - /** - * The data type of the parameter. - */ - type: string; - /** - * A description of the expected parameter. - */ - description: string; - }; - }; - }; - }; - })[]; - response_format?: JSONMode; + tools?: ( + | { + /** + * The name of the tool. More descriptive the better. + */ + name: string + /** + * A brief description of what the tool does. + */ + description: string + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + | { + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string + /** + * Details of the function tool. + */ + function: { + /** + * The name of the function. + */ + name: string + /** + * A brief description of what the function does. + */ + description: string + /** + * Schema defining the parameters accepted by the function. + */ + parameters: { + /** + * The type of the parameters object (usually 'object'). + */ + type: string + /** + * List of required parameter names. + */ + required?: string[] + /** + * Definitions of each parameter. + */ + properties: { + [k: string]: { + /** + * The data type of the parameter. + */ + type: string + /** + * A description of the expected parameter. + */ + description: string + } + } + } + } + } + )[] + response_format?: JSONMode /** * JSON schema that should be fufilled for the response. */ - guided_json?: object; + guided_json?: object /** * If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ - raw?: boolean; + raw?: boolean /** * If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ - stream?: boolean; + stream?: boolean /** * The maximum number of tokens to generate in the response. */ - max_tokens?: number; + max_tokens?: number /** * Controls the randomness of the output; higher values produce more random results. */ - temperature?: number; + temperature?: number /** * 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. */ - top_p?: number; + top_p?: number /** * 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. */ - top_k?: number; + top_k?: number /** * Random seed for reproducibility of the generation. */ - seed?: number; + seed?: number /** * Penalty for repeated tokens; higher values discourage repetition. */ - repetition_penalty?: number; + repetition_penalty?: number /** * Decreases the likelihood of the model repeating the same lines verbatim. */ - frequency_penalty?: number; + frequency_penalty?: number /** * Increases the likelihood of the model introducing new topics. */ - presence_penalty?: number; + presence_penalty?: number } type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = { /** * The generated text response from the model */ - response: string; + response: string /** * Usage statistics for the inference request */ @@ -5169,16 +5835,16 @@ type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = { /** * Total number of tokens in input */ - prompt_tokens?: number; + prompt_tokens?: number /** * Total number of tokens in output */ - completion_tokens?: number; + completion_tokens?: number /** * Total number of input and output tokens */ - total_tokens?: number; - }; + total_tokens?: number + } /** * An array of tool calls requests made during the response generation */ @@ -5186,11 +5852,11 @@ type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = { /** * The tool call id. */ - id?: string; + id?: string /** * Specifies the type of tool (e.g., 'function'). */ - type?: string; + type?: string /** * Details of the function tool. */ @@ -5198,329 +5864,374 @@ type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = { /** * The name of the tool to be called */ - name?: string; + name?: string /** * The arguments passed to be passed to the tool call request */ - arguments?: object; - }; - }[]; -}; + arguments?: object + } + }[] +} declare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct { - inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input; - postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output; + inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input + postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output } interface AiModels { - "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification; - "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage; - "@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage; - "@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage; - "@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage; - "@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage; - "@cf/myshell-ai/melotts": BaseAiTextToSpeech; - "@cf/microsoft/resnet-50": BaseAiImageClassification; - "@cf/facebook/detr-resnet-50": BaseAiObjectDetection; - "@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration; - "@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration; - "@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration; - "@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration; - "@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration; - "@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration; - "@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration; - "@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration; - "@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration; - "@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration; - "@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration; - "@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration; - "@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration; - "@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration; - "@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration; - "@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration; - "@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration; - "@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration; - "@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration; - "@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration; - "@cf/microsoft/phi-2": BaseAiTextGeneration; - "@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration; - "@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration; - "@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration; - "@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration; - "@hf/google/gemma-7b-it": BaseAiTextGeneration; - "@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration; - "@cf/google/gemma-2b-it-lora": BaseAiTextGeneration; - "@cf/google/gemma-7b-it-lora": BaseAiTextGeneration; - "@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration; - "@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration; - "@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration; - "@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration; - "@hf/meta-llama/meta-llama-3-8b-instruct": BaseAiTextGeneration; - "@cf/meta/llama-3.1-8b-instruct": BaseAiTextGeneration; - "@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration; - "@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration; - "@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration; - "@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration; - "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b": BaseAiTextGeneration; - "@cf/facebook/bart-large-cnn": BaseAiSummarization; - "@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText; - "@cf/baai/bge-base-en-v1.5": Base_Ai_Cf_Baai_Bge_Base_En_V1_5; - "@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper; - "@cf/meta/m2m100-1.2b": Base_Ai_Cf_Meta_M2M100_1_2B; - "@cf/baai/bge-small-en-v1.5": Base_Ai_Cf_Baai_Bge_Small_En_V1_5; - "@cf/baai/bge-large-en-v1.5": Base_Ai_Cf_Baai_Bge_Large_En_V1_5; - "@cf/unum/uform-gen2-qwen-500m": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M; - "@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En; - "@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo; - "@cf/baai/bge-m3": Base_Ai_Cf_Baai_Bge_M3; - "@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell; - "@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct; - "@cf/meta/llama-3.3-70b-instruct-fp8-fast": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast; - "@cf/meta/llama-guard-3-8b": Base_Ai_Cf_Meta_Llama_Guard_3_8B; - "@cf/baai/bge-reranker-base": Base_Ai_Cf_Baai_Bge_Reranker_Base; - "@cf/qwen/qwen2.5-coder-32b-instruct": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct; - "@cf/qwen/qwq-32b": Base_Ai_Cf_Qwen_Qwq_32B; - "@cf/mistralai/mistral-small-3.1-24b-instruct": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct; - "@cf/google/gemma-3-12b-it": Base_Ai_Cf_Google_Gemma_3_12B_It; - "@cf/meta/llama-4-scout-17b-16e-instruct": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct; + '@cf/huggingface/distilbert-sst-2-int8': BaseAiTextClassification + '@cf/stabilityai/stable-diffusion-xl-base-1.0': BaseAiTextToImage + '@cf/runwayml/stable-diffusion-v1-5-inpainting': BaseAiTextToImage + '@cf/runwayml/stable-diffusion-v1-5-img2img': BaseAiTextToImage + '@cf/lykon/dreamshaper-8-lcm': BaseAiTextToImage + '@cf/bytedance/stable-diffusion-xl-lightning': BaseAiTextToImage + '@cf/myshell-ai/melotts': BaseAiTextToSpeech + '@cf/microsoft/resnet-50': BaseAiImageClassification + '@cf/facebook/detr-resnet-50': BaseAiObjectDetection + '@cf/meta/llama-2-7b-chat-int8': BaseAiTextGeneration + '@cf/mistral/mistral-7b-instruct-v0.1': BaseAiTextGeneration + '@cf/meta/llama-2-7b-chat-fp16': BaseAiTextGeneration + '@hf/thebloke/llama-2-13b-chat-awq': BaseAiTextGeneration + '@hf/thebloke/mistral-7b-instruct-v0.1-awq': BaseAiTextGeneration + '@hf/thebloke/zephyr-7b-beta-awq': BaseAiTextGeneration + '@hf/thebloke/openhermes-2.5-mistral-7b-awq': BaseAiTextGeneration + '@hf/thebloke/neural-chat-7b-v3-1-awq': BaseAiTextGeneration + '@hf/thebloke/llamaguard-7b-awq': BaseAiTextGeneration + '@hf/thebloke/deepseek-coder-6.7b-base-awq': BaseAiTextGeneration + '@hf/thebloke/deepseek-coder-6.7b-instruct-awq': BaseAiTextGeneration + '@cf/deepseek-ai/deepseek-math-7b-instruct': BaseAiTextGeneration + '@cf/defog/sqlcoder-7b-2': BaseAiTextGeneration + '@cf/openchat/openchat-3.5-0106': BaseAiTextGeneration + '@cf/tiiuae/falcon-7b-instruct': BaseAiTextGeneration + '@cf/thebloke/discolm-german-7b-v1-awq': BaseAiTextGeneration + '@cf/qwen/qwen1.5-0.5b-chat': BaseAiTextGeneration + '@cf/qwen/qwen1.5-7b-chat-awq': BaseAiTextGeneration + '@cf/qwen/qwen1.5-14b-chat-awq': BaseAiTextGeneration + '@cf/tinyllama/tinyllama-1.1b-chat-v1.0': BaseAiTextGeneration + '@cf/microsoft/phi-2': BaseAiTextGeneration + '@cf/qwen/qwen1.5-1.8b-chat': BaseAiTextGeneration + '@cf/mistral/mistral-7b-instruct-v0.2-lora': BaseAiTextGeneration + '@hf/nousresearch/hermes-2-pro-mistral-7b': BaseAiTextGeneration + '@hf/nexusflow/starling-lm-7b-beta': BaseAiTextGeneration + '@hf/google/gemma-7b-it': BaseAiTextGeneration + '@cf/meta-llama/llama-2-7b-chat-hf-lora': BaseAiTextGeneration + '@cf/google/gemma-2b-it-lora': BaseAiTextGeneration + '@cf/google/gemma-7b-it-lora': BaseAiTextGeneration + '@hf/mistral/mistral-7b-instruct-v0.2': BaseAiTextGeneration + '@cf/meta/llama-3-8b-instruct': BaseAiTextGeneration + '@cf/fblgit/una-cybertron-7b-v2-bf16': BaseAiTextGeneration + '@cf/meta/llama-3-8b-instruct-awq': BaseAiTextGeneration + '@hf/meta-llama/meta-llama-3-8b-instruct': BaseAiTextGeneration + '@cf/meta/llama-3.1-8b-instruct': BaseAiTextGeneration + '@cf/meta/llama-3.1-8b-instruct-fp8': BaseAiTextGeneration + '@cf/meta/llama-3.1-8b-instruct-awq': BaseAiTextGeneration + '@cf/meta/llama-3.2-3b-instruct': BaseAiTextGeneration + '@cf/meta/llama-3.2-1b-instruct': BaseAiTextGeneration + '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b': BaseAiTextGeneration + '@cf/facebook/bart-large-cnn': BaseAiSummarization + '@cf/llava-hf/llava-1.5-7b-hf': BaseAiImageToText + '@cf/baai/bge-base-en-v1.5': Base_Ai_Cf_Baai_Bge_Base_En_V1_5 + '@cf/openai/whisper': Base_Ai_Cf_Openai_Whisper + '@cf/meta/m2m100-1.2b': Base_Ai_Cf_Meta_M2M100_1_2B + '@cf/baai/bge-small-en-v1.5': Base_Ai_Cf_Baai_Bge_Small_En_V1_5 + '@cf/baai/bge-large-en-v1.5': Base_Ai_Cf_Baai_Bge_Large_En_V1_5 + '@cf/unum/uform-gen2-qwen-500m': Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M + '@cf/openai/whisper-tiny-en': Base_Ai_Cf_Openai_Whisper_Tiny_En + '@cf/openai/whisper-large-v3-turbo': Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo + '@cf/baai/bge-m3': Base_Ai_Cf_Baai_Bge_M3 + '@cf/black-forest-labs/flux-1-schnell': Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell + '@cf/meta/llama-3.2-11b-vision-instruct': Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct + '@cf/meta/llama-3.3-70b-instruct-fp8-fast': Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast + '@cf/meta/llama-guard-3-8b': Base_Ai_Cf_Meta_Llama_Guard_3_8B + '@cf/baai/bge-reranker-base': Base_Ai_Cf_Baai_Bge_Reranker_Base + '@cf/qwen/qwen2.5-coder-32b-instruct': Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct + '@cf/qwen/qwq-32b': Base_Ai_Cf_Qwen_Qwq_32B + '@cf/mistralai/mistral-small-3.1-24b-instruct': Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct + '@cf/google/gemma-3-12b-it': Base_Ai_Cf_Google_Gemma_3_12B_It + '@cf/meta/llama-4-scout-17b-16e-instruct': Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct } type AiOptions = { /** * Send requests as an asynchronous batch job, only works for supported models * https://developers.cloudflare.com/workers-ai/features/batch-api */ - queueRequest?: boolean; - gateway?: GatewayOptions; - returnRawResponse?: boolean; - prefix?: string; - extraHeaders?: object; -}; + queueRequest?: boolean + gateway?: GatewayOptions + returnRawResponse?: boolean + prefix?: string + extraHeaders?: object +} type ConversionResponse = { - name: string; - mimeType: string; - format: "markdown"; - tokens: number; - data: string; -}; + name: string + mimeType: string + format: 'markdown' + tokens: number + data: string +} type AiModelsSearchParams = { - author?: string; - hide_experimental?: boolean; - page?: number; - per_page?: number; - search?: string; - source?: number; - task?: string; -}; + author?: string + hide_experimental?: boolean + page?: number + per_page?: number + search?: string + source?: number + task?: string +} type AiModelsSearchObject = { - id: string; - source: number; - name: string; - description: string; + id: string + source: number + name: string + description: string task: { - id: string; - name: string; - description: string; - }; - tags: string[]; + id: string + name: string + description: string + } + tags: string[] properties: { - property_id: string; - value: string; - }[]; -}; -interface InferenceUpstreamError extends Error { -} -interface AiInternalError extends Error { + property_id: string + value: string + }[] } -type AiModelListType = Record; +interface InferenceUpstreamError extends Error {} +interface AiInternalError extends Error {} +type AiModelListType = Record declare abstract class Ai { - aiGatewayLogId: string | null; - gateway(gatewayId: string): AiGateway; - autorag(autoragId?: string): AutoRAG; - run(model: Name, inputs: InputOptions, options?: Options): Promise; - models(params?: AiModelsSearchParams): Promise; - toMarkdown(files: { - name: string; - blob: Blob; - }[], options?: { - gateway?: GatewayOptions; - extraHeaders?: object; - }): Promise; - toMarkdown(files: { - name: string; - blob: Blob; - }, options?: { - gateway?: GatewayOptions; - extraHeaders?: object; - }): Promise; + aiGatewayLogId: string | null + gateway(gatewayId: string): AiGateway + autorag(autoragId?: string): AutoRAG + run< + Name extends keyof AiModelList, + Options extends AiOptions, + InputOptions extends AiModelList[Name]['inputs'], + >( + model: Name, + inputs: InputOptions, + options?: Options, + ): Promise< + Options extends { + returnRawResponse: true + } + ? Response + : InputOptions extends { + stream: true + } + ? ReadableStream + : AiModelList[Name]['postProcessedOutputs'] + > + models(params?: AiModelsSearchParams): Promise + toMarkdown( + files: { + name: string + blob: Blob + }[], + options?: { + gateway?: GatewayOptions + extraHeaders?: object + }, + ): Promise + toMarkdown( + files: { + name: string + blob: Blob + }, + options?: { + gateway?: GatewayOptions + extraHeaders?: object + }, + ): Promise } type GatewayRetries = { - maxAttempts?: 1 | 2 | 3 | 4 | 5; - retryDelayMs?: number; - backoff?: 'constant' | 'linear' | 'exponential'; -}; + maxAttempts?: 1 | 2 | 3 | 4 | 5 + retryDelayMs?: number + backoff?: 'constant' | 'linear' | 'exponential' +} type GatewayOptions = { - id: string; - cacheKey?: string; - cacheTtl?: number; - skipCache?: boolean; - metadata?: Record; - collectLog?: boolean; - eventId?: string; - requestTimeoutMs?: number; - retries?: GatewayRetries; -}; + id: string + cacheKey?: string + cacheTtl?: number + skipCache?: boolean + metadata?: Record + collectLog?: boolean + eventId?: string + requestTimeoutMs?: number + retries?: GatewayRetries +} type AiGatewayPatchLog = { - score?: number | null; - feedback?: -1 | 1 | null; - metadata?: Record | null; -}; + score?: number | null + feedback?: -1 | 1 | null + metadata?: Record | null +} type AiGatewayLog = { - id: string; - provider: string; - model: string; - model_type?: string; - path: string; - duration: number; - request_type?: string; - request_content_type?: string; - status_code: number; - response_content_type?: string; - success: boolean; - cached: boolean; - tokens_in?: number; - tokens_out?: number; - metadata?: Record; - step?: number; - cost?: number; - custom_cost?: boolean; - request_size: number; - request_head?: string; - request_head_complete: boolean; - response_size: number; - response_head?: string; - response_head_complete: boolean; - created_at: Date; -}; -type 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'; + id: string + provider: string + model: string + model_type?: string + path: string + duration: number + request_type?: string + request_content_type?: string + status_code: number + response_content_type?: string + success: boolean + cached: boolean + tokens_in?: number + tokens_out?: number + metadata?: Record + step?: number + cost?: number + custom_cost?: boolean + request_size: number + request_head?: string + request_head_complete: boolean + response_size: number + response_head?: string + response_head_complete: boolean + created_at: Date +} +type 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' type AIGatewayHeaders = { - 'cf-aig-metadata': Record | string; - 'cf-aig-custom-cost': { - per_token_in?: number; - per_token_out?: number; - } | { - total_cost?: number; - } | string; - 'cf-aig-cache-ttl': number | string; - 'cf-aig-skip-cache': boolean | string; - 'cf-aig-cache-key': string; - 'cf-aig-event-id': string; - 'cf-aig-request-timeout': number | string; - 'cf-aig-max-attempts': number | string; - 'cf-aig-retry-delay': number | string; - 'cf-aig-backoff': string; - 'cf-aig-collect-log': boolean | string; - Authorization: string; - 'Content-Type': string; - [key: string]: string | number | boolean | object; -}; -type AIGatewayUniversalRequest = { - provider: AIGatewayProviders | string; - endpoint: string; - headers: Partial; - query: unknown; -}; -interface AiGatewayInternalError extends Error { + 'cf-aig-metadata': + | Record + | string + 'cf-aig-custom-cost': + | { + per_token_in?: number + per_token_out?: number + } + | { + total_cost?: number + } + | string + 'cf-aig-cache-ttl': number | string + 'cf-aig-skip-cache': boolean | string + 'cf-aig-cache-key': string + 'cf-aig-event-id': string + 'cf-aig-request-timeout': number | string + 'cf-aig-max-attempts': number | string + 'cf-aig-retry-delay': number | string + 'cf-aig-backoff': string + 'cf-aig-collect-log': boolean | string + Authorization: string + 'Content-Type': string + [key: string]: string | number | boolean | object } -interface AiGatewayLogNotFound extends Error { +type AIGatewayUniversalRequest = { + provider: AIGatewayProviders | string + endpoint: string + headers: Partial + query: unknown } +interface AiGatewayInternalError extends Error {} +interface AiGatewayLogNotFound extends Error {} declare abstract class AiGateway { - patchLog(logId: string, data: AiGatewayPatchLog): Promise; - getLog(logId: string): Promise; - run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: { - gateway?: GatewayOptions; - extraHeaders?: object; - }): Promise; - getUrl(provider?: AIGatewayProviders | string): Promise; -} -interface AutoRAGInternalError extends Error { -} -interface AutoRAGNotFoundError extends Error { -} -interface AutoRAGUnauthorizedError extends Error { -} -interface AutoRAGNameNotSetError extends Error { -} + patchLog(logId: string, data: AiGatewayPatchLog): Promise + getLog(logId: string): Promise + run( + data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], + options?: { + gateway?: GatewayOptions + extraHeaders?: object + }, + ): Promise + getUrl(provider?: AIGatewayProviders | string): Promise +} +interface AutoRAGInternalError extends Error {} +interface AutoRAGNotFoundError extends Error {} +interface AutoRAGUnauthorizedError extends Error {} +interface AutoRAGNameNotSetError extends Error {} type ComparisonFilter = { - key: string; - type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte'; - value: string | number | boolean; -}; + key: string + type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' + value: string | number | boolean +} type CompoundFilter = { - type: 'and' | 'or'; - filters: ComparisonFilter[]; -}; + type: 'and' | 'or' + filters: ComparisonFilter[] +} type AutoRagSearchRequest = { - query: string; - filters?: CompoundFilter | ComparisonFilter; - max_num_results?: number; + query: string + filters?: CompoundFilter | ComparisonFilter + max_num_results?: number ranking_options?: { - ranker?: string; - score_threshold?: number; - }; - rewrite_query?: boolean; -}; + ranker?: string + score_threshold?: number + } + rewrite_query?: boolean +} type AutoRagAiSearchRequest = AutoRagSearchRequest & { - stream?: boolean; -}; -type AutoRagAiSearchRequestStreaming = Omit & { - stream: true; -}; + stream?: boolean +} +type AutoRagAiSearchRequestStreaming = Omit< + AutoRagAiSearchRequest, + 'stream' +> & { + stream: true +} type AutoRagSearchResponse = { - object: 'vector_store.search_results.page'; - search_query: string; + object: 'vector_store.search_results.page' + search_query: string data: { - file_id: string; - filename: string; - score: number; - attributes: Record; + file_id: string + filename: string + score: number + attributes: Record content: { - type: 'text'; - text: string; - }[]; - }[]; - has_more: boolean; - next_page: string | null; -}; + type: 'text' + text: string + }[] + }[] + has_more: boolean + next_page: string | null +} type AutoRagListResponse = { - id: string; - enable: boolean; - type: string; - source: string; - vectorize_name: string; - paused: boolean; - status: string; -}[]; + id: string + enable: boolean + type: string + source: string + vectorize_name: string + paused: boolean + status: string +}[] type AutoRagAiSearchResponse = AutoRagSearchResponse & { - response: string; -}; + response: string +} declare abstract class AutoRAG { - list(): Promise; - search(params: AutoRagSearchRequest): Promise; - aiSearch(params: AutoRagAiSearchRequestStreaming): Promise; - aiSearch(params: AutoRagAiSearchRequest): Promise; - aiSearch(params: AutoRagAiSearchRequest): Promise; + list(): Promise + search(params: AutoRagSearchRequest): Promise + aiSearch(params: AutoRagAiSearchRequestStreaming): Promise + aiSearch(params: AutoRagAiSearchRequest): Promise + aiSearch( + params: AutoRagAiSearchRequest, + ): Promise } interface BasicImageTransformations { /** * Maximum width in image pixels. The value must be an integer. */ - width?: number; + width?: number /** * Maximum height in image pixels. The value must be an integer. */ - height?: number; + height?: number /** * Resizing mode as a string. It affects interpretation of width and height * options: @@ -5547,7 +6258,7 @@ interface BasicImageTransformations { * - squeeze: Stretches and deforms to the width and height given, even if it * breaks aspect ratio */ - fit?: "scale-down" | "contain" | "cover" | "crop" | "pad" | "squeeze"; + fit?: 'scale-down' | 'contain' | 'cover' | 'crop' | 'pad' | 'squeeze' /** * When cropping with fit: "cover", this defines the side or point that should * be left uncropped. The value is either a string @@ -5560,23 +6271,31 @@ interface BasicImageTransformations { * preserve as much as possible around a point at 20% of the height of the * source image. */ - gravity?: 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates; + gravity?: + | 'left' + | 'right' + | 'top' + | 'bottom' + | 'center' + | 'auto' + | 'entropy' + | BasicImageTransformationsGravityCoordinates /** * Background color to add underneath the image. Applies only to images with * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…), * hsl(…), etc.) */ - background?: string; + background?: string /** * Number of degrees (90, 180, 270) to rotate the image by. width and height * options refer to axes after rotation. */ - rotate?: 0 | 90 | 180 | 270 | 360; + rotate?: 0 | 90 | 180 | 270 | 360 } interface BasicImageTransformationsGravityCoordinates { - x?: number; - y?: number; - mode?: 'remainder' | 'box-center'; + x?: number + y?: number + mode?: 'remainder' | 'box-center' } /** * In addition to the properties you can set in the RequestInit dict @@ -5588,7 +6307,7 @@ interface BasicImageTransformationsGravityCoordinates { * playground. */ interface RequestInitCfProperties extends Record { - cacheEverything?: boolean; + cacheEverything?: boolean /** * A request's cache key is what determines if two requests are * "the same" for caching purposes. If a request has the same cache key @@ -5597,7 +6316,7 @@ interface RequestInitCfProperties extends Record { * * Only available for Enterprise customers. */ - cacheKey?: string; + cacheKey?: string /** * This allows you to append additional Cache-Tag response headers * to the origin response without modifications to the origin server. @@ -5606,23 +6325,23 @@ interface RequestInitCfProperties extends Record { * * Only available for Enterprise customers. */ - cacheTags?: string[]; + cacheTags?: string[] /** * Force response to be cached for a given number of seconds. (e.g. 300) */ - cacheTtl?: number; + cacheTtl?: number /** * Force response to be cached for a given number of seconds based on the Origin status code. * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 }) */ - cacheTtlByStatus?: Record; - scrapeShield?: boolean; - apps?: boolean; - image?: RequestInitCfPropertiesImage; - minify?: RequestInitCfPropertiesImageMinify; - mirage?: boolean; - polish?: "lossy" | "lossless" | "off"; - r2?: RequestInitCfPropertiesR2; + cacheTtlByStatus?: Record + scrapeShield?: boolean + apps?: boolean + image?: RequestInitCfPropertiesImage + minify?: RequestInitCfPropertiesImageMinify + mirage?: boolean + polish?: 'lossy' | 'lossless' | 'off' + r2?: RequestInitCfPropertiesR2 /** * Redirects the request to an alternate origin server. You can use this, * for example, to implement load balancing across several origins. @@ -5636,7 +6355,7 @@ interface RequestInitCfProperties extends Record { * external hostname, set proxy on Cloudflare, then set resolveOverride * to point to that CNAME record. */ - resolveOverride?: string; + resolveOverride?: string } interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations { /** @@ -5644,12 +6363,12 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations { * the supported file formats. For drawing of watermarks or non-rectangular * overlays we recommend using PNG or WebP images. */ - url: string; + url: string /** * Floating-point number between 0 (transparent) and 1 (opaque). * For example, opacity: 0.5 makes overlay semitransparent. */ - opacity?: number; + opacity?: number /** * - If set to true, the overlay image will be tiled to cover the entire * area. This is useful for stock-photo-like watermarks. @@ -5658,7 +6377,7 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations { * - If set to "y", the overlay image will be tiled vertically only * (form a line). */ - repeat?: true | "x" | "y"; + repeat?: true | 'x' | 'y' /** * Position of the overlay image relative to a given edge. Each property is * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10 @@ -5670,17 +6389,17 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations { * * If no position is specified, the image will be centered. */ - top?: number; - left?: number; - bottom?: number; - right?: number; + top?: number + left?: number + bottom?: number + right?: number } interface RequestInitCfPropertiesImage extends BasicImageTransformations { /** * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it * easier to specify higher-DPI sizes in . */ - dpr?: number; + dpr?: number /** * Allows you to trim your image. Takes dpr into account and is performed before * resizing or rotation. @@ -5696,25 +6415,29 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations { * - tolerance: difference from color to treat as color * - keep: the number of pixels of border to keep */ - trim?: "border" | { - top?: number; - bottom?: number; - left?: number; - right?: number; - width?: number; - height?: number; - border?: boolean | { - color?: string; - tolerance?: number; - keep?: number; - }; - }; + trim?: + | 'border' + | { + top?: number + bottom?: number + left?: number + right?: number + width?: number + height?: number + border?: + | boolean + | { + color?: string + tolerance?: number + keep?: number + } + } /** * Quality setting from 1-100 (useful values are in 60-90 range). Lower values * make images look worse, but load faster. The default is 85. It applies only * to JPEG and WebP images. It doesn’t have any effect on PNG. */ - quality?: number | "low" | "medium-low" | "medium-high" | "high"; + quality?: number | 'low' | 'medium-low' | 'medium-high' | 'high' /** * Output format to generate. It can be: * - avif: generate images in AVIF format. @@ -5726,7 +6449,15 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations { * - jpeg: generate images in JPEG format. * - png: generate images in PNG format. */ - format?: "avif" | "webp" | "json" | "jpeg" | "png" | "baseline-jpeg" | "png-force" | "svg"; + format?: + | 'avif' + | 'webp' + | 'json' + | 'jpeg' + | 'png' + | 'baseline-jpeg' + | 'png-force' + | 'svg' /** * Whether to preserve animation frames from input files. Default is true. * Setting it to false reduces animations to still images. This setting is @@ -5735,7 +6466,7 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations { * It is also useful to set anim:false when using format:"json" to get the * response quicker without the number of frames. */ - anim?: boolean; + anim?: boolean /** * What EXIF data should be preserved in the output image. Note that EXIF * rotation and embedded color profiles are always applied ("baked in" into @@ -5749,73 +6480,75 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations { * - none: Discard all invisible EXIF metadata. Currently WebP and PNG * output formats always discard metadata. */ - metadata?: "keep" | "copyright" | "none"; + metadata?: 'keep' | 'copyright' | 'none' /** * Strength of sharpening filter to apply to the image. Floating-point * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a * recommended value for downscaled images. */ - sharpen?: number; + sharpen?: number /** * Radius of a blur filter (approximate gaussian). Maximum supported radius * is 250. */ - blur?: number; + blur?: number /** * Overlays are drawn in the order they appear in the array (last array * entry is the topmost layer). */ - draw?: RequestInitCfPropertiesImageDraw[]; + draw?: RequestInitCfPropertiesImageDraw[] /** * Fetching image from authenticated origin. Setting this property will * pass authentication headers (Authorization, Cookie, etc.) through to * the origin. */ - "origin-auth"?: "share-publicly"; + 'origin-auth'?: 'share-publicly' /** * Adds a border around the image. The border is added after resizing. Border * width takes dpr into account, and can be specified either using a single * width property, or individually for each side. */ - border?: { - color: string; - width: number; - } | { - color: string; - top: number; - right: number; - bottom: number; - left: number; - }; + border?: + | { + color: string + width: number + } + | { + color: string + top: number + right: number + bottom: number + left: number + } /** * Increase brightness by a factor. A value of 1.0 equals no change, a value * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright. * 0 is ignored. */ - brightness?: number; + brightness?: number /** * Increase contrast by a factor. A value of 1.0 equals no change, a value of * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is * ignored. */ - contrast?: number; + contrast?: number /** * Increase exposure by a factor. A value of 1.0 equals no change, a value of * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored. */ - gamma?: number; + gamma?: number /** * Increase contrast by a factor. A value of 1.0 equals no change, a value of * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is * ignored. */ - saturation?: number; + saturation?: number /** * Flips the images horizontally, vertically, or both. Flipping is applied before * rotation, so if you apply flip=h,rotate=90 then the image will be flipped * horizontally, then rotated by 90 degrees. */ - flip?: 'h' | 'v' | 'hv'; + flip?: 'h' | 'v' | 'hv' /** * Slightly reduces latency on a cache miss by selecting a * quickest-to-compress file format, at a cost of increased file size and @@ -5824,55 +6557,60 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations { * unusual circumstances like resizing uncacheable dynamically-generated * images. */ - compression?: "fast"; + compression?: 'fast' } interface RequestInitCfPropertiesImageMinify { - javascript?: boolean; - css?: boolean; - html?: boolean; + javascript?: boolean + css?: boolean + html?: boolean } interface RequestInitCfPropertiesR2 { /** * Colo id of bucket that an object is stored in */ - bucketColoId?: number; + bucketColoId?: number } /** * Request metadata provided by Cloudflare's edge. */ -type IncomingRequestCfProperties = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield; +type IncomingRequestCfProperties = + IncomingRequestCfPropertiesBase & + IncomingRequestCfPropertiesBotManagementEnterprise & + IncomingRequestCfPropertiesCloudflareForSaaSEnterprise & + IncomingRequestCfPropertiesGeographicInformation & + IncomingRequestCfPropertiesCloudflareAccessOrApiShield interface IncomingRequestCfPropertiesBase extends Record { /** * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request. * * @example 395747 */ - asn?: number; + asn?: number /** * The organization which owns the ASN of the incoming request. * * @example "Google Cloud" */ - asOrganization?: string; + asOrganization?: string /** * The original value of the `Accept-Encoding` header if Cloudflare modified it. * * @example "gzip, deflate, br" */ - clientAcceptEncoding?: string; + clientAcceptEncoding?: string /** * The number of milliseconds it took for the request to reach your worker. * * @example 22 */ - clientTcpRtt?: number; + clientTcpRtt?: number /** * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code) * airport code of the data center that the request hit. * * @example "DFW" */ - colo: string; + colo: string /** * Represents the upstream's response to a * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html) @@ -5882,13 +6620,13 @@ interface IncomingRequestCfPropertiesBase extends Record { * * @example 3 */ - edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus; + edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus /** * The HTTP Protocol the request used. * * @example "HTTP/2" */ - httpProtocol: string; + httpProtocol: string /** * The browser-requested prioritization information in the request object. * @@ -5897,27 +6635,27 @@ interface IncomingRequestCfPropertiesBase extends Record { * @example "weight=192;exclusive=0;group=3;group-weight=127" * @default "" */ - requestPriority: string; + requestPriority: string /** * The TLS version of the connection to Cloudflare. * In requests served over plaintext (without TLS), this property is the empty string `""`. * * @example "TLSv1.3" */ - tlsVersion: string; + tlsVersion: string /** * The cipher for the connection to Cloudflare. * In requests served over plaintext (without TLS), this property is the empty string `""`. * * @example "AEAD-AES128-GCM-SHA256" */ - tlsCipher: string; + tlsCipher: string /** * 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. * * If the incoming request was served over plaintext (without TLS) this field is undefined. */ - tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata; + tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata } interface IncomingRequestCfPropertiesBotManagementBase { /** @@ -5926,39 +6664,40 @@ interface IncomingRequestCfPropertiesBotManagementBase { * * @example 54 */ - score: number; + score: number /** * A boolean value that is true if the request comes from a good bot, like Google or Bing. * 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). */ - verifiedBot: boolean; + verifiedBot: boolean /** * A boolean value that is true if the request originates from a * Cloudflare-verified proxy service. */ - corporateProxy: boolean; + corporateProxy: boolean /** * 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. */ - staticResource: boolean; + staticResource: boolean /** * 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). */ - detectionIds: number[]; + detectionIds: number[] } interface IncomingRequestCfPropertiesBotManagement { /** * Results of Cloudflare's Bot Management analysis */ - botManagement: IncomingRequestCfPropertiesBotManagementBase; + botManagement: IncomingRequestCfPropertiesBotManagementBase /** * Duplicate of `botManagement.score`. * * @deprecated */ - clientTrustScore: number; + clientTrustScore: number } -interface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement { +interface IncomingRequestCfPropertiesBotManagementEnterprise + extends IncomingRequestCfPropertiesBotManagement { /** * Results of Cloudflare's Bot Management analysis */ @@ -5967,8 +6706,8 @@ interface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingReq * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients * across different destination IPs, Ports, and X509 certificates. */ - ja3Hash: string; - }; + ja3Hash: string + } } interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise { /** @@ -5977,7 +6716,7 @@ interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise { * This field is only present if you have Cloudflare for SaaS enabled on your account * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)). */ - hostMetadata?: HostMetadata; + hostMetadata?: HostMetadata } interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { /** @@ -5994,7 +6733,9 @@ interface IncomingRequestCfPropertiesCloudflareAccessOrApiShield { * The property `certPresented` will be set to `"1"` when * the object is populated (i.e. the above conditions were met). */ - tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder; + tlsClientAuth: + | IncomingRequestCfPropertiesTLSClientAuth + | IncomingRequestCfPropertiesTLSClientAuthPlaceholder } /** * Metadata about the request's TLS handshake @@ -6005,25 +6746,25 @@ interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata { * * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" */ - clientHandshake: string; + clientHandshake: string /** * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal * * @example "44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d" */ - serverHandshake: string; + serverHandshake: string /** * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal * * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" */ - clientFinished: string; + clientFinished: string /** * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal * * @example "084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b" */ - serverFinished: string; + serverFinished: string } /** * Geographic data about the request's origin. @@ -6040,257 +6781,516 @@ interface IncomingRequestCfPropertiesGeographicInformation { * * @example "GB" */ - country?: Iso3166Alpha2Code | "T1"; + country?: Iso3166Alpha2Code | 'T1' /** * If present, this property indicates that the request originated in the EU * * @example "1" */ - isEUCountry?: "1"; + isEUCountry?: '1' /** * A two-letter code indicating the continent the request originated from. * * @example "AN" */ - continent?: ContinentCode; + continent?: ContinentCode /** * The city the request originated from * * @example "Austin" */ - city?: string; + city?: string /** * Postal code of the incoming request * * @example "78701" */ - postalCode?: string; + postalCode?: string /** * Latitude of the incoming request * * @example "30.27130" */ - latitude?: string; + latitude?: string /** * Longitude of the incoming request * * @example "-97.74260" */ - longitude?: string; + longitude?: string /** * Timezone of the incoming request * * @example "America/Chicago" */ - timezone?: string; + timezone?: string /** * If known, the ISO 3166-2 name for the first level region associated with * the IP address of the incoming request * * @example "Texas" */ - region?: string; + region?: string /** * If known, the ISO 3166-2 code for the first-level region associated with * the IP address of the incoming request * * @example "TX" */ - regionCode?: string; + regionCode?: string /** * Metro code (DMA) of the incoming request * * @example "635" */ - metroCode?: string; + metroCode?: string } /** Data about the incoming request's TLS certificate */ interface IncomingRequestCfPropertiesTLSClientAuth { /** Always `"1"`, indicating that the certificate was presented */ - certPresented: "1"; + certPresented: '1' /** * Result of certificate verification. * * @example "FAILED:self signed certificate" */ - certVerified: Exclude; + certVerified: Exclude /** The presented certificate's revokation status. * * - A value of `"1"` indicates the certificate has been revoked * - A value of `"0"` indicates the certificate has not been revoked */ - certRevoked: "1" | "0"; + certRevoked: '1' | '0' /** * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) * * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" */ - certIssuerDN: string; + certIssuerDN: string /** * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) * * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" */ - certSubjectDN: string; + certSubjectDN: string /** * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) * * @example "CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" */ - certIssuerDNRFC2253: string; + certIssuerDNRFC2253: string /** * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted) * * @example "CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare" */ - certSubjectDNRFC2253: string; + certSubjectDNRFC2253: string /** The certificate issuer's distinguished name (legacy policies) */ - certIssuerDNLegacy: string; + certIssuerDNLegacy: string /** The certificate subject's distinguished name (legacy policies) */ - certSubjectDNLegacy: string; + certSubjectDNLegacy: string /** * The certificate's serial number * * @example "00936EACBE07F201DF" */ - certSerial: string; + certSerial: string /** * The certificate issuer's serial number * * @example "2489002934BDFEA34" */ - certIssuerSerial: string; + certIssuerSerial: string /** * The certificate's Subject Key Identifier * * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" */ - certSKI: string; + certSKI: string /** * The certificate issuer's Subject Key Identifier * * @example "BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4" */ - certIssuerSKI: string; + certIssuerSKI: string /** * The certificate's SHA-1 fingerprint * * @example "6b9109f323999e52259cda7373ff0b4d26bd232e" */ - certFingerprintSHA1: string; + certFingerprintSHA1: string /** * The certificate's SHA-256 fingerprint * * @example "acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea" */ - certFingerprintSHA256: string; + certFingerprintSHA256: string /** * The effective starting date of the certificate * * @example "Dec 22 19:39:00 2018 GMT" */ - certNotBefore: string; + certNotBefore: string /** * The effective expiration date of the certificate * * @example "Dec 22 19:39:00 2018 GMT" */ - certNotAfter: string; + certNotAfter: string } /** Placeholder values for TLS Client Authorization */ interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder { - certPresented: "0"; - certVerified: "NONE"; - certRevoked: "0"; - certIssuerDN: ""; - certSubjectDN: ""; - certIssuerDNRFC2253: ""; - certSubjectDNRFC2253: ""; - certIssuerDNLegacy: ""; - certSubjectDNLegacy: ""; - certSerial: ""; - certIssuerSerial: ""; - certSKI: ""; - certIssuerSKI: ""; - certFingerprintSHA1: ""; - certFingerprintSHA256: ""; - certNotBefore: ""; - certNotAfter: ""; + certPresented: '0' + certVerified: 'NONE' + certRevoked: '0' + certIssuerDN: '' + certSubjectDN: '' + certIssuerDNRFC2253: '' + certSubjectDNRFC2253: '' + certIssuerDNLegacy: '' + certSubjectDNLegacy: '' + certSerial: '' + certIssuerSerial: '' + certSKI: '' + certIssuerSKI: '' + certFingerprintSHA1: '' + certFingerprintSHA256: '' + certNotBefore: '' + certNotAfter: '' } /** Possible outcomes of TLS verification */ -declare type CertVerificationStatus = -/** Authentication succeeded */ -"SUCCESS" -/** No certificate was presented */ - | "NONE" -/** Failed because the certificate was self-signed */ - | "FAILED:self signed certificate" -/** Failed because the certificate failed a trust chain check */ - | "FAILED:unable to verify the first certificate" -/** Failed because the certificate not yet valid */ - | "FAILED:certificate is not yet valid" -/** Failed because the certificate is expired */ - | "FAILED:certificate has expired" -/** Failed for another unspecified reason */ - | "FAILED"; +declare type CertVerificationStatus = + /** Authentication succeeded */ + | 'SUCCESS' + /** No certificate was presented */ + | 'NONE' + /** Failed because the certificate was self-signed */ + | 'FAILED:self signed certificate' + /** Failed because the certificate failed a trust chain check */ + | 'FAILED:unable to verify the first certificate' + /** Failed because the certificate not yet valid */ + | 'FAILED:certificate is not yet valid' + /** Failed because the certificate is expired */ + | 'FAILED:certificate has expired' + /** Failed for another unspecified reason */ + | 'FAILED' /** * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare. */ -declare 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 */ +declare 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 */ /** ISO 3166-1 Alpha-2 codes */ -declare 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"; +declare 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' /** The 2-letter continent codes Cloudflare uses */ -declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA"; -type CfProperties = IncomingRequestCfProperties | RequestInitCfProperties; +declare type ContinentCode = 'AF' | 'AN' | 'AS' | 'EU' | 'NA' | 'OC' | 'SA' +type CfProperties = + | IncomingRequestCfProperties + | RequestInitCfProperties interface D1Meta { - duration: number; - size_after: number; - rows_read: number; - rows_written: number; - last_row_id: number; - changed_db: boolean; - changes: number; + duration: number + size_after: number + rows_read: number + rows_written: number + last_row_id: number + changed_db: boolean + changes: number /** * The region of the database instance that executed the query. */ - served_by_region?: string; + served_by_region?: string /** * True if-and-only-if the database instance that executed the query was the primary. */ - served_by_primary?: boolean; + served_by_primary?: boolean timings?: { /** * The duration of the SQL query execution by the database instance. It doesn't include any network time. */ - sql_duration_ms: number; - }; + sql_duration_ms: number + } } interface D1Response { - success: true; - meta: D1Meta & Record; - error?: never; + success: true + meta: D1Meta & Record + error?: never } type D1Result = D1Response & { - results: T[]; -}; + results: T[] +} interface D1ExecResult { - count: number; - duration: number; -} -type D1SessionConstraint = -// Indicates that the first query should go to the primary, and the rest queries -// using the same D1DatabaseSession will go to any replica that is consistent with -// the bookmark maintained by the session (returned by the first query). -"first-primary" -// Indicates that the first query can go anywhere (primary or replica), and the rest queries -// using the same D1DatabaseSession will go to any replica that is consistent with -// the bookmark maintained by the session (returned by the first query). - | "first-unconstrained"; -type D1SessionBookmark = string; + count: number + duration: number +} +type D1SessionConstraint = + // Indicates that the first query should go to the primary, and the rest queries + // using the same D1DatabaseSession will go to any replica that is consistent with + // the bookmark maintained by the session (returned by the first query). + | 'first-primary' + // Indicates that the first query can go anywhere (primary or replica), and the rest queries + // using the same D1DatabaseSession will go to any replica that is consistent with + // the bookmark maintained by the session (returned by the first query). + | 'first-unconstrained' +type D1SessionBookmark = string declare abstract class D1Database { - prepare(query: string): D1PreparedStatement; - batch(statements: D1PreparedStatement[]): Promise[]>; - exec(query: string): Promise; + prepare(query: string): D1PreparedStatement + batch( + statements: D1PreparedStatement[], + ): Promise[]> + exec(query: string): Promise /** * Creates a new D1 Session anchored at the given constraint or the bookmark. * All queries executed using the created session will have sequential consistency, @@ -6298,36 +7298,35 @@ declare abstract class D1Database { * * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session. */ - withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession; + withSession( + constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint, + ): D1DatabaseSession /** * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases. */ - dump(): Promise; + dump(): Promise } declare abstract class D1DatabaseSession { - prepare(query: string): D1PreparedStatement; - batch(statements: D1PreparedStatement[]): Promise[]>; + prepare(query: string): D1PreparedStatement + batch( + statements: D1PreparedStatement[], + ): Promise[]> /** * @returns The latest session bookmark across all executed queries on the session. * If no query has been executed yet, `null` is returned. */ - getBookmark(): D1SessionBookmark | null; + getBookmark(): D1SessionBookmark | null } declare abstract class D1PreparedStatement { - bind(...values: unknown[]): D1PreparedStatement; - first(colName: string): Promise; - first>(): Promise; - run>(): Promise>; - all>(): Promise>; + bind(...values: unknown[]): D1PreparedStatement + first(colName: string): Promise + first>(): Promise + run>(): Promise> + all>(): Promise> raw(options: { - columnNames: true; - }): Promise<[ - string[], - ...T[] - ]>; - raw(options?: { - columnNames?: false; - }): Promise; + columnNames: true + }): Promise<[string[], ...T[]]> + raw(options?: { columnNames?: false }): Promise } // `Disposable` was added to TypeScript's standard lib types in version 5.2. // To support older TypeScript versions, define an empty `Disposable` interface. @@ -6335,8 +7334,7 @@ declare abstract class D1PreparedStatement { // but this will ensure type checking on older versions still passes. // TypeScript's interface merging will ensure our empty interface is effectively // ignored when `Disposable` is included in the standard lib. -interface Disposable { -} +interface Disposable {} /** * An email message that can be sent from a Worker. */ @@ -6344,11 +7342,11 @@ interface EmailMessage { /** * Envelope From attribute of the email message. */ - readonly from: string; + readonly from: string /** * Envelope To attribute of the email message. */ - readonly to: string; + readonly to: string } /** * An email message that is sent to a consumer Worker and can be rejected/forwarded. @@ -6357,51 +7355,59 @@ interface ForwardableEmailMessage extends EmailMessage { /** * Stream of the email message content. */ - readonly raw: ReadableStream; + readonly raw: ReadableStream /** * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). */ - readonly headers: Headers; + readonly headers: Headers /** * Size of the email message content. */ - readonly rawSize: number; + readonly rawSize: number /** * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason. * @param reason The reject reason. * @returns void */ - setReject(reason: string): void; + setReject(reason: string): void /** * Forward this email message to a verified destination address of the account. * @param rcptTo Verified destination address. * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers). * @returns A promise that resolves when the email message is forwarded. */ - forward(rcptTo: string, headers?: Headers): Promise; + forward(rcptTo: string, headers?: Headers): Promise /** * Reply to the sender of this email message with a new EmailMessage object. * @param message The reply message. * @returns A promise that resolves when the email message is replied. */ - reply(message: EmailMessage): Promise; + reply(message: EmailMessage): Promise } /** * A binding that allows a Worker to send email messages. */ interface SendEmail { - send(message: EmailMessage): Promise; + send(message: EmailMessage): Promise } declare abstract class EmailEvent extends ExtendableEvent { - readonly message: ForwardableEmailMessage; -} -declare type EmailExportedHandler = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext) => void | Promise; -declare module "cloudflare:email" { + readonly message: ForwardableEmailMessage +} +declare type EmailExportedHandler = ( + message: ForwardableEmailMessage, + env: Env, + ctx: ExecutionContext, +) => void | Promise +declare module 'cloudflare:email' { let _EmailMessage: { - prototype: EmailMessage; - new (from: string, to: string, raw: ReadableStream | string): EmailMessage; - }; - export { _EmailMessage as EmailMessage }; + prototype: EmailMessage + new ( + from: string, + to: string, + raw: ReadableStream | string, + ): EmailMessage + } + export { _EmailMessage as EmailMessage } } /** * Hello World binding to serve as an explanatory example. DO NOT USE @@ -6411,13 +7417,13 @@ interface HelloWorldBinding { * Retrieve the current stored value */ get(): Promise<{ - value: string; - ms?: number; - }>; + value: string + ms?: number + }> /** * Set a new stored value */ - set(value: string): Promise; + set(value: string): Promise } interface Hyperdrive { /** @@ -6431,122 +7437,151 @@ interface Hyperdrive { * code (or preferably, the client library of your choice) will authenticate * using the information in this class's readonly fields. */ - connect(): Socket; + connect(): Socket /** * A valid DB connection string that can be passed straight into the typical * client library/driver/ORM. This will typically be the easiest way to use * Hyperdrive. */ - readonly connectionString: string; + readonly connectionString: string /* * A randomly generated hostname that is only valid within the context of the * currently running Worker which, when passed into `connect()` function from * the "cloudflare:sockets" module, will connect to the Hyperdrive instance * for your database. */ - readonly host: string; + readonly host: string /* * The port that must be paired the the host field when connecting. */ - readonly port: number; + readonly port: number /* * The username to use when authenticating to your database via Hyperdrive. * Unlike the host and password, this will be the same every time */ - readonly user: string; + readonly user: string /* * The randomly generated password to use when authenticating to your * database via Hyperdrive. Like the host field, this password is only valid * within the context of the currently running Worker instance from which * it's read. */ - readonly password: string; + readonly password: string /* * The name of the database to connect to. */ - readonly database: string; + readonly database: string } // Copyright (c) 2024 Cloudflare, Inc. // Licensed under the Apache 2.0 license found in the LICENSE file or at: // https://opensource.org/licenses/Apache-2.0 -type ImageInfoResponse = { - format: 'image/svg+xml'; -} | { - format: string; - fileSize: number; - width: number; - height: number; -}; +type ImageInfoResponse = + | { + format: 'image/svg+xml' + } + | { + format: string + fileSize: number + width: number + height: number + } type ImageTransform = { - width?: number; - height?: number; - background?: string; - blur?: number; - border?: { - color?: string; - width?: number; - } | { - top?: number; - bottom?: number; - left?: number; - right?: number; - }; - brightness?: number; - contrast?: number; - fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop'; - flip?: 'h' | 'v' | 'hv'; - gamma?: number; - gravity?: 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | { - x?: number; - y?: number; - mode: 'remainder' | 'box-center'; - }; - rotate?: 0 | 90 | 180 | 270; - saturation?: number; - sharpen?: number; - trim?: 'border' | { - top?: number; - bottom?: number; - left?: number; - right?: number; - width?: number; - height?: number; - border?: boolean | { - color?: string; - tolerance?: number; - keep?: number; - }; - }; -}; + width?: number + height?: number + background?: string + blur?: number + border?: + | { + color?: string + width?: number + } + | { + top?: number + bottom?: number + left?: number + right?: number + } + brightness?: number + contrast?: number + fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop' + flip?: 'h' | 'v' | 'hv' + gamma?: number + gravity?: + | 'left' + | 'right' + | 'top' + | 'bottom' + | 'center' + | 'auto' + | 'entropy' + | { + x?: number + y?: number + mode: 'remainder' | 'box-center' + } + rotate?: 0 | 90 | 180 | 270 + saturation?: number + sharpen?: number + trim?: + | 'border' + | { + top?: number + bottom?: number + left?: number + right?: number + width?: number + height?: number + border?: + | boolean + | { + color?: string + tolerance?: number + keep?: number + } + } +} type ImageDrawOptions = { - opacity?: number; - repeat?: boolean | string; - top?: number; - left?: number; - bottom?: number; - right?: number; -}; + opacity?: number + repeat?: boolean | string + top?: number + left?: number + bottom?: number + right?: number +} type ImageInputOptions = { - encoding?: 'base64'; -}; + encoding?: 'base64' +} type ImageOutputOptions = { - format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba'; - quality?: number; - background?: string; -}; + format: + | 'image/jpeg' + | 'image/png' + | 'image/gif' + | 'image/webp' + | 'image/avif' + | 'rgb' + | 'rgba' + quality?: number + background?: string +} interface ImagesBinding { /** * Get image metadata (type, width and height) * @throws {@link ImagesError} with code 9412 if input is not an image * @param stream The image bytes */ - info(stream: ReadableStream, options?: ImageInputOptions): Promise; + info( + stream: ReadableStream, + options?: ImageInputOptions, + ): Promise /** * Begin applying a series of transformations to an image * @param stream The image bytes * @returns A transform handle */ - input(stream: ReadableStream, options?: ImageInputOptions): ImageTransformer; + input( + stream: ReadableStream, + options?: ImageInputOptions, + ): ImageTransformer } interface ImageTransformer { /** @@ -6554,86 +7589,106 @@ interface ImageTransformer { * You can then apply more transformations, draw, or retrieve the output. * @param transform */ - transform(transform: ImageTransform): ImageTransformer; + transform(transform: ImageTransform): ImageTransformer /** * Draw an image on this transformer, returning a transform handle. * You can then apply more transformations, draw, or retrieve the output. * @param image The image (or transformer that will give the image) to draw * @param options The options configuring how to draw the image */ - draw(image: ReadableStream | ImageTransformer, options?: ImageDrawOptions): ImageTransformer; + draw( + image: ReadableStream | ImageTransformer, + options?: ImageDrawOptions, + ): ImageTransformer /** * Retrieve the image that results from applying the transforms to the * provided input * @param options Options that apply to the output e.g. output format */ - output(options: ImageOutputOptions): Promise; + output(options: ImageOutputOptions): Promise } type ImageTransformationOutputOptions = { - encoding?: 'base64'; -}; + encoding?: 'base64' +} interface ImageTransformationResult { /** * The image as a response, ready to store in cache or return to users */ - response(): Response; + response(): Response /** * The content type of the returned image */ - contentType(): string; + contentType(): string /** * The bytes of the response */ - image(options?: ImageTransformationOutputOptions): ReadableStream; + image( + options?: ImageTransformationOutputOptions, + ): ReadableStream } interface ImagesError extends Error { - readonly code: number; - readonly message: string; - readonly stack?: string; + readonly code: number + readonly message: string + readonly stack?: string } -type Params

= Record; +type Params

= Record type EventContext = { - request: Request>; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; + request: Request> + functionPath: string + waitUntil: (promise: Promise) => void + passThroughOnException: () => void + next: (input?: Request | string, init?: RequestInit) => Promise env: Env & { ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; -}; -type PagesFunction = Record> = (context: EventContext) => Response | Promise; + fetch: typeof fetch + } + } + params: Params

+ data: Data +} +type PagesFunction< + Env = unknown, + Params extends string = any, + Data extends Record = Record, +> = (context: EventContext) => Response | Promise type EventPluginContext = { - request: Request>; - functionPath: string; - waitUntil: (promise: Promise) => void; - passThroughOnException: () => void; - next: (input?: Request | string, init?: RequestInit) => Promise; + request: Request> + functionPath: string + waitUntil: (promise: Promise) => void + passThroughOnException: () => void + next: (input?: Request | string, init?: RequestInit) => Promise env: Env & { ASSETS: { - fetch: typeof fetch; - }; - }; - params: Params

; - data: Data; - pluginArgs: PluginArgs; -}; -type PagesPluginFunction = Record, PluginArgs = unknown> = (context: EventPluginContext) => Response | Promise; -declare module "assets:*" { - export const onRequest: PagesFunction; + fetch: typeof fetch + } + } + params: Params

+ data: Data + pluginArgs: PluginArgs +} +type PagesPluginFunction< + Env = unknown, + Params extends string = any, + Data extends Record = Record, + PluginArgs = unknown, +> = ( + context: EventPluginContext, +) => Response | Promise +declare module 'assets:*' { + export const onRequest: PagesFunction } // Copyright (c) 2022-2023 Cloudflare, Inc. // Licensed under the Apache 2.0 license found in the LICENSE file or at: // https://opensource.org/licenses/Apache-2.0 -declare module "cloudflare:pipelines" { - export abstract class PipelineTransformationEntrypoint { - protected env: Env; - protected ctx: ExecutionContext; - constructor(ctx: ExecutionContext, env: Env); +declare module 'cloudflare:pipelines' { + export abstract class PipelineTransformationEntrypoint< + Env = unknown, + I extends PipelineRecord = PipelineRecord, + O extends PipelineRecord = PipelineRecord, + > { + protected env: Env + protected ctx: ExecutionContext + constructor(ctx: ExecutionContext, env: Env) /** * run recieves an array of PipelineRecord which can be * transformed and returned to the pipeline @@ -6641,20 +7696,20 @@ declare module "cloudflare:pipelines" { * @param metadata Information about the specific pipeline calling the transformation entrypoint * @returns A promise containing the transformed PipelineRecord array */ - public run(records: I[], metadata: PipelineBatchMetadata): Promise; + public run(records: I[], metadata: PipelineBatchMetadata): Promise } - export type PipelineRecord = Record; + export type PipelineRecord = Record export type PipelineBatchMetadata = { - pipelineId: string; - pipelineName: string; - }; + pipelineId: string + pipelineName: string + } export interface Pipeline { /** * The Pipeline interface represents the type of a binding to a Pipeline * * @param records The records to send to the pipeline */ - send(records: T[]): Promise; + send(records: T[]): Promise } } // PubSubMessage represents an incoming PubSub message. @@ -6663,39 +7718,39 @@ declare module "cloudflare:pipelines" { // https://developers.cloudflare.com/pub-sub/ interface PubSubMessage { // Message ID - readonly mid: number; + readonly mid: number // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT - readonly broker: string; + readonly broker: string // The MQTT topic the message was sent on. - readonly topic: string; + readonly topic: string // The client ID of the client that published this message. - readonly clientId: string; + readonly clientId: string // The unique identifier (JWT ID) used by the client to authenticate, if token // auth was used. - readonly jti?: string; + readonly jti?: string // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker // received the message from the client. - readonly receivedAt: number; + readonly receivedAt: number // An (optional) string with the MIME type of the payload, if set by the // client. - readonly contentType: string; + readonly contentType: string // Set to 1 when the payload is a UTF-8 string // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 - readonly payloadFormatIndicator: number; + readonly payloadFormatIndicator: number // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. // You can use payloadFormatIndicator to inspect this before decoding. - payload: string | Uint8Array; + payload: string | Uint8Array } // JsonWebKey extended by kid parameter interface JsonWebKeyWithKid extends JsonWebKey { // Key Identifier of the JWK - readonly kid: string; + readonly kid: string } interface RateLimitOptions { - key: string; + key: string } interface RateLimitOutcome { - success: boolean; + success: boolean } interface RateLimit { /** @@ -6703,7 +7758,7 @@ interface RateLimit { * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/ * @returns A promise that resolves with the outcome of the rate limit. */ - limit(options: RateLimitOptions): Promise; + limit(options: RateLimitOptions): Promise } // Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need // to referenced by `Fetcher`. This is included in the "importable" version of the types which @@ -6713,50 +7768,81 @@ declare namespace Rpc { // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`. // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape) - export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND'; - export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND'; - export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND'; - export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND'; - export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND'; + export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND' + export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND' + export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND' + export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND' + export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND' export interface RpcTargetBranded { - [__RPC_TARGET_BRAND]: never; + [__RPC_TARGET_BRAND]: never } export interface WorkerEntrypointBranded { - [__WORKER_ENTRYPOINT_BRAND]: never; + [__WORKER_ENTRYPOINT_BRAND]: never } export interface DurableObjectBranded { - [__DURABLE_OBJECT_BRAND]: never; + [__DURABLE_OBJECT_BRAND]: never } export interface WorkflowEntrypointBranded { - [__WORKFLOW_ENTRYPOINT_BRAND]: never; + [__WORKFLOW_ENTRYPOINT_BRAND]: never } - export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded; + export type EntrypointBranded = + | WorkerEntrypointBranded + | DurableObjectBranded + | WorkflowEntrypointBranded // Types that can be used through `Stub`s - export type Stubable = RpcTargetBranded | ((...args: any[]) => any); + export type Stubable = RpcTargetBranded | ((...args: any[]) => any) // Types that can be passed over RPC // The reason for using a generic type here is to build a serializable subset of structured // cloneable composite types. This allows types defined with the "interface" keyword to pass the // serializable check as well. Otherwise, only types defined with the "type" keyword would pass. - type Serializable = - // Structured cloneables - BaseType - // Structured cloneable composites - | Map ? Serializable : never, T extends Map ? Serializable : never> | Set ? Serializable : never> | ReadonlyArray ? Serializable : never> | { - [K in keyof T]: K extends number | string ? Serializable : never; - } - // Special types - | Stub - // Serialized as stubs, see `Stubify` - | Stubable; + type Serializable = + // Structured cloneables + | BaseType + // Structured cloneable composites + | Map< + T extends Map ? Serializable : never, + T extends Map ? Serializable : never + > + | Set ? Serializable : never> + | ReadonlyArray< + T extends ReadonlyArray ? Serializable : never + > + | { + [K in keyof T]: K extends number | string + ? Serializable + : never + } + // Special types + | Stub + // Serialized as stubs, see `Stubify` + | Stubable // Base type for all RPC stubs, including common memory management methods. // `T` is used as a marker type for unwrapping `Stub`s later. interface StubBase extends Disposable { - [__RPC_STUB_BRAND]: T; - dup(): this; + [__RPC_STUB_BRAND]: T + dup(): this } - export type Stub = Provider & StubBase; + export type Stub = Provider & StubBase // This represents all the types that can be sent as-is over an RPC boundary - type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream | WritableStream | Request | Response | Headers; + type BaseType = + | void + | undefined + | null + | boolean + | number + | bigint + | string + | TypedArray + | ArrayBuffer + | DataView + | Date + | Error + | RegExp + | ReadableStream + | WritableStream + | Request + | Response + | Headers // Recursively rewrite all `Stubable` types with `Stub`s // prettier-ignore type Stubify = T extends Stubable ? Stub : T extends Map ? Map, Stubify> : T extends Set ? Set> : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends BaseType ? T : T extends { @@ -6774,12 +7860,12 @@ declare namespace Rpc { [K in keyof T]: Unstubify; } : T; type UnstubifyAll = { - [I in keyof A]: Unstubify; - }; + [I in keyof A]: Unstubify + } // Utility type for adding `Provider`/`Disposable`s to `object` types only. // Note `unknown & T` is equivalent to `T`. - type MaybeProvider = T extends object ? Provider : unknown; - type MaybeDisposable = T extends object ? Disposable : unknown; + type MaybeProvider = T extends object ? Provider : unknown + type MaybeDisposable = T extends object ? Disposable : unknown // Type for method return or property on an RPC interface. // - Stubable types are replaced by stubs. // - Serializable types are passed by value, with stubable types replaced by stubs @@ -6794,284 +7880,382 @@ declare namespace Rpc { // Unwrapping `Stub`s allows calling with `Stubable` arguments. // For properties, rewrite types to be `Result`s. // In each case, unwrap `Promise`s. - type MethodOrProperty = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll

) => Result> : Result>; + type MethodOrProperty = V extends (...args: infer P) => infer R + ? (...args: UnstubifyAll

) => Result> + : Result> // Type for the callable part of an `Provider` if `T` is callable. // This is intersected with methods/properties. - type MaybeCallableProvider = T extends (...args: any[]) => any ? MethodOrProperty : unknown; + type MaybeCallableProvider = T extends (...args: any[]) => any + ? MethodOrProperty + : unknown // Base type for all other types providing RPC-like interfaces. // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types. // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC. - export type Provider = MaybeCallableProvider & { - [K in Exclude>]: MethodOrProperty; - }; + export type Provider< + T extends object, + Reserved extends string = never, + > = MaybeCallableProvider & { + [K in Exclude< + keyof T, + Reserved | symbol | keyof StubBase + >]: MethodOrProperty + } } declare namespace Cloudflare { - interface Env { - } + interface Env {} } declare module 'cloudflare:node' { export interface DefaultHandler { - fetch?(request: Request): Response | Promise; - tail?(events: TraceItem[]): void | Promise; - trace?(traces: TraceItem[]): void | Promise; - scheduled?(controller: ScheduledController): void | Promise; - queue?(batch: MessageBatch): void | Promise; - test?(controller: TestController): void | Promise; + fetch?(request: Request): Response | Promise + tail?(events: TraceItem[]): void | Promise + trace?(traces: TraceItem[]): void | Promise + scheduled?(controller: ScheduledController): void | Promise + queue?(batch: MessageBatch): void | Promise + test?(controller: TestController): void | Promise } - export function httpServerHandler(options: { - port: number; - }, handlers?: Omit): DefaultHandler; + export function httpServerHandler( + options: { + port: number + }, + handlers?: Omit, + ): DefaultHandler } declare module 'cloudflare:workers' { - export type RpcStub = Rpc.Stub; + export type RpcStub = Rpc.Stub export const RpcStub: { - new (value: T): Rpc.Stub; - }; + new (value: T): Rpc.Stub + } export abstract class RpcTarget implements Rpc.RpcTargetBranded { - [Rpc.__RPC_TARGET_BRAND]: never; + [Rpc.__RPC_TARGET_BRAND]: never } // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC - export abstract class WorkerEntrypoint implements Rpc.WorkerEntrypointBranded { - [Rpc.__WORKER_ENTRYPOINT_BRAND]: never; - protected ctx: ExecutionContext; - protected env: Env; - constructor(ctx: ExecutionContext, env: Env); - fetch?(request: Request): Response | Promise; - tail?(events: TraceItem[]): void | Promise; - trace?(traces: TraceItem[]): void | Promise; - scheduled?(controller: ScheduledController): void | Promise; - queue?(batch: MessageBatch): void | Promise; - test?(controller: TestController): void | Promise; + export abstract class WorkerEntrypoint + implements Rpc.WorkerEntrypointBranded + { + [Rpc.__WORKER_ENTRYPOINT_BRAND]: never + protected ctx: ExecutionContext + protected env: Env + constructor(ctx: ExecutionContext, env: Env) + fetch?(request: Request): Response | Promise + tail?(events: TraceItem[]): void | Promise + trace?(traces: TraceItem[]): void | Promise + scheduled?(controller: ScheduledController): void | Promise + queue?(batch: MessageBatch): void | Promise + test?(controller: TestController): void | Promise } - export abstract class DurableObject implements Rpc.DurableObjectBranded { - [Rpc.__DURABLE_OBJECT_BRAND]: never; - protected ctx: DurableObjectState; - protected env: Env; - constructor(ctx: DurableObjectState, env: Env); - fetch?(request: Request): Response | Promise; - alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise; - webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise; - webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise; - webSocketError?(ws: WebSocket, error: unknown): void | Promise; + export abstract class DurableObject + implements Rpc.DurableObjectBranded + { + [Rpc.__DURABLE_OBJECT_BRAND]: never + protected ctx: DurableObjectState + protected env: Env + constructor(ctx: DurableObjectState, env: Env) + fetch?(request: Request): Response | Promise + alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise + webSocketMessage?( + ws: WebSocket, + message: string | ArrayBuffer, + ): void | Promise + webSocketClose?( + ws: WebSocket, + code: number, + reason: string, + wasClean: boolean, + ): void | Promise + webSocketError?(ws: WebSocket, error: unknown): void | Promise } - export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; - export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number; - export type WorkflowDelayDuration = WorkflowSleepDuration; - export type WorkflowTimeoutDuration = WorkflowSleepDuration; - export type WorkflowRetentionDuration = WorkflowSleepDuration; - export type WorkflowBackoff = 'constant' | 'linear' | 'exponential'; + export type WorkflowDurationLabel = + | 'second' + | 'minute' + | 'hour' + | 'day' + | 'week' + | 'month' + | 'year' + export type WorkflowSleepDuration = + | `${number} ${WorkflowDurationLabel}${'s' | ''}` + | number + export type WorkflowDelayDuration = WorkflowSleepDuration + export type WorkflowTimeoutDuration = WorkflowSleepDuration + export type WorkflowRetentionDuration = WorkflowSleepDuration + export type WorkflowBackoff = 'constant' | 'linear' | 'exponential' export type WorkflowStepConfig = { retries?: { - limit: number; - delay: WorkflowDelayDuration | number; - backoff?: WorkflowBackoff; - }; - timeout?: WorkflowTimeoutDuration | number; - }; + limit: number + delay: WorkflowDelayDuration | number + backoff?: WorkflowBackoff + } + timeout?: WorkflowTimeoutDuration | number + } export type WorkflowEvent = { - payload: Readonly; - timestamp: Date; - instanceId: string; - }; + payload: Readonly + timestamp: Date + instanceId: string + } export type WorkflowStepEvent = { - payload: Readonly; - timestamp: Date; - type: string; - }; + payload: Readonly + timestamp: Date + type: string + } export abstract class WorkflowStep { - do>(name: string, callback: () => Promise): Promise; - do>(name: string, config: WorkflowStepConfig, callback: () => Promise): Promise; - sleep: (name: string, duration: WorkflowSleepDuration) => Promise; - sleepUntil: (name: string, timestamp: Date | number) => Promise; - waitForEvent>(name: string, options: { - type: string; - timeout?: WorkflowTimeoutDuration | number; - }): Promise>; + do>( + name: string, + callback: () => Promise, + ): Promise + do>( + name: string, + config: WorkflowStepConfig, + callback: () => Promise, + ): Promise + sleep: (name: string, duration: WorkflowSleepDuration) => Promise + sleepUntil: (name: string, timestamp: Date | number) => Promise + waitForEvent>( + name: string, + options: { + type: string + timeout?: WorkflowTimeoutDuration | number + }, + ): Promise> } - export abstract class WorkflowEntrypoint | unknown = unknown> implements Rpc.WorkflowEntrypointBranded { - [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never; - protected ctx: ExecutionContext; - protected env: Env; - constructor(ctx: ExecutionContext, env: Env); - run(event: Readonly>, step: WorkflowStep): Promise; + export abstract class WorkflowEntrypoint< + Env = unknown, + T extends Rpc.Serializable | unknown = unknown, + > implements Rpc.WorkflowEntrypointBranded + { + [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never + protected ctx: ExecutionContext + protected env: Env + constructor(ctx: ExecutionContext, env: Env) + run( + event: Readonly>, + step: WorkflowStep, + ): Promise } - export function waitUntil(promise: Promise): void; - export const env: Cloudflare.Env; + export function waitUntil(promise: Promise): void + export const env: Cloudflare.Env } interface SecretsStoreSecret { /** * Get a secret from the Secrets Store, returning a string of the secret value * if it exists, or throws an error if it does not exist */ - get(): Promise; + get(): Promise } -declare module "cloudflare:sockets" { - function _connect(address: string | SocketAddress, options?: SocketOptions): Socket; - export { _connect as connect }; +declare module 'cloudflare:sockets' { + function _connect( + address: string | SocketAddress, + options?: SocketOptions, + ): Socket + export { _connect as connect } } declare namespace TailStream { interface Header { - readonly name: string; - readonly value: string; + readonly name: string + readonly value: string } interface FetchEventInfo { - readonly type: "fetch"; - readonly method: string; - readonly url: string; - readonly cfJson?: object; - readonly headers: Header[]; + readonly type: 'fetch' + readonly method: string + readonly url: string + readonly cfJson?: object + readonly headers: Header[] } interface JsRpcEventInfo { - readonly type: "jsrpc"; - readonly methodName: string; + readonly type: 'jsrpc' + readonly methodName: string } interface ScheduledEventInfo { - readonly type: "scheduled"; - readonly scheduledTime: Date; - readonly cron: string; + readonly type: 'scheduled' + readonly scheduledTime: Date + readonly cron: string } interface AlarmEventInfo { - readonly type: "alarm"; - readonly scheduledTime: Date; + readonly type: 'alarm' + readonly scheduledTime: Date } interface QueueEventInfo { - readonly type: "queue"; - readonly queueName: string; - readonly batchSize: number; + readonly type: 'queue' + readonly queueName: string + readonly batchSize: number } interface EmailEventInfo { - readonly type: "email"; - readonly mailFrom: string; - readonly rcptTo: string; - readonly rawSize: number; + readonly type: 'email' + readonly mailFrom: string + readonly rcptTo: string + readonly rawSize: number } interface TraceEventInfo { - readonly type: "trace"; - readonly traces: (string | null)[]; + readonly type: 'trace' + readonly traces: (string | null)[] } interface HibernatableWebSocketEventInfoMessage { - readonly type: "message"; + readonly type: 'message' } interface HibernatableWebSocketEventInfoError { - readonly type: "error"; + readonly type: 'error' } interface HibernatableWebSocketEventInfoClose { - readonly type: "close"; - readonly code: number; - readonly wasClean: boolean; + readonly type: 'close' + readonly code: number + readonly wasClean: boolean } interface HibernatableWebSocketEventInfo { - readonly type: "hibernatableWebSocket"; - readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage; + readonly type: 'hibernatableWebSocket' + readonly info: + | HibernatableWebSocketEventInfoClose + | HibernatableWebSocketEventInfoError + | HibernatableWebSocketEventInfoMessage } interface Resume { - readonly type: "resume"; - readonly attachment?: any; + readonly type: 'resume' + readonly attachment?: any } interface CustomEventInfo { - readonly type: "custom"; + readonly type: 'custom' } interface FetchResponseInfo { - readonly type: "fetch"; - readonly statusCode: number; + readonly type: 'fetch' + readonly statusCode: number } - type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound"; + type EventOutcome = + | 'ok' + | 'canceled' + | 'exception' + | 'unknown' + | 'killSwitch' + | 'daemonDown' + | 'exceededCpu' + | 'exceededMemory' + | 'loadShed' + | 'responseStreamDisconnected' + | 'scriptNotFound' interface ScriptVersion { - readonly id: string; - readonly tag?: string; - readonly message?: string; + readonly id: string + readonly tag?: string + readonly message?: string } interface Trigger { - readonly traceId: string; - readonly invocationId: string; - readonly spanId: string; + readonly traceId: string + readonly invocationId: string + readonly spanId: string } interface Onset { - readonly type: "onset"; - readonly dispatchNamespace?: string; - readonly entrypoint?: string; - readonly executionModel: string; - readonly scriptName?: string; - readonly scriptTags?: string[]; - readonly scriptVersion?: ScriptVersion; - readonly trigger?: Trigger; - readonly info: FetchEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | Resume | CustomEventInfo; + readonly type: 'onset' + readonly dispatchNamespace?: string + readonly entrypoint?: string + readonly executionModel: string + readonly scriptName?: string + readonly scriptTags?: string[] + readonly scriptVersion?: ScriptVersion + readonly trigger?: Trigger + readonly info: + | FetchEventInfo + | JsRpcEventInfo + | ScheduledEventInfo + | AlarmEventInfo + | QueueEventInfo + | EmailEventInfo + | TraceEventInfo + | HibernatableWebSocketEventInfo + | Resume + | CustomEventInfo } interface Outcome { - readonly type: "outcome"; - readonly outcome: EventOutcome; - readonly cpuTime: number; - readonly wallTime: number; + readonly type: 'outcome' + readonly outcome: EventOutcome + readonly cpuTime: number + readonly wallTime: number } interface Hibernate { - readonly type: "hibernate"; + readonly type: 'hibernate' } interface SpanOpen { - readonly type: "spanOpen"; - readonly name: string; - readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes; + readonly type: 'spanOpen' + readonly name: string + readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes } interface SpanClose { - readonly type: "spanClose"; - readonly outcome: EventOutcome; + readonly type: 'spanClose' + readonly outcome: EventOutcome } interface DiagnosticChannelEvent { - readonly type: "diagnosticChannel"; - readonly channel: string; - readonly message: any; + readonly type: 'diagnosticChannel' + readonly channel: string + readonly message: any } interface Exception { - readonly type: "exception"; - readonly name: string; - readonly message: string; - readonly stack?: string; + readonly type: 'exception' + readonly name: string + readonly message: string + readonly stack?: string } interface Log { - readonly type: "log"; - readonly level: "debug" | "error" | "info" | "log" | "warn"; - readonly message: object; + readonly type: 'log' + readonly level: 'debug' | 'error' | 'info' | 'log' | 'warn' + readonly message: object } interface Return { - readonly type: "return"; - readonly info?: FetchResponseInfo; + readonly type: 'return' + readonly info?: FetchResponseInfo } interface Link { - readonly type: "link"; - readonly label?: string; - readonly traceId: string; - readonly invocationId: string; - readonly spanId: string; + readonly type: 'link' + readonly label?: string + readonly traceId: string + readonly invocationId: string + readonly spanId: string } interface Attribute { - readonly name: string; - readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[]; + readonly name: string + readonly value: + | string + | string[] + | boolean + | boolean[] + | number + | number[] + | bigint + | bigint[] } interface Attributes { - readonly type: "attributes"; - readonly info: Attribute[]; + readonly type: 'attributes' + readonly info: Attribute[] } - type EventType = Onset | Outcome | Hibernate | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | Return | Link | Attributes; + type EventType = + | Onset + | Outcome + | Hibernate + | SpanOpen + | SpanClose + | DiagnosticChannelEvent + | Exception + | Log + | Return + | Link + | Attributes interface TailEvent { - readonly invocationId: string; - readonly spanId: string; - readonly timestamp: Date; - readonly sequence: number; - readonly event: Event; + readonly invocationId: string + readonly spanId: string + readonly timestamp: Date + readonly sequence: number + readonly event: Event } - type TailEventHandler = (event: TailEvent) => void | Promise; + type TailEventHandler = ( + event: TailEvent, + ) => void | Promise type TailEventHandlerObject = { - outcome?: TailEventHandler; - hibernate?: TailEventHandler; - spanOpen?: TailEventHandler; - spanClose?: TailEventHandler; - diagnosticChannel?: TailEventHandler; - exception?: TailEventHandler; - log?: TailEventHandler; - return?: TailEventHandler; - link?: TailEventHandler; - attributes?: TailEventHandler; - }; - type TailEventHandlerType = TailEventHandler | TailEventHandlerObject; + outcome?: TailEventHandler + hibernate?: TailEventHandler + spanOpen?: TailEventHandler + spanClose?: TailEventHandler + diagnosticChannel?: TailEventHandler + exception?: TailEventHandler + log?: TailEventHandler + return?: TailEventHandler + link?: TailEventHandler + attributes?: TailEventHandler + } + type TailEventHandlerType = TailEventHandler | TailEventHandlerObject } // Copyright (c) 2022-2023 Cloudflare, Inc. // Licensed under the Apache 2.0 license found in the LICENSE file or at: @@ -7079,35 +8263,43 @@ declare namespace TailStream { /** * Data types supported for holding vector metadata. */ -type VectorizeVectorMetadataValue = string | number | boolean | string[]; +type VectorizeVectorMetadataValue = string | number | boolean | string[] /** * Additional information to associate with a vector. */ -type VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record; -type VectorFloatArray = Float32Array | Float64Array; +type VectorizeVectorMetadata = + | VectorizeVectorMetadataValue + | Record +type VectorFloatArray = Float32Array | Float64Array interface VectorizeError { - code?: number; - error: string; + code?: number + error: string } /** * Comparison logic/operation to use for metadata filtering. * * This list is expected to grow as support for more operations are released. */ -type VectorizeVectorMetadataFilterOp = "$eq" | "$ne"; +type VectorizeVectorMetadataFilterOp = '$eq' | '$ne' /** * Filter criteria for vector metadata used to limit the retrieved query result set. */ type VectorizeVectorMetadataFilter = { - [field: string]: Exclude | null | { - [Op in VectorizeVectorMetadataFilterOp]?: Exclude | null; - }; -}; + [field: string]: + | Exclude + | null + | { + [Op in VectorizeVectorMetadataFilterOp]?: Exclude< + VectorizeVectorMetadataValue, + string[] + > | null + } +} /** * Supported distance metrics for an index. * Distance metrics determine how other "similar" vectors are determined. */ -type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product"; +type VectorizeDistanceMetric = 'euclidean' | 'cosine' | 'dot-product' /** * Metadata return levels for a Vectorize query. * @@ -7117,23 +8309,25 @@ type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product"; * @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). * @property none No indexed metadata will be returned. */ -type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none"; +type VectorizeMetadataRetrievalLevel = 'all' | 'indexed' | 'none' interface VectorizeQueryOptions { - topK?: number; - namespace?: string; - returnValues?: boolean; - returnMetadata?: boolean | VectorizeMetadataRetrievalLevel; - filter?: VectorizeVectorMetadataFilter; + topK?: number + namespace?: string + returnValues?: boolean + returnMetadata?: boolean | VectorizeMetadataRetrievalLevel + filter?: VectorizeVectorMetadataFilter } /** * Information about the configuration of an index. */ -type VectorizeIndexConfig = { - dimensions: number; - metric: VectorizeDistanceMetric; -} | { - preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity -}; +type VectorizeIndexConfig = + | { + dimensions: number + metric: VectorizeDistanceMetric + } + | { + preset: string // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity + } /** * Metadata about an existing index. * @@ -7142,55 +8336,56 @@ type VectorizeIndexConfig = { */ interface VectorizeIndexDetails { /** The unique ID of the index */ - readonly id: string; + readonly id: string /** The name of the index. */ - name: string; + name: string /** (optional) A human readable description for the index. */ - description?: string; + description?: string /** The index configuration, including the dimension size and distance metric. */ - config: VectorizeIndexConfig; + config: VectorizeIndexConfig /** The number of records containing vectors within the index. */ - vectorsCount: number; + vectorsCount: number } /** * Metadata about an existing index. */ interface VectorizeIndexInfo { /** The number of records containing vectors within the index. */ - vectorCount: number; + vectorCount: number /** Number of dimensions the index has been configured for. */ - dimensions: number; + dimensions: number /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */ - processedUpToDatetime: number; + processedUpToDatetime: number /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */ - processedUpToMutation: number; + processedUpToMutation: number } /** * Represents a single vector value set along with its associated metadata. */ interface VectorizeVector { /** 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. */ - id: string; + id: string /** The vector values */ - values: VectorFloatArray | number[]; + values: VectorFloatArray | number[] /** The namespace this vector belongs to. */ - namespace?: string; + namespace?: string /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */ - metadata?: Record; + metadata?: Record } /** * Represents a matched vector for a query along with its score and (if specified) the matching vector information. */ -type VectorizeMatch = Pick, "values"> & Omit & { - /** The score or rank for similarity, when returned as a result */ - score: number; -}; +type VectorizeMatch = Pick, 'values'> & + Omit & { + /** The score or rank for similarity, when returned as a result */ + score: number + } /** * A set of matching {@link VectorizeMatch} for a particular query. */ interface VectorizeMatches { - matches: VectorizeMatch[]; - count: number; + matches: VectorizeMatch[] + count: number } /** * Results of an operation that performed a mutation on a set of vectors. @@ -7201,9 +8396,9 @@ interface VectorizeMatches { */ interface VectorizeVectorMutation { /* List of ids of vectors that were successfully processed. */ - ids: string[]; + ids: string[] /* Total count of the number of processed vectors. */ - count: number; + count: number } /** * Result type indicating a mutation on the Vectorize Index. @@ -7211,7 +8406,7 @@ interface VectorizeVectorMutation { */ interface VectorizeAsyncMutation { /** The unique identifier for the async mutation operation containing the changeset. */ - mutationId: string; + mutationId: string } /** * A Vectorize Vector Search Index for querying vectors/embeddings. @@ -7224,38 +8419,41 @@ declare abstract class VectorizeIndex { * Get information about the currently bound index. * @returns A promise that resolves with information about the current index. */ - public describe(): Promise; + public describe(): Promise /** * Use the provided vector to perform a similarity search across the index. * @param vector Input vector that will be used to drive the similarity search. * @param options Configuration options to massage the returned data. * @returns A promise that resolves with matched and scored vectors. */ - public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise; + public query( + vector: VectorFloatArray | number[], + options?: VectorizeQueryOptions, + ): Promise /** * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown. * @param vectors List of vectors that will be inserted. * @returns A promise that resolves with the ids & count of records that were successfully processed. */ - public insert(vectors: VectorizeVector[]): Promise; + public insert(vectors: VectorizeVector[]): Promise /** * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values. * @param vectors List of vectors that will be upserted. * @returns A promise that resolves with the ids & count of records that were successfully processed. */ - public upsert(vectors: VectorizeVector[]): Promise; + public upsert(vectors: VectorizeVector[]): Promise /** * Delete a list of vectors with a matching id. * @param ids List of vector ids that should be deleted. * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted). */ - public deleteByIds(ids: string[]): Promise; + public deleteByIds(ids: string[]): Promise /** * Get a list of vectors with a matching id. * @param ids List of vector ids that should be returned. * @returns A promise that resolves with the raw unscored vectors matching the id set. */ - public getByIds(ids: string[]): Promise; + public getByIds(ids: string[]): Promise } /** * A Vectorize Vector Search Index for querying vectors/embeddings. @@ -7267,45 +8465,51 @@ declare abstract class Vectorize { * Get information about the currently bound index. * @returns A promise that resolves with information about the current index. */ - public describe(): Promise; + public describe(): Promise /** * Use the provided vector to perform a similarity search across the index. * @param vector Input vector that will be used to drive the similarity search. * @param options Configuration options to massage the returned data. * @returns A promise that resolves with matched and scored vectors. */ - public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise; + public query( + vector: VectorFloatArray | number[], + options?: VectorizeQueryOptions, + ): Promise /** * Use the provided vector-id to perform a similarity search across the index. * @param vectorId Id for a vector in the index against which the index should be queried. * @param options Configuration options to massage the returned data. * @returns A promise that resolves with matched and scored vectors. */ - public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise; + public queryById( + vectorId: string, + options?: VectorizeQueryOptions, + ): Promise /** * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown. * @param vectors List of vectors that will be inserted. * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset. */ - public insert(vectors: VectorizeVector[]): Promise; + public insert(vectors: VectorizeVector[]): Promise /** * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values. * @param vectors List of vectors that will be upserted. * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset. */ - public upsert(vectors: VectorizeVector[]): Promise; + public upsert(vectors: VectorizeVector[]): Promise /** * Delete a list of vectors with a matching id. * @param ids List of vector ids that should be deleted. * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset. */ - public deleteByIds(ids: string[]): Promise; + public deleteByIds(ids: string[]): Promise /** * Get a list of vectors with a matching id. * @param ids List of vector ids that should be returned. * @returns A promise that resolves with the raw unscored vectors matching the id set. */ - public getByIds(ids: string[]): Promise; + public getByIds(ids: string[]): Promise } /** * The interface for "version_metadata" binding @@ -7313,45 +8517,49 @@ declare abstract class Vectorize { */ type WorkerVersionMetadata = { /** The ID of the Worker Version using this binding */ - id: string; + id: string /** The tag of the Worker Version using this binding */ - tag: string; + tag: string /** The timestamp of when the Worker Version was uploaded */ - timestamp: string; -}; + timestamp: string +} interface DynamicDispatchLimits { /** * Limit CPU time in milliseconds. */ - cpuMs?: number; + cpuMs?: number /** * Limit number of subrequests. */ - subRequests?: number; + subRequests?: number } interface DynamicDispatchOptions { /** * Limit resources of invoked Worker script. */ - limits?: DynamicDispatchLimits; + limits?: DynamicDispatchLimits /** * Arguments for outbound Worker script, if configured. */ outbound?: { - [key: string]: any; - }; + [key: string]: any + } } interface DispatchNamespace { /** - * @param name Name of the Worker script. - * @param args Arguments to Worker script. - * @param options Options for Dynamic Dispatch invocation. - * @returns A Fetcher object that allows you to send requests to the Worker script. - * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown. - */ - get(name: string, args?: { - [key: string]: any; - }, options?: DynamicDispatchOptions): Fetcher; + * @param name Name of the Worker script. + * @param args Arguments to Worker script. + * @param options Options for Dynamic Dispatch invocation. + * @returns A Fetcher object that allows you to send requests to the Worker script. + * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown. + */ + get( + name: string, + args?: { + [key: string]: any + }, + options?: DynamicDispatchOptions, + ): Fetcher } declare module 'cloudflare:workflows' { /** @@ -7359,7 +8567,7 @@ declare module 'cloudflare:workflows' { * that makes a Workflow instance fail immediately without triggering a retry */ export class NonRetryableError extends Error { - public constructor(message: string, name?: string); + public constructor(message: string, name?: string) } } declare abstract class Workflow { @@ -7368,82 +8576,103 @@ declare abstract class Workflow { * @param id Id for the instance of this Workflow * @returns A promise that resolves with a handle for the Instance */ - public get(id: string): Promise; + public get(id: string): Promise /** * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown. * @param options Options when creating an instance including id and params * @returns A promise that resolves with a handle for the Instance */ - public create(options?: WorkflowInstanceCreateOptions): Promise; + public create( + options?: WorkflowInstanceCreateOptions, + ): Promise /** * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown. * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached. * @param batch List of Options when creating an instance including name and params * @returns A promise that resolves with a list of handles for the created instances. */ - public createBatch(batch: WorkflowInstanceCreateOptions[]): Promise; -} -type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; -type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number; -type WorkflowRetentionDuration = WorkflowSleepDuration; + public createBatch( + batch: WorkflowInstanceCreateOptions[], + ): Promise +} +type WorkflowDurationLabel = + | 'second' + | 'minute' + | 'hour' + | 'day' + | 'week' + | 'month' + | 'year' +type WorkflowSleepDuration = + | `${number} ${WorkflowDurationLabel}${'s' | ''}` + | number +type WorkflowRetentionDuration = WorkflowSleepDuration interface WorkflowInstanceCreateOptions { /** * An id for your Workflow instance. Must be unique within the Workflow. */ - id?: string; + id?: string /** * The event payload the Workflow instance is triggered with */ - params?: PARAMS; + params?: PARAMS /** * The retention policy for Workflow instance. * Defaults to the maximum retention period available for the owner's account. */ retention?: { - successRetention?: WorkflowRetentionDuration; - errorRetention?: WorkflowRetentionDuration; - }; + successRetention?: WorkflowRetentionDuration + errorRetention?: WorkflowRetentionDuration + } } type InstanceStatus = { - status: 'queued' // means that instance is waiting to be started (see concurrency limits) - | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running - | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish - | 'waitingForPause' // instance is finishing the current work to pause - | 'unknown'; - error?: string; - output?: object; -}; + status: + | 'queued' // means that instance is waiting to be started (see concurrency limits) + | 'running' + | 'paused' + | 'errored' + | 'terminated' // user terminated the instance while it was running + | 'complete' + | 'waiting' // instance is hibernating and waiting for sleep or event to finish + | 'waitingForPause' // instance is finishing the current work to pause + | 'unknown' + error?: string + output?: object +} interface WorkflowError { - code?: number; - message: string; + code?: number + message: string } declare abstract class WorkflowInstance { - public id: string; + public id: string /** * Pause the instance. */ - public pause(): Promise; + public pause(): Promise /** * Resume the instance. If it is already running, an error will be thrown. */ - public resume(): Promise; + public resume(): Promise /** * Terminate the instance. If it is errored, terminated or complete, an error will be thrown. */ - public terminate(): Promise; + public terminate(): Promise /** * Restart the instance. */ - public restart(): Promise; + public restart(): Promise /** * Returns the current status of the instance. */ - public status(): Promise; + public status(): Promise /** * Send an event to this instance. */ - public sendEvent({ type, payload, }: { - type: string; - payload: unknown; - }): Promise; + public sendEvent({ + type, + payload, + }: { + type: string + payload: unknown + }): Promise } diff --git a/mcp-worker/wrangler.toml b/mcp-worker/wrangler.toml index 3a05dbc4d..d6e8453ca 100644 --- a/mcp-worker/wrangler.toml +++ b/mcp-worker/wrangler.toml @@ -35,10 +35,11 @@ ENABLE_OUTPUT_SCHEMAS = "false" # Secrets (set via: wrangler secret put ) # AUTH0_CLIENT_ID # AUTH0_CLIENT_SECRET +# ABLY_API_KEY # AI binding for future features (not currently used) -# [ai] -# binding = "AI" +[ai] +binding = "AI" # Observability [observability] diff --git a/yarn.lock b/yarn.lock index 5195f3675..4557c61f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,6 +5,15 @@ __metadata: version: 8 cacheKey: 10c0 +"@ably/msgpack-js@npm:^0.4.0": + version: 0.4.1 + resolution: "@ably/msgpack-js@npm:0.4.1" + dependencies: + bops: "npm:^1.0.1" + checksum: 10c0/5db069679d699f1bf6e32fe2a4c5d47940574062d06aada96d4685df353b3b4dfa82c1168b80620c6a4af67bef05e1acf778cd72409d2fa21376da8ff9d602e9 + languageName: node + linkType: hard + "@ai-sdk/provider-utils@npm:2.2.8": version: 2.2.8 resolution: "@ai-sdk/provider-utils@npm:2.2.8" @@ -793,6 +802,7 @@ __metadata: resolution: "@devcycle/mcp-worker@workspace:mcp-worker" dependencies: "@cloudflare/workers-oauth-provider": "npm:^0.0.5" + ably: "npm:^1.2.48" agents: "npm:^0.0.111" hono: "npm:^4.8.12" jose: "npm:^6.0.12" @@ -2755,6 +2765,25 @@ __metadata: languageName: node linkType: hard +"ably@npm:^1.2.48": + version: 1.2.50 + resolution: "ably@npm:1.2.50" + dependencies: + "@ably/msgpack-js": "npm:^0.4.0" + got: "npm:^11.8.5" + ws: "npm:^8.14.2" + peerDependencies: + react: ">=16.8.0" + react-dom: ">=16.8.0" + peerDependenciesMeta: + react: + optional: true + react-dom: + optional: true + checksum: 10c0/4ec4ba693ca428cb80d5d5802a4be1669aa22af0969b0cff6265a90cb8b2fc0429e41d274fd05c591c7d4e3c40fe01a3581558e0d7b572ea22ada0c09814eb67 + languageName: node + linkType: hard + "abort-controller@npm:^3.0.0": version: 3.0.0 resolution: "abort-controller@npm:3.0.0" @@ -3209,6 +3238,13 @@ __metadata: languageName: node linkType: hard +"base64-js@npm:1.0.2": + version: 1.0.2 + resolution: "base64-js@npm:1.0.2" + checksum: 10c0/68b7c8e3a22f81db6398bfe805174516037dcaf13672251dbb1ef8c9030b0305d4f869a0ed9d3df2ee062d747ee7e15cf14bbfdcfdf7f3427674dabcc901dea7 + languageName: node + linkType: hard + "base64-js@npm:^1.0.2, base64-js@npm:^1.3.1": version: 1.5.1 resolution: "base64-js@npm:1.5.1" @@ -3286,6 +3322,16 @@ __metadata: languageName: node linkType: hard +"bops@npm:^1.0.1": + version: 1.0.1 + resolution: "bops@npm:1.0.1" + dependencies: + base64-js: "npm:1.0.2" + to-utf8: "npm:0.0.1" + checksum: 10c0/32bbeb9d830107e52735c20e59ee1b12de28717b1d1eecfda2c270ee025a21147522e955786dd3e28a80a8282fa674114cf8302fd28c919b91f3ff7f91f11fd6 + languageName: node + linkType: hard + "brace-expansion@npm:^1.1.7": version: 1.1.12 resolution: "brace-expansion@npm:1.1.12" @@ -5504,7 +5550,7 @@ __metadata: languageName: node linkType: hard -"got@npm:^11": +"got@npm:^11, got@npm:^11.8.5": version: 11.8.6 resolution: "got@npm:11.8.6" dependencies: @@ -9802,6 +9848,13 @@ __metadata: languageName: node linkType: hard +"to-utf8@npm:0.0.1": + version: 0.0.1 + resolution: "to-utf8@npm:0.0.1" + checksum: 10c0/f04e6fa701ad56f103c575d20d4a6a5b65ea52449b7c0846382c4219b8017541fecbec8c49bf4563fb10700d9a23cb03d4857d8de91de00baabb0b4d4b8f9c46 + languageName: node + linkType: hard + "toidentifier@npm:1.0.1": version: 1.0.1 resolution: "toidentifier@npm:1.0.1" @@ -10582,6 +10635,21 @@ __metadata: languageName: node linkType: hard +"ws@npm:^8.14.2": + version: 8.18.3 + resolution: "ws@npm:8.18.3" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ">=5.0.2" + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 10c0/eac918213de265ef7cb3d4ca348b891a51a520d839aa51cdb8ca93d4fa7ff9f6ccb339ccee89e4075324097f0a55157c89fa3f7147bde9d8d7e90335dc087b53 + languageName: node + linkType: hard + "xml2js@npm:0.6.2": version: 0.6.2 resolution: "xml2js@npm:0.6.2" From fb6401290e9bceec16dd9934bd142c78a5bbd9e4 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Thu, 21 Aug 2025 15:27:37 -0400 Subject: [PATCH 2/9] fix: updates from PR comments --- mcp-worker/src/{telemetry.ts => ably.ts} | 5 +---- mcp-worker/src/auth.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 7 deletions(-) rename mcp-worker/src/{telemetry.ts => ably.ts} (89%) diff --git a/mcp-worker/src/telemetry.ts b/mcp-worker/src/ably.ts similarity index 89% rename from mcp-worker/src/telemetry.ts rename to mcp-worker/src/ably.ts index 53e401dc5..55db10f27 100644 --- a/mcp-worker/src/telemetry.ts +++ b/mcp-worker/src/ably.ts @@ -17,10 +17,6 @@ export async function publishMCPInstallEvent( try { const ably = new Ably.Rest.Promise({ key: env.ABLY_API_KEY }) const ablyChannel = ably.channels.get(channel) - console.log( - `Publishing "mcp-install" event to Ably channel: ${channel}`, - claims, - ) await ablyChannel.publish('mcp-install', claims) console.log( `Successfully published "mcp-install" event to Ably channel: ${channel}`, @@ -33,5 +29,6 @@ export async function publishMCPInstallEvent( : { message: String(error) }, channel, }) + throw error } } diff --git a/mcp-worker/src/auth.ts b/mcp-worker/src/auth.ts index d297d41d5..b89916d22 100644 --- a/mcp-worker/src/auth.ts +++ b/mcp-worker/src/auth.ts @@ -3,8 +3,7 @@ import { Hono } from 'hono' import { getCookie, setCookie } from 'hono/cookie' import * as oauth from 'oauth4webapi' import type { UserProps } from './types' -import type { DevCycleJWTClaims } from './types' -import { publishMCPInstallEvent } from './telemetry' +import { publishMCPInstallEvent } from './ably' import { OAuthHelpers } from '@cloudflare/workers-oauth-provider' import type { AuthRequest, @@ -306,7 +305,13 @@ export async function callback( userId: claims.sub!, }) - c.executionCtx.waitUntil(publishMCPInstallEvent(c.env, claims)) + c.executionCtx.waitUntil(async () => { + try { + await publishMCPInstallEvent(c.env, claims) + } catch (error) { + console.error('Error publishing MCP install event', error) + } + }) return Response.redirect(redirectTo, 302) } From 12c76fb50e414318ab92bfd772640ec172d9cd81 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Thu, 21 Aug 2025 16:13:30 -0400 Subject: [PATCH 3/9] refactor: simplify ably event publishing --- mcp-worker/src/ably.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mcp-worker/src/ably.ts b/mcp-worker/src/ably.ts index 55db10f27..3535daa91 100644 --- a/mcp-worker/src/ably.ts +++ b/mcp-worker/src/ably.ts @@ -17,7 +17,12 @@ export async function publishMCPInstallEvent( try { const ably = new Ably.Rest.Promise({ key: env.ABLY_API_KEY }) const ablyChannel = ably.channels.get(channel) - await ablyChannel.publish('mcp-install', claims) + const payload = { + org_id: claims.org_id, + name: claims.name, + email: claims.email, + } + await ablyChannel.publish('mcp-install', payload) console.log( `Successfully published "mcp-install" event to Ably channel: ${channel}`, ) From 67702cc0aa18430e7bfe2c488fff168339a4ddef Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Thu, 21 Aug 2025 16:37:23 -0400 Subject: [PATCH 4/9] test: add worker Ably publish tests and vitest setup --- mcp-worker/package.json | 52 ++++++++++-------- mcp-worker/src/ably.test.ts | 107 ++++++++++++++++++++++++++++++++++++ mcp-worker/tsconfig.json | 1 + 3 files changed, 136 insertions(+), 24 deletions(-) create mode 100644 mcp-worker/src/ably.test.ts diff --git a/mcp-worker/package.json b/mcp-worker/package.json index 241f6f8d4..42f354705 100644 --- a/mcp-worker/package.json +++ b/mcp-worker/package.json @@ -1,26 +1,30 @@ { - "name": "@devcycle/mcp-worker", - "version": "1.0.0", - "private": true, - "type": "module", - "scripts": { - "dev": "wrangler dev", - "deploy": "wrangler deploy", - "deploy:dev": "wrangler deploy --env dev", - "build": "tsc", - "type-check": "tsc --noEmit", - "cf-typegen": "wrangler types" - }, - "dependencies": { - "@cloudflare/workers-oauth-provider": "^0.0.5", - "ably": "^1.2.48", - "agents": "^0.0.111", - "hono": "^4.8.12", - "jose": "^6.0.12", - "oauth4webapi": "^3.6.1" - }, - "devDependencies": { - "wrangler": "^4.28.0" - }, - "packageManager": "yarn@4.9.2" + "name": "@devcycle/mcp-worker", + "version": "1.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "wrangler dev", + "deploy": "wrangler deploy", + "deploy:dev": "wrangler deploy --env dev", + "build": "tsc", + "type-check": "tsc --noEmit", + "cf-typegen": "wrangler types", + "test": "vitest run", + "test:watch": "vitest" + }, + "dependencies": { + "@cloudflare/workers-oauth-provider": "^0.0.5", + "ably": "^1.2.48", + "agents": "^0.0.111", + "hono": "^4.8.12", + "jose": "^6.0.12", + "oauth4webapi": "^3.6.1" + }, + "devDependencies": { + "@types/node": "^24.3.0", + "vitest": "^3.2.4", + "wrangler": "^4.31.0" + }, + "packageManager": "yarn@4.9.2" } diff --git a/mcp-worker/src/ably.test.ts b/mcp-worker/src/ably.test.ts new file mode 100644 index 000000000..475b19158 --- /dev/null +++ b/mcp-worker/src/ably.test.ts @@ -0,0 +1,107 @@ +import { afterEach, describe, expect, test, vi } from 'vitest' + +// Lock Ably import and shape +vi.mock('ably/build/ably-webworker.min', () => { + const publish = vi.fn() + const channelsGet = vi.fn(() => ({ publish })) + const channels = { get: channelsGet } + + class RestPromiseMock { + public static Promise = vi.fn(() => new RestPromiseMock()) + public channels = channels + } + + return { default: { Rest: RestPromiseMock } } +}) + +import Ably from 'ably/build/ably-webworker.min' +import { publishMCPInstallEvent } from './ably' + +const getMocks = () => { + const Rest = (Ably as any).Rest as { Promise: any } + const instance = + Rest.Promise.mock.results[Rest.Promise.mock.results.length - 1]?.value + const channelsGet = instance?.channels.get as ReturnType + const publish = channelsGet?.mock.results[0]?.value.publish as ReturnType< + typeof vi.fn + > + return { Rest, instance, channelsGet, publish } +} + +afterEach(() => { + vi.clearAllMocks() +}) + +describe('publishMCPInstallEvent', () => { + test('publishes correct channel and payload', async () => { + const env = { ABLY_API_KEY: 'key-123' } + const claims = { + org_id: 'org_abc', + email: 'u@example.com', + name: 'User', + } + + await publishMCPInstallEvent(env, claims as any) + + const { Rest, instance, channelsGet, publish } = getMocks() + + expect(Rest.Promise).toHaveBeenCalledWith({ key: env.ABLY_API_KEY }) + expect(instance).toBeDefined() + expect(channelsGet).toHaveBeenCalledWith('org_abc-mcp-install') + expect(publish).toHaveBeenCalledWith('mcp-install', { + org_id: 'org_abc', + name: 'User', + email: 'u@example.com', + }) + }) + + test('throws when ABLY_API_KEY missing', async () => { + await expect( + publishMCPInstallEvent({}, { + org_id: 'o', + name: 'N', + email: 'e', + } as any), + ).rejects.toThrow('ABLY_API_KEY is required to publish MCP events') + }) + + test('throws when org_id missing', async () => { + await expect( + publishMCPInstallEvent({ ABLY_API_KEY: 'k' }, { + name: 'N', + email: 'e', + } as any), + ).rejects.toThrow('org_id is required in claims to publish MCP events') + }) + + test('logs and rethrows on publish error', async () => { + const consoleErrorSpy = vi + .spyOn(console, 'error') + .mockImplementation(() => {}) + + const env = { ABLY_API_KEY: 'key-123' } + const claims = { + org_id: 'org_abc', + email: 'u@example.com', + name: 'User', + } + + // Arrange the mock chain to throw on publish + const Rest = (await import('ably/build/ably-webworker.min')).default + .Rest as any + const instance = Rest.Promise() + const channelsGet = vi.spyOn(instance.channels, 'get') + channelsGet.mockReturnValue({ + publish: vi.fn(async () => { + throw new Error('boom') + }), + }) + + await expect( + publishMCPInstallEvent(env, claims as any), + ).rejects.toThrow('boom') + expect(consoleErrorSpy).toHaveBeenCalled() + + consoleErrorSpy.mockRestore() + }) +}) diff --git a/mcp-worker/tsconfig.json b/mcp-worker/tsconfig.json index 50fe540d6..bda7d7450 100644 --- a/mcp-worker/tsconfig.json +++ b/mcp-worker/tsconfig.json @@ -5,6 +5,7 @@ "rootDir": "../", "noEmit": true, "types": [ + "vitest/globals", "node" ], "lib": ["ES2022"], From 311a456b165448d6081594f63f981ac8b971c610 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Thu, 21 Aug 2025 16:38:35 -0400 Subject: [PATCH 5/9] chore: pin estree types, remove test tsconfig, set TS_NODE_PROJECT, enable composite --- package.json | 9 +- test-utils/init.js | 2 +- test/tsconfig.json | 7 - tsconfig.json | 1 + yarn.lock | 1001 +++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 953 insertions(+), 67 deletions(-) delete mode 100644 test/tsconfig.json diff --git a/package.json b/package.json index 32fab8f87..2949f736e 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "posttest": "yarn lint", "prepack": "yarn build && oclif readme --multi", "pretest": "yarn format:check", - "test": "mocha test/*.ts \"src/**/*.test.ts\"", - "test:ci": "yarn test --forbid-only", + "test": "mocha test/*.ts \"src/**/*.test.ts\" && yarn workspace @devcycle/mcp-worker test", + "test:ci": "mocha --forbid-only test/*.ts \"src/**/*.test.ts\" && yarn workspace @devcycle/mcp-worker test", "test:update-snapshots": "UPDATE_SNAPSHOT=1 yarn test", "version": "oclif readme --multi && git add README.md" }, @@ -161,6 +161,9 @@ "nanoid@3.3.1": "3.3.8", "serialize-javascript@6.0.0": "^6.0.2", "tmp": "0.2.5", - "zod": "3.24.1" + "zod": "3.24.1", + "@types/estree": "1.0.5", + "estraverse": "5.3.0", + "@types/estraverse": "5.1.7" } } diff --git a/test-utils/init.js b/test-utils/init.js index 338e715a2..fd5479df2 100644 --- a/test-utils/init.js +++ b/test-utils/init.js @@ -1,5 +1,5 @@ const path = require('path') -process.env.TS_NODE_PROJECT = path.resolve('test/tsconfig.json') +process.env.TS_NODE_PROJECT = path.resolve('tsconfig.json') process.env.NODE_ENV = 'development' global.oclif = global.oclif || {} diff --git a/test/tsconfig.json b/test/tsconfig.json deleted file mode 100644 index 6491e6ab8..000000000 --- a/test/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../tsconfig", - "compilerOptions": { - "noEmit": true - }, - "references": [{ "path": ".." }] -} diff --git a/tsconfig.json b/tsconfig.json index f9bc06b72..0a811006a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,6 +21,7 @@ "resolveJsonModule": true, "isolatedModules": true, "incremental": true, + "composite": true, "tsBuildInfoFile": "./dist/.tsbuildinfo" }, "include": ["src/**/*"], diff --git a/yarn.lock b/yarn.lock index 4557c61f3..19d9c7556 100644 --- a/yarn.lock +++ b/yarn.lock @@ -657,50 +657,50 @@ __metadata: languageName: node linkType: hard -"@cloudflare/unenv-preset@npm:2.6.0": - version: 2.6.0 - resolution: "@cloudflare/unenv-preset@npm:2.6.0" +"@cloudflare/unenv-preset@npm:2.6.2": + version: 2.6.2 + resolution: "@cloudflare/unenv-preset@npm:2.6.2" peerDependencies: unenv: 2.0.0-rc.19 workerd: ^1.20250802.0 peerDependenciesMeta: workerd: optional: true - checksum: 10c0/5c8211828911a9c04baa2f3c48f2a13a790bc5c7ca9d3b66cda6655185ee7849cb92750f347f48c1edfa195d71f6cf11c399fb1e85bcda32ee312eb2247cf2ab + checksum: 10c0/d9230c241551f09abf25c61205ad300da7f834c16b431f69facae34e52ca66a46f7844b3d32bfff799c93337b3ab612eeb35841f1836f94bc747f17c0947cd44 languageName: node linkType: hard -"@cloudflare/workerd-darwin-64@npm:1.20250803.0": - version: 1.20250803.0 - resolution: "@cloudflare/workerd-darwin-64@npm:1.20250803.0" +"@cloudflare/workerd-darwin-64@npm:1.20250816.0": + version: 1.20250816.0 + resolution: "@cloudflare/workerd-darwin-64@npm:1.20250816.0" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@cloudflare/workerd-darwin-arm64@npm:1.20250803.0": - version: 1.20250803.0 - resolution: "@cloudflare/workerd-darwin-arm64@npm:1.20250803.0" +"@cloudflare/workerd-darwin-arm64@npm:1.20250816.0": + version: 1.20250816.0 + resolution: "@cloudflare/workerd-darwin-arm64@npm:1.20250816.0" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@cloudflare/workerd-linux-64@npm:1.20250803.0": - version: 1.20250803.0 - resolution: "@cloudflare/workerd-linux-64@npm:1.20250803.0" +"@cloudflare/workerd-linux-64@npm:1.20250816.0": + version: 1.20250816.0 + resolution: "@cloudflare/workerd-linux-64@npm:1.20250816.0" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@cloudflare/workerd-linux-arm64@npm:1.20250803.0": - version: 1.20250803.0 - resolution: "@cloudflare/workerd-linux-arm64@npm:1.20250803.0" +"@cloudflare/workerd-linux-arm64@npm:1.20250816.0": + version: 1.20250816.0 + resolution: "@cloudflare/workerd-linux-arm64@npm:1.20250816.0" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@cloudflare/workerd-windows-64@npm:1.20250803.0": - version: 1.20250803.0 - resolution: "@cloudflare/workerd-windows-64@npm:1.20250803.0" +"@cloudflare/workerd-windows-64@npm:1.20250816.0": + version: 1.20250816.0 + resolution: "@cloudflare/workerd-windows-64@npm:1.20250816.0" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -802,12 +802,14 @@ __metadata: resolution: "@devcycle/mcp-worker@workspace:mcp-worker" dependencies: "@cloudflare/workers-oauth-provider": "npm:^0.0.5" + "@types/node": "npm:^24.3.0" ably: "npm:^1.2.48" agents: "npm:^0.0.111" hono: "npm:^4.8.12" jose: "npm:^6.0.12" oauth4webapi: "npm:^3.6.1" - wrangler: "npm:^4.28.0" + vitest: "npm:^3.2.4" + wrangler: "npm:^4.31.0" languageName: unknown linkType: soft @@ -827,6 +829,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/aix-ppc64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/aix-ppc64@npm:0.25.9" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/android-arm64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/android-arm64@npm:0.25.4" @@ -834,6 +843,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/android-arm64@npm:0.25.9" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/android-arm@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/android-arm@npm:0.25.4" @@ -841,6 +857,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/android-arm@npm:0.25.9" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + "@esbuild/android-x64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/android-x64@npm:0.25.4" @@ -848,6 +871,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-x64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/android-x64@npm:0.25.9" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + "@esbuild/darwin-arm64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/darwin-arm64@npm:0.25.4" @@ -855,6 +885,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-arm64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/darwin-arm64@npm:0.25.9" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/darwin-x64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/darwin-x64@npm:0.25.4" @@ -862,6 +899,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-x64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/darwin-x64@npm:0.25.9" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + "@esbuild/freebsd-arm64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/freebsd-arm64@npm:0.25.4" @@ -869,6 +913,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-arm64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/freebsd-arm64@npm:0.25.9" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/freebsd-x64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/freebsd-x64@npm:0.25.4" @@ -876,6 +927,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-x64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/freebsd-x64@npm:0.25.9" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/linux-arm64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/linux-arm64@npm:0.25.4" @@ -883,6 +941,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/linux-arm64@npm:0.25.9" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/linux-arm@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/linux-arm@npm:0.25.4" @@ -890,6 +955,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/linux-arm@npm:0.25.9" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + "@esbuild/linux-ia32@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/linux-ia32@npm:0.25.4" @@ -897,6 +969,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ia32@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/linux-ia32@npm:0.25.9" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/linux-loong64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/linux-loong64@npm:0.25.4" @@ -904,6 +983,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-loong64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/linux-loong64@npm:0.25.9" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + "@esbuild/linux-mips64el@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/linux-mips64el@npm:0.25.4" @@ -911,6 +997,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-mips64el@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/linux-mips64el@npm:0.25.9" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + "@esbuild/linux-ppc64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/linux-ppc64@npm:0.25.4" @@ -918,6 +1011,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ppc64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/linux-ppc64@npm:0.25.9" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/linux-riscv64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/linux-riscv64@npm:0.25.4" @@ -925,6 +1025,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-riscv64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/linux-riscv64@npm:0.25.9" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + "@esbuild/linux-s390x@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/linux-s390x@npm:0.25.4" @@ -932,6 +1039,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-s390x@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/linux-s390x@npm:0.25.9" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + "@esbuild/linux-x64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/linux-x64@npm:0.25.4" @@ -939,6 +1053,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-x64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/linux-x64@npm:0.25.9" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + "@esbuild/netbsd-arm64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/netbsd-arm64@npm:0.25.4" @@ -946,6 +1067,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/netbsd-arm64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/netbsd-arm64@npm:0.25.9" + conditions: os=netbsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/netbsd-x64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/netbsd-x64@npm:0.25.4" @@ -953,6 +1081,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/netbsd-x64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/netbsd-x64@npm:0.25.9" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/openbsd-arm64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/openbsd-arm64@npm:0.25.4" @@ -960,6 +1095,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/openbsd-arm64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/openbsd-arm64@npm:0.25.9" + conditions: os=openbsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/openbsd-x64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/openbsd-x64@npm:0.25.4" @@ -967,6 +1109,20 @@ __metadata: languageName: node linkType: hard +"@esbuild/openbsd-x64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/openbsd-x64@npm:0.25.9" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openharmony-arm64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/openharmony-arm64@npm:0.25.9" + conditions: os=openharmony & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/sunos-x64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/sunos-x64@npm:0.25.4" @@ -974,6 +1130,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/sunos-x64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/sunos-x64@npm:0.25.9" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + "@esbuild/win32-arm64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/win32-arm64@npm:0.25.4" @@ -981,6 +1144,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-arm64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/win32-arm64@npm:0.25.9" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/win32-ia32@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/win32-ia32@npm:0.25.4" @@ -988,6 +1158,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-ia32@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/win32-ia32@npm:0.25.9" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/win32-x64@npm:0.25.4": version: 0.25.4 resolution: "@esbuild/win32-x64@npm:0.25.4" @@ -995,6 +1172,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-x64@npm:0.25.9": + version: 0.25.9 + resolution: "@esbuild/win32-x64@npm:0.25.9" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.7.0": version: 4.7.0 resolution: "@eslint-community/eslint-utils@npm:4.7.0" @@ -2121,6 +2305,146 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-android-arm-eabi@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.47.1" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@rollup/rollup-android-arm64@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-android-arm64@npm:4.47.1" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-arm64@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-darwin-arm64@npm:4.47.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-x64@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-darwin-x64@npm:4.47.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@rollup/rollup-freebsd-arm64@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-freebsd-arm64@npm:4.47.1" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-freebsd-x64@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-freebsd-x64@npm:4.47.1" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm-gnueabihf@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.47.1" + conditions: os=linux & cpu=arm & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm-musleabihf@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.47.1" + conditions: os=linux & cpu=arm & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-gnu@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.47.1" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-musl@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.47.1" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-linux-loongarch64-gnu@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-loongarch64-gnu@npm:4.47.1" + conditions: os=linux & cpu=loong64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-ppc64-gnu@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-ppc64-gnu@npm:4.47.1" + conditions: os=linux & cpu=ppc64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-riscv64-gnu@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.47.1" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-riscv64-musl@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-riscv64-musl@npm:4.47.1" + conditions: os=linux & cpu=riscv64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-linux-s390x-gnu@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.47.1" + conditions: os=linux & cpu=s390x & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-gnu@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.47.1" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-musl@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.47.1" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-win32-arm64-msvc@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.47.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-win32-ia32-msvc@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.47.1" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@rollup/rollup-win32-x64-msvc@npm:4.47.1": + version: 4.47.1 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.47.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@sigstore/bundle@npm:^1.1.0": version: 1.1.0 resolution: "@sigstore/bundle@npm:1.1.0" @@ -2341,7 +2665,7 @@ __metadata: languageName: node linkType: hard -"@types/estraverse@npm:^5.1.7": +"@types/estraverse@npm:5.1.7": version: 5.1.7 resolution: "@types/estraverse@npm:5.1.7" dependencies: @@ -2350,20 +2674,13 @@ __metadata: languageName: node linkType: hard -"@types/estree@npm:*": +"@types/estree@npm:1.0.5": version: 1.0.5 resolution: "@types/estree@npm:1.0.5" checksum: 10c0/b3b0e334288ddb407c7b3357ca67dbee75ee22db242ca7c56fe27db4e1a31989cb8af48a84dd401deb787fe10cc6b2ab1ee82dc4783be87ededbe3d53c79c70d languageName: node linkType: hard -"@types/estree@npm:^1.0.6": - version: 1.0.8 - resolution: "@types/estree@npm:1.0.8" - checksum: 10c0/39d34d1afaa338ab9763f37ad6066e3f349444f9052b9676a7cc0252ef9485a41c6d81c9c4e0d26e9077993354edf25efc853f3224dd4b447175ef62bdcc86a5 - languageName: node - linkType: hard - "@types/expect@npm:^1.20.4": version: 1.20.4 resolution: "@types/expect@npm:1.20.4" @@ -2516,6 +2833,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^24.3.0": + version: 24.3.0 + resolution: "@types/node@npm:24.3.0" + dependencies: + undici-types: "npm:~7.10.0" + checksum: 10c0/96bdeca01f690338957c2dcc92cb9f76c262c10398f8d91860865464412b0f9d309c24d9b03d0bdd26dd47fa7ee3f8227893d5c89bc2009d919a525a22512030 + languageName: node + linkType: hard + "@types/normalize-package-data@npm:^2.4.0": version: 2.4.4 resolution: "@types/normalize-package-data@npm:2.4.4" @@ -2741,6 +3067,89 @@ __metadata: languageName: node linkType: hard +"@vitest/expect@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/expect@npm:3.2.4" + dependencies: + "@types/chai": "npm:^5.2.2" + "@vitest/spy": "npm:3.2.4" + "@vitest/utils": "npm:3.2.4" + chai: "npm:^5.2.0" + tinyrainbow: "npm:^2.0.0" + checksum: 10c0/7586104e3fd31dbe1e6ecaafb9a70131e4197dce2940f727b6a84131eee3decac7b10f9c7c72fa5edbdb68b6f854353bd4c0fa84779e274207fb7379563b10db + languageName: node + linkType: hard + +"@vitest/mocker@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/mocker@npm:3.2.4" + dependencies: + "@vitest/spy": "npm:3.2.4" + estree-walker: "npm:^3.0.3" + magic-string: "npm:^0.30.17" + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + checksum: 10c0/f7a4aea19bbbf8f15905847ee9143b6298b2c110f8b64789224cb0ffdc2e96f9802876aa2ca83f1ec1b6e1ff45e822abb34f0054c24d57b29ab18add06536ccd + languageName: node + linkType: hard + +"@vitest/pretty-format@npm:3.2.4, @vitest/pretty-format@npm:^3.2.4": + version: 3.2.4 + resolution: "@vitest/pretty-format@npm:3.2.4" + dependencies: + tinyrainbow: "npm:^2.0.0" + checksum: 10c0/5ad7d4278e067390d7d633e307fee8103958806a419ca380aec0e33fae71b44a64415f7a9b4bc11635d3c13d4a9186111c581d3cef9c65cc317e68f077456887 + languageName: node + linkType: hard + +"@vitest/runner@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/runner@npm:3.2.4" + dependencies: + "@vitest/utils": "npm:3.2.4" + pathe: "npm:^2.0.3" + strip-literal: "npm:^3.0.0" + checksum: 10c0/e8be51666c72b3668ae3ea348b0196656a4a5adb836cb5e270720885d9517421815b0d6c98bfdf1795ed02b994b7bfb2b21566ee356a40021f5bf4f6ed4e418a + languageName: node + linkType: hard + +"@vitest/snapshot@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/snapshot@npm:3.2.4" + dependencies: + "@vitest/pretty-format": "npm:3.2.4" + magic-string: "npm:^0.30.17" + pathe: "npm:^2.0.3" + checksum: 10c0/f8301a3d7d1559fd3d59ed51176dd52e1ed5c2d23aa6d8d6aa18787ef46e295056bc726a021698d8454c16ed825ecba163362f42fa90258bb4a98cfd2c9424fc + languageName: node + linkType: hard + +"@vitest/spy@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/spy@npm:3.2.4" + dependencies: + tinyspy: "npm:^4.0.3" + checksum: 10c0/6ebf0b4697dc238476d6b6a60c76ba9eb1dd8167a307e30f08f64149612fd50227682b876420e4c2e09a76334e73f72e3ebf0e350714dc22474258292e202024 + languageName: node + linkType: hard + +"@vitest/utils@npm:3.2.4": + version: 3.2.4 + resolution: "@vitest/utils@npm:3.2.4" + dependencies: + "@vitest/pretty-format": "npm:3.2.4" + loupe: "npm:^3.1.4" + tinyrainbow: "npm:^2.0.0" + checksum: 10c0/024a9b8c8bcc12cf40183c246c244b52ecff861c6deb3477cbf487ac8781ad44c68a9c5fd69f8c1361878e55b97c10d99d511f2597f1f7244b5e5101d028ba64 + languageName: node + linkType: hard + "@zodios/core@npm:^10.3.1, @zodios/core@npm:^10.9.6": version: 10.9.6 resolution: "@zodios/core@npm:10.9.6" @@ -3658,6 +4067,19 @@ __metadata: languageName: node linkType: hard +"chai@npm:^5.2.0": + version: 5.3.1 + resolution: "chai@npm:5.3.1" + dependencies: + assertion-error: "npm:^2.0.1" + check-error: "npm:^2.1.1" + deep-eql: "npm:^5.0.1" + loupe: "npm:^3.1.0" + pathval: "npm:^2.0.0" + checksum: 10c0/09075db3cdad4098492c56e870ebb1cc621e65c4f12dca39b702c5b34c1eaf4d94214193af7b5add38490e64e76ff125bbb66fcea9edf2a0c5f9a64f23aad3ad + languageName: node + linkType: hard + "chalk@npm:^4, chalk@npm:^4.0.0, chalk@npm:^4.0.2, chalk@npm:^4.1.0, chalk@npm:^4.1.1, chalk@npm:^4.1.2": version: 4.1.2 resolution: "chalk@npm:4.1.2" @@ -4127,7 +4549,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:^4.3.5": +"debug@npm:^4.3.5, debug@npm:^4.4.1": version: 4.4.1 resolution: "debug@npm:4.4.1" dependencies: @@ -4474,6 +4896,13 @@ __metadata: languageName: node linkType: hard +"es-module-lexer@npm:^1.7.0": + version: 1.7.0 + resolution: "es-module-lexer@npm:1.7.0" + checksum: 10c0/4c935affcbfeba7fb4533e1da10fa8568043df1e3574b869385980de9e2d475ddc36769891936dbb07036edb3c3786a8b78ccf44964cd130dedc1f2c984b6c7b + languageName: node + linkType: hard + "es-object-atoms@npm:^1.0.0, es-object-atoms@npm:^1.1.1": version: 1.1.1 resolution: "es-object-atoms@npm:1.1.1" @@ -4581,6 +5010,95 @@ __metadata: languageName: node linkType: hard +"esbuild@npm:^0.25.0": + version: 0.25.9 + resolution: "esbuild@npm:0.25.9" + dependencies: + "@esbuild/aix-ppc64": "npm:0.25.9" + "@esbuild/android-arm": "npm:0.25.9" + "@esbuild/android-arm64": "npm:0.25.9" + "@esbuild/android-x64": "npm:0.25.9" + "@esbuild/darwin-arm64": "npm:0.25.9" + "@esbuild/darwin-x64": "npm:0.25.9" + "@esbuild/freebsd-arm64": "npm:0.25.9" + "@esbuild/freebsd-x64": "npm:0.25.9" + "@esbuild/linux-arm": "npm:0.25.9" + "@esbuild/linux-arm64": "npm:0.25.9" + "@esbuild/linux-ia32": "npm:0.25.9" + "@esbuild/linux-loong64": "npm:0.25.9" + "@esbuild/linux-mips64el": "npm:0.25.9" + "@esbuild/linux-ppc64": "npm:0.25.9" + "@esbuild/linux-riscv64": "npm:0.25.9" + "@esbuild/linux-s390x": "npm:0.25.9" + "@esbuild/linux-x64": "npm:0.25.9" + "@esbuild/netbsd-arm64": "npm:0.25.9" + "@esbuild/netbsd-x64": "npm:0.25.9" + "@esbuild/openbsd-arm64": "npm:0.25.9" + "@esbuild/openbsd-x64": "npm:0.25.9" + "@esbuild/openharmony-arm64": "npm:0.25.9" + "@esbuild/sunos-x64": "npm:0.25.9" + "@esbuild/win32-arm64": "npm:0.25.9" + "@esbuild/win32-ia32": "npm:0.25.9" + "@esbuild/win32-x64": "npm:0.25.9" + dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-arm64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-arm64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/openharmony-arm64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 10c0/aaa1284c75fcf45c82f9a1a117fe8dc5c45628e3386bda7d64916ae27730910b51c5aec7dd45a6ba19256be30ba2935e64a8f011a3f0539833071e06bf76d5b3 + languageName: node + linkType: hard + "escalade@npm:^3.1.1": version: 3.1.2 resolution: "escalade@npm:3.1.2" @@ -4747,13 +5265,22 @@ __metadata: languageName: node linkType: hard -"estraverse@npm:^5.1.0, estraverse@npm:^5.2.0, estraverse@npm:^5.3.0": +"estraverse@npm:5.3.0": version: 5.3.0 resolution: "estraverse@npm:5.3.0" checksum: 10c0/1ff9447b96263dec95d6d67431c5e0771eb9776427421260a3e2f0fdd5d6bd4f8e37a7338f5ad2880c9f143450c9b1e4fc2069060724570a49cf9cf0312bd107 languageName: node linkType: hard +"estree-walker@npm:^3.0.3": + version: 3.0.3 + resolution: "estree-walker@npm:3.0.3" + dependencies: + "@types/estree": "npm:^1.0.0" + checksum: 10c0/c12e3c2b2642d2bcae7d5aa495c60fa2f299160946535763969a1c83fc74518ffa9c2cd3a8b69ac56aea547df6a8aac25f729a342992ef0bbac5f1c73e78995d + languageName: node + linkType: hard + "esutils@npm:^2.0.2": version: 2.0.3 resolution: "esutils@npm:2.0.3" @@ -4850,6 +5377,13 @@ __metadata: languageName: node linkType: hard +"expect-type@npm:^1.2.1": + version: 1.2.2 + resolution: "expect-type@npm:1.2.2" + checksum: 10c0/6019019566063bbc7a690d9281d920b1a91284a4a093c2d55d71ffade5ac890cf37a51e1da4602546c4b56569d2ad2fc175a2ccee77d1ae06cb3af91ef84f44b + languageName: node + linkType: hard + "expect@npm:^29.7.0": version: 29.7.0 resolution: "expect@npm:29.7.0" @@ -5029,6 +5563,18 @@ __metadata: languageName: node linkType: hard +"fdir@npm:^6.4.4, fdir@npm:^6.5.0": + version: 6.5.0 + resolution: "fdir@npm:6.5.0" + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + checksum: 10c0/e345083c4306b3aed6cb8ec551e26c36bab5c511e99ea4576a16750ddc8d3240e63826cc624f5ae17ad4dc82e68a253213b60d556c11bfad064b7607847ed07f + languageName: node + linkType: hard + "figures@npm:^3.0.0, figures@npm:^3.2.0": version: 3.2.0 resolution: "figures@npm:3.2.0" @@ -5263,7 +5809,7 @@ __metadata: languageName: node linkType: hard -"fsevents@npm:^2.3.2, fsevents@npm:~2.3.2": +"fsevents@npm:^2.3.2, fsevents@npm:~2.3.2, fsevents@npm:~2.3.3": version: 2.3.3 resolution: "fsevents@npm:2.3.3" dependencies: @@ -5273,7 +5819,7 @@ __metadata: languageName: node linkType: hard -"fsevents@patch:fsevents@npm%3A^2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin": +"fsevents@patch:fsevents@npm%3A^2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.3#optional!builtin": version: 2.3.3 resolution: "fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin::version=2.3.3&hash=df0bf1" dependencies: @@ -6453,6 +6999,13 @@ __metadata: languageName: node linkType: hard +"js-tokens@npm:^9.0.1": + version: 9.0.1 + resolution: "js-tokens@npm:9.0.1" + checksum: 10c0/68dcab8f233dde211a6b5fd98079783cbcd04b53617c1250e3553ee16ab3e6134f5e65478e41d82f6d351a052a63d71024553933808570f04dbf828d7921e80e + languageName: node + linkType: hard + "js-yaml@npm:^3.13.0, js-yaml@npm:^3.13.1, js-yaml@npm:^3.14.1": version: 3.14.1 resolution: "js-yaml@npm:3.14.1" @@ -6778,6 +7331,13 @@ __metadata: languageName: node linkType: hard +"loupe@npm:^3.1.4": + version: 3.2.1 + resolution: "loupe@npm:3.2.1" + checksum: 10c0/910c872cba291309664c2d094368d31a68907b6f5913e989d301b5c25f30e97d76d77f23ab3bf3b46d0f601ff0b6af8810c10c31b91d2c6b2f132809ca2cc705 + languageName: node + linkType: hard + "lowercase-keys@npm:^2.0.0": version: 2.0.0 resolution: "lowercase-keys@npm:2.0.0" @@ -6824,6 +7384,15 @@ __metadata: languageName: node linkType: hard +"magic-string@npm:^0.30.17": + version: 0.30.17 + resolution: "magic-string@npm:0.30.17" + dependencies: + "@jridgewell/sourcemap-codec": "npm:^1.5.0" + checksum: 10c0/16826e415d04b88378f200fe022b53e638e3838b9e496edda6c0e086d7753a44a6ed187adc72d19f3623810589bf139af1a315541cd6a26ae0771a0193eaf7b8 + languageName: node + linkType: hard + "make-error@npm:^1.1.1": version: 1.3.6 resolution: "make-error@npm:1.3.6" @@ -7085,9 +7654,9 @@ __metadata: languageName: node linkType: hard -"miniflare@npm:4.20250803.0": - version: 4.20250803.0 - resolution: "miniflare@npm:4.20250803.0" +"miniflare@npm:4.20250816.1": + version: 4.20250816.1 + resolution: "miniflare@npm:4.20250816.1" dependencies: "@cspotcode/source-map-support": "npm:0.8.1" acorn: "npm:8.14.0" @@ -7097,13 +7666,13 @@ __metadata: sharp: "npm:^0.33.5" stoppable: "npm:1.1.0" undici: "npm:^7.10.0" - workerd: "npm:1.20250803.0" + workerd: "npm:1.20250816.0" ws: "npm:8.18.0" youch: "npm:4.1.0-beta.10" zod: "npm:3.22.3" bin: miniflare: bootstrap.js - checksum: 10c0/c3db6ef0653bfdb626fa92cc3243aa70f33f38cba5450f651fcfac87559ba338fc0e10ff68a9d5af3ed76dc547356e44c130d7c7a1a19ee6d2cb897cf69251ac + checksum: 10c0/342a02c6fb8cded476b197fd1dd51579ad5ff7d77108df09f38ebd80903d9e2d7faf8e81c991c25165bdae94464ed40af21b91da86cebdb76d13136aa1e3ee63 languageName: node linkType: hard @@ -7406,7 +7975,7 @@ __metadata: languageName: node linkType: hard -"nanoid@npm:^3.3.8": +"nanoid@npm:^3.3.11, nanoid@npm:^3.3.8": version: 3.3.11 resolution: "nanoid@npm:3.3.11" bin: @@ -8396,6 +8965,13 @@ __metadata: languageName: node linkType: hard +"picomatch@npm:^4.0.2, picomatch@npm:^4.0.3": + version: 4.0.3 + resolution: "picomatch@npm:4.0.3" + checksum: 10c0/9582c951e95eebee5434f59e426cddd228a7b97a0161a375aed4be244bd3fe8e3a31b846808ea14ef2c8a2527a6eeab7b3946a67d5979e81694654f939473ae2 + languageName: node + linkType: hard + "pify@npm:^2.3.0": version: 2.3.0 resolution: "pify@npm:2.3.0" @@ -8440,6 +9016,17 @@ __metadata: languageName: node linkType: hard +"postcss@npm:^8.5.6": + version: 8.5.6 + resolution: "postcss@npm:8.5.6" + dependencies: + nanoid: "npm:^3.3.11" + picocolors: "npm:^1.1.1" + source-map-js: "npm:^1.2.1" + checksum: 10c0/5127cc7c91ed7a133a1b7318012d8bfa112da9ef092dddf369ae699a1f10ebbd89b1b9f25f3228795b84585c72aabd5ced5fc11f2ba467eedf7b081a66fad024 + languageName: node + linkType: hard + "preferred-pm@npm:^3.0.3": version: 3.1.3 resolution: "preferred-pm@npm:3.1.3" @@ -8966,6 +9553,81 @@ __metadata: languageName: node linkType: hard +"rollup@npm:^4.43.0": + version: 4.47.1 + resolution: "rollup@npm:4.47.1" + dependencies: + "@rollup/rollup-android-arm-eabi": "npm:4.47.1" + "@rollup/rollup-android-arm64": "npm:4.47.1" + "@rollup/rollup-darwin-arm64": "npm:4.47.1" + "@rollup/rollup-darwin-x64": "npm:4.47.1" + "@rollup/rollup-freebsd-arm64": "npm:4.47.1" + "@rollup/rollup-freebsd-x64": "npm:4.47.1" + "@rollup/rollup-linux-arm-gnueabihf": "npm:4.47.1" + "@rollup/rollup-linux-arm-musleabihf": "npm:4.47.1" + "@rollup/rollup-linux-arm64-gnu": "npm:4.47.1" + "@rollup/rollup-linux-arm64-musl": "npm:4.47.1" + "@rollup/rollup-linux-loongarch64-gnu": "npm:4.47.1" + "@rollup/rollup-linux-ppc64-gnu": "npm:4.47.1" + "@rollup/rollup-linux-riscv64-gnu": "npm:4.47.1" + "@rollup/rollup-linux-riscv64-musl": "npm:4.47.1" + "@rollup/rollup-linux-s390x-gnu": "npm:4.47.1" + "@rollup/rollup-linux-x64-gnu": "npm:4.47.1" + "@rollup/rollup-linux-x64-musl": "npm:4.47.1" + "@rollup/rollup-win32-arm64-msvc": "npm:4.47.1" + "@rollup/rollup-win32-ia32-msvc": "npm:4.47.1" + "@rollup/rollup-win32-x64-msvc": "npm:4.47.1" + "@types/estree": "npm:1.0.8" + fsevents: "npm:~2.3.2" + dependenciesMeta: + "@rollup/rollup-android-arm-eabi": + optional: true + "@rollup/rollup-android-arm64": + optional: true + "@rollup/rollup-darwin-arm64": + optional: true + "@rollup/rollup-darwin-x64": + optional: true + "@rollup/rollup-freebsd-arm64": + optional: true + "@rollup/rollup-freebsd-x64": + optional: true + "@rollup/rollup-linux-arm-gnueabihf": + optional: true + "@rollup/rollup-linux-arm-musleabihf": + optional: true + "@rollup/rollup-linux-arm64-gnu": + optional: true + "@rollup/rollup-linux-arm64-musl": + optional: true + "@rollup/rollup-linux-loongarch64-gnu": + optional: true + "@rollup/rollup-linux-ppc64-gnu": + optional: true + "@rollup/rollup-linux-riscv64-gnu": + optional: true + "@rollup/rollup-linux-riscv64-musl": + optional: true + "@rollup/rollup-linux-s390x-gnu": + optional: true + "@rollup/rollup-linux-x64-gnu": + optional: true + "@rollup/rollup-linux-x64-musl": + optional: true + "@rollup/rollup-win32-arm64-msvc": + optional: true + "@rollup/rollup-win32-ia32-msvc": + optional: true + "@rollup/rollup-win32-x64-msvc": + optional: true + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: 10c0/4d792f8a8bfb4408485bbc6c1f393a88422230c14d06b9de4d27bcf443fe3569f9fa4ed6111972bf6b8b515bd0133bfeb16ab66cdf32494ef0fbd2da41dc2855 + languageName: node + linkType: hard + "router@npm:^2.2.0": version: 2.2.0 resolution: "router@npm:2.2.0" @@ -9333,6 +9995,13 @@ __metadata: languageName: node linkType: hard +"siginfo@npm:^2.0.0": + version: 2.0.0 + resolution: "siginfo@npm:2.0.0" + checksum: 10c0/3def8f8e516fbb34cb6ae415b07ccc5d9c018d85b4b8611e3dc6f8be6d1899f693a4382913c9ed51a06babb5201639d76453ab297d1c54a456544acf5c892e34 + languageName: node + linkType: hard + "signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3, signal-exit@npm:^3.0.7": version: 3.0.7 resolution: "signal-exit@npm:3.0.7" @@ -9472,6 +10141,13 @@ __metadata: languageName: node linkType: hard +"source-map-js@npm:^1.2.1": + version: 1.2.1 + resolution: "source-map-js@npm:1.2.1" + checksum: 10c0/7bda1fc4c197e3c6ff17de1b8b2c20e60af81b63a52cb32ec5a5d67a20a7d42651e2cb34ebe93833c5a2a084377e17455854fee3e21e7925c64a51b6a52b0faf + languageName: node + linkType: hard + "source-map@npm:^0.6.1, source-map@npm:~0.6.1": version: 0.6.1 resolution: "source-map@npm:0.6.1" @@ -9570,6 +10246,13 @@ __metadata: languageName: node linkType: hard +"stackback@npm:0.0.2": + version: 0.0.2 + resolution: "stackback@npm:0.0.2" + checksum: 10c0/89a1416668f950236dd5ac9f9a6b2588e1b9b62b1b6ad8dff1bfc5d1a15dbf0aafc9b52d2226d00c28dffff212da464eaeebfc6b7578b9d180cef3e3782c5983 + languageName: node + linkType: hard + "statuses@npm:2.0.1": version: 2.0.1 resolution: "statuses@npm:2.0.1" @@ -9584,6 +10267,13 @@ __metadata: languageName: node linkType: hard +"std-env@npm:^3.9.0": + version: 3.9.0 + resolution: "std-env@npm:3.9.0" + checksum: 10c0/4a6f9218aef3f41046c3c7ecf1f98df00b30a07f4f35c6d47b28329bc2531eef820828951c7d7b39a1c5eb19ad8a46e3ddfc7deb28f0a2f3ceebee11bab7ba50 + languageName: node + linkType: hard + "stdout-stderr@npm:^0.1.9": version: 0.1.13 resolution: "stdout-stderr@npm:0.1.13" @@ -9708,6 +10398,15 @@ __metadata: languageName: node linkType: hard +"strip-literal@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-literal@npm:3.0.0" + dependencies: + js-tokens: "npm:^9.0.1" + checksum: 10c0/d81657f84aba42d4bbaf2a677f7e7f34c1f3de5a6726db8bc1797f9c0b303ba54d4660383a74bde43df401cf37cce1dff2c842c55b077a4ceee11f9e31fba828 + languageName: node + linkType: hard + "supports-color@npm:^10.0.0": version: 10.0.0 resolution: "supports-color@npm:10.0.0" @@ -9825,6 +10524,51 @@ __metadata: languageName: node linkType: hard +"tinybench@npm:^2.9.0": + version: 2.9.0 + resolution: "tinybench@npm:2.9.0" + checksum: 10c0/c3500b0f60d2eb8db65250afe750b66d51623057ee88720b7f064894a6cb7eb93360ca824a60a31ab16dab30c7b1f06efe0795b352e37914a9d4bad86386a20c + languageName: node + linkType: hard + +"tinyexec@npm:^0.3.2": + version: 0.3.2 + resolution: "tinyexec@npm:0.3.2" + checksum: 10c0/3efbf791a911be0bf0821eab37a3445c2ba07acc1522b1fa84ae1e55f10425076f1290f680286345ed919549ad67527d07281f1c19d584df3b74326909eb1f90 + languageName: node + linkType: hard + +"tinyglobby@npm:^0.2.14": + version: 0.2.14 + resolution: "tinyglobby@npm:0.2.14" + dependencies: + fdir: "npm:^6.4.4" + picomatch: "npm:^4.0.2" + checksum: 10c0/f789ed6c924287a9b7d3612056ed0cda67306cd2c80c249fd280cf1504742b12583a2089b61f4abbd24605f390809017240e250241f09938054c9b363e51c0a6 + languageName: node + linkType: hard + +"tinypool@npm:^1.1.1": + version: 1.1.1 + resolution: "tinypool@npm:1.1.1" + checksum: 10c0/bf26727d01443061b04fa863f571016950888ea994ba0cd8cba3a1c51e2458d84574341ab8dbc3664f1c3ab20885c8cf9ff1cc4b18201f04c2cde7d317fff69b + languageName: node + linkType: hard + +"tinyrainbow@npm:^2.0.0": + version: 2.0.0 + resolution: "tinyrainbow@npm:2.0.0" + checksum: 10c0/c83c52bef4e0ae7fb8ec6a722f70b5b6fa8d8be1c85792e829f56c0e1be94ab70b293c032dc5048d4d37cfe678f1f5babb04bdc65fd123098800148ca989184f + languageName: node + linkType: hard + +"tinyspy@npm:^4.0.3": + version: 4.0.3 + resolution: "tinyspy@npm:4.0.3" + checksum: 10c0/0a92a18b5350945cc8a1da3a22c9ad9f4e2945df80aaa0c43e1b3a3cfb64d8501e607ebf0305e048e3c3d3e0e7f8eb10cea27dc17c21effb73e66c4a3be36373 + languageName: node + linkType: hard + "tmp@npm:0.2.5": version: 0.2.5 resolution: "tmp@npm:0.2.5" @@ -10113,6 +10857,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~7.10.0": + version: 7.10.0 + resolution: "undici-types@npm:7.10.0" + checksum: 10c0/8b00ce50e235fe3cc601307f148b5e8fb427092ee3b23e8118ec0a5d7f68eca8cee468c8fc9f15cbb2cf2a3797945ebceb1cbd9732306a1d00e0a9b6afa0f635 + languageName: node + linkType: hard + "undici@npm:^7.10.0": version: 7.13.0 resolution: "undici@npm:7.13.0" @@ -10369,6 +11120,132 @@ __metadata: languageName: node linkType: hard +"vite-node@npm:3.2.4": + version: 3.2.4 + resolution: "vite-node@npm:3.2.4" + dependencies: + cac: "npm:^6.7.14" + debug: "npm:^4.4.1" + es-module-lexer: "npm:^1.7.0" + pathe: "npm:^2.0.3" + vite: "npm:^5.0.0 || ^6.0.0 || ^7.0.0-0" + bin: + vite-node: vite-node.mjs + checksum: 10c0/6ceca67c002f8ef6397d58b9539f80f2b5d79e103a18367288b3f00a8ab55affa3d711d86d9112fce5a7fa658a212a087a005a045eb8f4758947dd99af2a6c6b + languageName: node + linkType: hard + +"vite@npm:^5.0.0 || ^6.0.0 || ^7.0.0-0": + version: 7.1.3 + resolution: "vite@npm:7.1.3" + dependencies: + esbuild: "npm:^0.25.0" + fdir: "npm:^6.5.0" + fsevents: "npm:~2.3.3" + picomatch: "npm:^4.0.3" + postcss: "npm:^8.5.6" + rollup: "npm:^4.43.0" + tinyglobby: "npm:^0.2.14" + peerDependencies: + "@types/node": ^20.19.0 || >=22.12.0 + jiti: ">=1.21.0" + less: ^4.0.0 + lightningcss: ^1.21.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: ">=0.54.8" + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + dependenciesMeta: + fsevents: + optional: true + peerDependenciesMeta: + "@types/node": + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + bin: + vite: bin/vite.js + checksum: 10c0/a0aa418beab80673dc9a3e9d1fa49472955d6ef9d41a4c9c6bd402953f411346f612864dae267adfb2bb8ceeb894482369316ffae5816c84fd45990e352b727d + languageName: node + linkType: hard + +"vitest@npm:^3.2.4": + version: 3.2.4 + resolution: "vitest@npm:3.2.4" + dependencies: + "@types/chai": "npm:^5.2.2" + "@vitest/expect": "npm:3.2.4" + "@vitest/mocker": "npm:3.2.4" + "@vitest/pretty-format": "npm:^3.2.4" + "@vitest/runner": "npm:3.2.4" + "@vitest/snapshot": "npm:3.2.4" + "@vitest/spy": "npm:3.2.4" + "@vitest/utils": "npm:3.2.4" + chai: "npm:^5.2.0" + debug: "npm:^4.4.1" + expect-type: "npm:^1.2.1" + magic-string: "npm:^0.30.17" + pathe: "npm:^2.0.3" + picomatch: "npm:^4.0.2" + std-env: "npm:^3.9.0" + tinybench: "npm:^2.9.0" + tinyexec: "npm:^0.3.2" + tinyglobby: "npm:^0.2.14" + tinypool: "npm:^1.1.1" + tinyrainbow: "npm:^2.0.0" + vite: "npm:^5.0.0 || ^6.0.0 || ^7.0.0-0" + vite-node: "npm:3.2.4" + why-is-node-running: "npm:^2.3.0" + peerDependencies: + "@edge-runtime/vm": "*" + "@types/debug": ^4.1.12 + "@types/node": ^18.0.0 || ^20.0.0 || >=22.0.0 + "@vitest/browser": 3.2.4 + "@vitest/ui": 3.2.4 + happy-dom: "*" + jsdom: "*" + peerDependenciesMeta: + "@edge-runtime/vm": + optional: true + "@types/debug": + optional: true + "@types/node": + optional: true + "@vitest/browser": + optional: true + "@vitest/ui": + optional: true + happy-dom: + optional: true + jsdom: + optional: true + bin: + vitest: vitest.mjs + checksum: 10c0/5bf53ede3ae6a0e08956d72dab279ae90503f6b5a05298a6a5e6ef47d2fd1ab386aaf48fafa61ed07a0ebfe9e371772f1ccbe5c258dd765206a8218bf2eb79eb + languageName: node + linkType: hard + "walk-up-path@npm:^1.0.0": version: 1.0.0 resolution: "walk-up-path@npm:1.0.0" @@ -10477,6 +11354,18 @@ __metadata: languageName: node linkType: hard +"why-is-node-running@npm:^2.3.0": + version: 2.3.0 + resolution: "why-is-node-running@npm:2.3.0" + dependencies: + siginfo: "npm:^2.0.0" + stackback: "npm:0.0.2" + bin: + why-is-node-running: cli.js + checksum: 10c0/1cde0b01b827d2cf4cb11db962f3958b9175d5d9e7ac7361d1a7b0e2dc6069a263e69118bd974c4f6d0a890ef4eedfe34cf3d5167ec14203dbc9a18620537054 + languageName: node + linkType: hard + "wide-align@npm:^1.1.2, wide-align@npm:^1.1.5": version: 1.1.5 resolution: "wide-align@npm:1.1.5" @@ -10509,15 +11398,15 @@ __metadata: languageName: node linkType: hard -"workerd@npm:1.20250803.0": - version: 1.20250803.0 - resolution: "workerd@npm:1.20250803.0" +"workerd@npm:1.20250816.0": + version: 1.20250816.0 + resolution: "workerd@npm:1.20250816.0" dependencies: - "@cloudflare/workerd-darwin-64": "npm:1.20250803.0" - "@cloudflare/workerd-darwin-arm64": "npm:1.20250803.0" - "@cloudflare/workerd-linux-64": "npm:1.20250803.0" - "@cloudflare/workerd-linux-arm64": "npm:1.20250803.0" - "@cloudflare/workerd-windows-64": "npm:1.20250803.0" + "@cloudflare/workerd-darwin-64": "npm:1.20250816.0" + "@cloudflare/workerd-darwin-arm64": "npm:1.20250816.0" + "@cloudflare/workerd-linux-64": "npm:1.20250816.0" + "@cloudflare/workerd-linux-arm64": "npm:1.20250816.0" + "@cloudflare/workerd-windows-64": "npm:1.20250816.0" dependenciesMeta: "@cloudflare/workerd-darwin-64": optional: true @@ -10531,7 +11420,7 @@ __metadata: optional: true bin: workerd: bin/workerd - checksum: 10c0/df4bab96fec522e0e948ff8bcc76cf256947206bac1bba28fb0dd21d26e88001adef5409769240dd5d549a1edd94669626e380ba10b6db8e8086234542d4d3bc + checksum: 10c0/ddb41844507a41bb7a8a315681947bc301d10c0bfe27b7bac6457148abf1af27df0a7a9ac840a5e049232c2760710dab4e62b4d36d3d07cbddafb05360b1014c languageName: node linkType: hard @@ -10542,21 +11431,21 @@ __metadata: languageName: node linkType: hard -"wrangler@npm:^4.28.0": - version: 4.28.0 - resolution: "wrangler@npm:4.28.0" +"wrangler@npm:^4.31.0": + version: 4.32.0 + resolution: "wrangler@npm:4.32.0" dependencies: "@cloudflare/kv-asset-handler": "npm:0.4.0" - "@cloudflare/unenv-preset": "npm:2.6.0" + "@cloudflare/unenv-preset": "npm:2.6.2" blake3-wasm: "npm:2.1.5" esbuild: "npm:0.25.4" fsevents: "npm:~2.3.2" - miniflare: "npm:4.20250803.0" + miniflare: "npm:4.20250816.1" path-to-regexp: "npm:6.3.0" unenv: "npm:2.0.0-rc.19" - workerd: "npm:1.20250803.0" + workerd: "npm:1.20250816.0" peerDependencies: - "@cloudflare/workers-types": ^4.20250803.0 + "@cloudflare/workers-types": ^4.20250816.0 dependenciesMeta: fsevents: optional: true @@ -10566,7 +11455,7 @@ __metadata: bin: wrangler: bin/wrangler.js wrangler2: bin/wrangler.js - checksum: 10c0/10dc5866aade44a9f4ab5ebd47ab16274fea1173c39c2251e8960784bb7bf5b90ab719e95aea24a1473ee81a7e38ed86e0a60ba52a364f93bc11ad17866ff86b + checksum: 10c0/8ef1410a513a0a82169e8d71e4a6195761dad1c0c620012d70530923aca2c6e106305e9675d8800899139c6f81a46c7d97046961bdca3c52b30decf5c0961b82 languageName: node linkType: hard From f6bb3e401b42ff7e742eab3a8d3c677dafc94192 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Thu, 21 Aug 2025 17:08:30 -0400 Subject: [PATCH 6/9] feat: update wrangler envs --- mcp-worker/package.json | 4 ++-- mcp-worker/wrangler.toml | 37 ++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/mcp-worker/package.json b/mcp-worker/package.json index 42f354705..e80713fa0 100644 --- a/mcp-worker/package.json +++ b/mcp-worker/package.json @@ -4,8 +4,8 @@ "private": true, "type": "module", "scripts": { - "dev": "wrangler dev", - "deploy": "wrangler deploy", + "dev": "wrangler dev --env dev", + "deploy": "wrangler deploy --env prod", "deploy:dev": "wrangler deploy --env dev", "build": "tsc", "type-check": "tsc --noEmit", diff --git a/mcp-worker/wrangler.toml b/mcp-worker/wrangler.toml index d6e8453ca..cf727f7b8 100644 --- a/mcp-worker/wrangler.toml +++ b/mcp-worker/wrangler.toml @@ -4,27 +4,23 @@ main = "src/index.ts" compatibility_date = "2025-06-28" compatibility_flags = ["nodejs_compat"] -# Production route -[[routes]] +# Production environment (explicit section for --env prod) +[env.prod] +name = "devcycle-mcp-server" + +[[env.prod.routes]] pattern = "mcp.devcycle.com/*" zone_name = "devcycle.com" -# Durable Objects configuration -[[migrations]] -new_sqlite_classes = ["DevCycleMCP"] -tag = "v1" - -[[durable_objects.bindings]] +[[env.prod.durable_objects.bindings]] class_name = "DevCycleMCP" name = "MCP_OBJECT" -# KV namespace for OAuth session storage -[[kv_namespaces]] +[[env.prod.kv_namespaces]] binding = "OAUTH_KV" id = "511f2abf74904876ba3e4627154f4d86" -# Environment variables -[vars] +[env.prod.vars] NODE_ENV = "production" API_BASE_URL = "https://api.devcycle.com" AUTH0_DOMAIN = "auth.devcycle.com" @@ -32,15 +28,14 @@ AUTH0_AUDIENCE = "https://api.devcycle.com/" AUTH0_SCOPE = "openid profile email offline_access" ENABLE_OUTPUT_SCHEMAS = "false" -# Secrets (set via: wrangler secret put ) -# AUTH0_CLIENT_ID -# AUTH0_CLIENT_SECRET -# ABLY_API_KEY - -# AI binding for future features (not currently used) -[ai] +[env.prod.ai] binding = "AI" +# Durable Objects configuration +[[migrations]] +new_sqlite_classes = ["DevCycleMCP"] +tag = "v1" + # Observability [observability] enabled = true @@ -78,6 +73,10 @@ AUTH0_AUDIENCE = "https://api.devcycle.com/" AUTH0_SCOPE = "openid profile email offline_access" ENABLE_OUTPUT_SCHEMAS = "false" +# Dev AI binding +[env.dev.ai] +binding = "AI" + # Development secrets (set via: wrangler secret put --env dev) # AUTH0_CLIENT_ID # AUTH0_CLIENT_SECRET From 15a93666877edb4c292646ae62b5073f2bbc2e98 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Thu, 21 Aug 2025 23:00:09 -0400 Subject: [PATCH 7/9] fix: calling publishMCPInstallEvent() in waitUntil() --- mcp-worker/package.json | 2 +- mcp-worker/src/ably.ts | 6 ++++-- mcp-worker/src/auth.ts | 10 ++++------ package.json | 3 ++- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/mcp-worker/package.json b/mcp-worker/package.json index e80713fa0..d94fdcdd7 100644 --- a/mcp-worker/package.json +++ b/mcp-worker/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "wrangler dev --env dev", - "deploy": "wrangler deploy --env prod", + "deploy:prod": "wrangler deploy --env prod", "deploy:dev": "wrangler deploy --env dev", "build": "tsc", "type-check": "tsc --noEmit", diff --git a/mcp-worker/src/ably.ts b/mcp-worker/src/ably.ts index 3535daa91..5328f140d 100644 --- a/mcp-worker/src/ably.ts +++ b/mcp-worker/src/ably.ts @@ -6,10 +6,12 @@ export async function publishMCPInstallEvent( claims: DevCycleJWTClaims, ): Promise { if (!env.ABLY_API_KEY) { - throw new Error('ABLY_API_KEY is required to publish MCP events') + throw new Error('ABLY_API_KEY is required to publish Ably MCP events') } if (!claims.org_id) { - throw new Error('org_id is required in claims to publish MCP events') + throw new Error( + 'org_id is required in claims to publish Ably MCP events', + ) } const channel = `${claims.org_id}-mcp-install` diff --git a/mcp-worker/src/auth.ts b/mcp-worker/src/auth.ts index b89916d22..f93f5adc7 100644 --- a/mcp-worker/src/auth.ts +++ b/mcp-worker/src/auth.ts @@ -305,13 +305,11 @@ export async function callback( userId: claims.sub!, }) - c.executionCtx.waitUntil(async () => { - try { - await publishMCPInstallEvent(c.env, claims) - } catch (error) { + c.executionCtx.waitUntil( + publishMCPInstallEvent(c.env, claims).catch((error) => { console.error('Error publishing MCP install event', error) - } - }) + }), + ) return Response.redirect(redirectTo, 302) } diff --git a/package.json b/package.json index 2949f736e..548ac820d 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "build": "node scripts/fetch-install-prompts.js && shx rm -rf dist && tsc -b && oclif manifest", "build:tar": "oclif pack tarballs", "build:worker": "cd mcp-worker && yarn build", - "deploy:worker": "cd mcp-worker && yarn deploy", + "deploy:worker:prod": "cd mcp-worker && yarn deploy:prod", + "deploy:worker:dev": "cd mcp-worker && yarn deploy:dev", "dev:worker": "cd mcp-worker && yarn dev", "format": "prettier --write \"src/**/*.{ts,js,json}\" \"test/**/*.{ts,js,json}\" \"test-utils/**/*.{ts,js,json}\" \"*.{ts,js,json,md}\"", "format:check": "prettier --check \"src/**/*.{ts,js,json}\" \"test/**/*.{ts,js,json}\" \"test-utils/**/*.{ts,js,json}\" \"*.{ts,js,json,md}\"", From 07b18bf7e2b82f03ccf7342dcf3fd3c25d66d23b Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Fri, 22 Aug 2025 09:59:36 -0400 Subject: [PATCH 8/9] chore: fix TS building issues --- mcp-worker/tsconfig.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mcp-worker/tsconfig.json b/mcp-worker/tsconfig.json index bda7d7450..0c5a72718 100644 --- a/mcp-worker/tsconfig.json +++ b/mcp-worker/tsconfig.json @@ -16,17 +16,21 @@ "esModuleInterop": true, "skipLibCheck": true, "strict": true, - "declaration": false, + "declaration": true, "declarationMap": false, "sourceMap": true }, "include": [ "src/**/*", - "../src/mcp/**/*", - "worker-configuration.d.ts" + "../src/**/*", + "worker-configuration.d.ts", + "package.json" ], "exclude": [ "node_modules", - "dist" + "dist", + "../src/**/*.test.ts", + "../src/**/__snapshots__/**", + "src/**/*.test.ts" ] } \ No newline at end of file From 28904b7c2f03cf8f4af3770cb77549bb8334a532 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Fri, 22 Aug 2025 10:20:49 -0400 Subject: [PATCH 9/9] test: update Ably MCP error message expectations --- mcp-worker/src/ably.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mcp-worker/src/ably.test.ts b/mcp-worker/src/ably.test.ts index 475b19158..1f98bec56 100644 --- a/mcp-worker/src/ably.test.ts +++ b/mcp-worker/src/ably.test.ts @@ -62,7 +62,7 @@ describe('publishMCPInstallEvent', () => { name: 'N', email: 'e', } as any), - ).rejects.toThrow('ABLY_API_KEY is required to publish MCP events') + ).rejects.toThrow('ABLY_API_KEY is required to publish Ably MCP events') }) test('throws when org_id missing', async () => { @@ -71,7 +71,9 @@ describe('publishMCPInstallEvent', () => { name: 'N', email: 'e', } as any), - ).rejects.toThrow('org_id is required in claims to publish MCP events') + ).rejects.toThrow( + 'org_id is required in claims to publish Ably MCP events', + ) }) test('logs and rethrows on publish error', async () => {