add empty chat endpoint

This commit is contained in:
Devin Zuczek
2026-06-12 17:28:00 -04:00
parent 4d1ea9fe3e
commit e89bf3451f
14 changed files with 12762 additions and 493 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ Player-settings worker served at `playersettings.rec.djdevin.net`.
player's settings, keyed by the `sub` claim of the Bearer JWT. Returns `200`.
Persisted in Workers KV (`PLAYER_SETTINGS`, key `player:<id>`).
> The C# `PutPlayerSettings` replaces the player's *entire* settings set on each
> The C# `PutPlayerSettings` replaces the player's _entire_ settings set on each
> call; we merge instead, so a single-key PUT (e.g. `key=PlayerSessionCount`)
> doesn't wipe the others.
@@ -37,7 +37,10 @@ async function bearer(sub = '42'): Promise<Record<string, string>> {
return { Authorization: `Bearer ${signingInput}.${b64url(sig)}` }
}
function putForm(fields: Record<string, string>, headers: Record<string, string> = {}): RequestInit {
function putForm(
fields: Record<string, string>,
headers: Record<string, string> = {}
): RequestInit {
return {
method: 'PUT',
headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...headers },
@@ -99,8 +102,14 @@ describe('playersettings endpoints', () => {
})
it('PUT /playersettings merges instead of replacing', async () => {
await SELF.fetch(`${ORIGIN}/playersettings`, putForm({ key: 'A', value: '1' }, await bearer('8')))
await SELF.fetch(`${ORIGIN}/playersettings`, putForm({ key: 'B', value: '2' }, await bearer('8')))
await SELF.fetch(
`${ORIGIN}/playersettings`,
putForm({ key: 'A', value: '1' }, await bearer('8'))
)
await SELF.fetch(
`${ORIGIN}/playersettings`,
putForm({ key: 'B', value: '2' }, await bearer('8'))
)
const stored = await env.PLAYER_SETTINGS.get<Record<string, string>>('player:8', 'json')
expect(stored).toEqual({ A: '1', B: '2' })
+6814 -489
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20250428.0 2025-09-20 nodejs_compat
// Runtime types generated with workerd@1.20260317.1 2025-09-20 nodejs_compat
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
@@ -19,17 +19,26 @@ and limitations under the License.
// noinspection JSUnusedGlobalSymbols
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.
* The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
*/
declare class DOMException extends Error {
constructor(message?: string, name?: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
/**
* The **`message`** read-only property of the a message or description associated with the given error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
*/
readonly message: string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
/**
* The **`name`** read-only property of the one of the strings associated with an error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
*/
readonly name: string;
/**
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
@@ -73,45 +82,121 @@ type WorkerGlobalScopeEventMap = {
declare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {
EventTarget: typeof EventTarget;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *
* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)
*/
interface Console {
"assert"(condition?: boolean, ...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static) */
/**
* The **`console.clear()`** static method clears the console if possible.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)
*/
clear(): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static) */
/**
* The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)
*/
count(label?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countreset_static) */
/**
* The **`console.countReset()`** static method resets counter used with console/count_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
*/
countReset(label?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
/**
* The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
*/
debug(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */
/**
* The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
*/
dir(item?: any, options?: any): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */
/**
* The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
*/
dirxml(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
/**
* The **`console.error()`** static method outputs a message to the console at the 'error' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
*/
error(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */
/**
* The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
*/
group(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupcollapsed_static) */
/**
* The **`console.groupCollapsed()`** static method creates a new inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
*/
groupCollapsed(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupend_static) */
/**
* The **`console.groupEnd()`** static method exits the current inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
*/
groupEnd(): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
/**
* The **`console.info()`** static method outputs a message to the console at the 'info' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
*/
info(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
/**
* The **`console.log()`** static method outputs a message to the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
*/
log(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static) */
/**
* The **`console.table()`** static method displays tabular data as a table.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)
*/
table(tabularData?: any, properties?: string[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
/**
* The **`console.time()`** static method starts a timer you can use to track how long an operation takes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
*/
time(label?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeend_static) */
/**
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
*/
timeEnd(label?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timelog_static) */
/**
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
*/
timeLog(label?: string, ...data: any[]): void;
timeStamp(label?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
/**
* The **`console.trace()`** static method outputs a stack trace to the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)
*/
trace(...data: any[]): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
/**
* The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
*/
warn(...data: any[]): void;
}
declare const console: Console;
@@ -185,7 +270,7 @@ declare namespace WebAssembly {
function validate(bytes: BufferSource): boolean;
}
/**
* This ServiceWorker API interface represents the global execution context of a service worker.
* The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)
@@ -231,6 +316,8 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
CountQueuingStrategy: typeof CountQueuingStrategy;
ErrorEvent: typeof ErrorEvent;
MessageChannel: typeof MessageChannel;
MessagePort: typeof MessagePort;
EventSource: typeof EventSource;
ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
@@ -272,7 +359,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(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.
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -281,25 +368,25 @@ declare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlob
declare function btoa(data: string): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */
declare function atob(data: string): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
declare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setTimeout) */
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
declare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearTimeout) */
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */
declare function clearTimeout(timeoutId: number | null): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
declare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
declare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/clearInterval) */
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */
declare function clearInterval(timeoutId: number | null): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */
declare function queueMicrotask(task: Function): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
declare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/reportError) */
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */
declare function reportError(error: any): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */
declare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;
declare const self: ServiceWorkerGlobalScope;
/**
@@ -330,54 +417,37 @@ declare const origin: string;
declare const navigator: Navigator;
interface TestController {
}
interface ExecutionContext {
interface ExecutionContext<Props = unknown> {
waitUntil(promise: Promise<any>): void;
passThroughOnException(): void;
props: any;
readonly props: Props;
}
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext) => Response | Promise<Response>;
type ExportedHandlerTailHandler<Env = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise<void>;
type ExportedHandlerTraceHandler<Env = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext) => void | Promise<void>;
type ExportedHandlerTailStreamHandler<Env = unknown> = (event: TailStream.TailEvent, env: Env, ctx: ExecutionContext) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
type ExportedHandlerScheduledHandler<Env = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext) => void | Promise<void>;
type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext) => void | Promise<void>;
type ExportedHandlerTestHandler<Env = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext) => void | Promise<void>;
interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown> {
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
tail?: ExportedHandlerTailHandler<Env>;
trace?: ExportedHandlerTraceHandler<Env>;
tailStream?: ExportedHandlerTailStreamHandler<Env>;
scheduled?: ExportedHandlerScheduledHandler<Env>;
test?: ExportedHandlerTestHandler<Env>;
email?: EmailExportedHandler<Env>;
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage>;
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
type ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
type ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
type ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
type ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
type ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
type ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
interface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;
tail?: ExportedHandlerTailHandler<Env, Props>;
trace?: ExportedHandlerTraceHandler<Env, Props>;
tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;
scheduled?: ExportedHandlerScheduledHandler<Env, Props>;
test?: ExportedHandlerTestHandler<Env, Props>;
email?: EmailExportedHandler<Env, Props>;
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
}
interface StructuredSerializeOptions {
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<any>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason) */
readonly reason: any;
}
declare abstract class Navigator {
sendBeacon(url: string, body?: (ReadableStream | string | (ArrayBuffer | ArrayBufferView) | Blob | FormData | URLSearchParams | URLSearchParams)): boolean;
sendBeacon(url: string, body?: BodyInit): boolean;
readonly userAgent: string;
readonly hardwareConcurrency: number;
}
/**
* 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;
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
now(): number;
readonly language: string;
readonly languages: string[];
}
interface AlarmInvocationInfo {
readonly isRetry: boolean;
@@ -402,23 +472,29 @@ interface DurableObjectId {
equals(other: DurableObjectId): boolean;
readonly name?: string;
}
interface DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {
declare abstract class 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<T>;
getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
}
type DurableObjectJurisdiction = "eu" | "fedramp";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "oc" | "afr" | "me";
type DurableObjectRoutingMode = "primary-only";
interface DurableObjectNamespaceGetDurableObjectOptions {
locationHint?: DurableObjectLocationHint;
routingMode?: DurableObjectRoutingMode;
}
interface DurableObjectState {
interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {
}
interface DurableObjectState<Props = unknown> {
waitUntil(promise: Promise<any>): void;
readonly props: Props;
readonly id: DurableObjectId;
readonly storage: DurableObjectStorage;
container?: Container;
@@ -461,6 +537,7 @@ interface DurableObjectStorage {
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
sync(): Promise<void>;
sql: SqlStorage;
kv: SyncKvStorage;
transactionSync<T>(closure: () => T): T;
getCurrentBookmark(): Promise<string>;
getBookmarkForTime(timestamp: number | Date): Promise<string>;
@@ -506,116 +583,120 @@ interface AnalyticsEngineDataPoint {
blobs?: ((ArrayBuffer | string) | null)[];
}
/**
* An event which takes place in the DOM.
* The **`Event`** interface represents an event which takes place on an `EventTarget`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
*/
declare class Event {
constructor(type: string, init?: EventInit);
/**
* Returns the type of event, e.g. "click", "hashchange", or "submit".
* The **`type`** read-only property of the Event interface returns a string containing the event's type.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
*/
get type(): string;
/**
* Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE.
* The **`eventPhase`** read-only property of the being evaluated.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
*/
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.
* The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
*/
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.
* The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
*/
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.
* The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
*/
get cancelable(): boolean;
/**
* Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
* The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
*/
get defaultPrevented(): boolean;
/**
* The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
*/
get returnValue(): boolean;
/**
* Returns the object whose event listener's callback is currently being invoked.
* The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
*/
get currentTarget(): EventTarget | undefined;
/**
* Returns the object to which event is dispatched (its target).
* The read-only **`target`** property of the dispatched.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
get target(): EventTarget | undefined;
/**
* The deprecated **`Event.srcElement`** is an alias for the Event.target property.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
*/
get srcElement(): EventTarget | undefined;
/**
* Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
* The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
*/
get timeStamp(): number;
/**
* Returns true if event was dispatched by the user agent, and false otherwise.
* The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
*/
get isTrusted(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
get cancelBubble(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
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.
* The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
*/
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.
* The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
*/
preventDefault(): void;
/**
* When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
* The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
*/
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.
* The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
*/
@@ -636,38 +717,26 @@ interface EventListenerObject<EventType extends Event = Event> {
}
type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
/**
* EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
* The **`EventTarget`** interface is 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<EventMap extends Record<string, Event> = Record<string, Event>> {
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.
*
* The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
*
* When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
*
* When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
*
* When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
*
* If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
*
* The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
* The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
*/
addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
/**
* Removes the event listener in target's event listener list with the same type, callback, and options.
* The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[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.
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -686,50 +755,70 @@ interface EventTargetHandlerObject {
handleEvent: (event: Event) => any | undefined;
}
/**
* A controller object that allows you to abort one or more DOM requests as and when desired.
* The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)
*/
declare class AbortController {
constructor();
/**
* Returns the AbortSignal object associated with this object.
* The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
*/
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.
* The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
*/
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.
* The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)
*/
declare abstract class AbortSignal extends EventTarget {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */
/**
* The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
*/
static abort(reason?: any): AbortSignal;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */
/**
* The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)
*/
static timeout(delay: number): AbortSignal;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */
/**
* The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
*/
static any(signals: AbortSignal[]): AbortSignal;
/**
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
* The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (`true`) or not (`false`).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
*/
get aborted(): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */
/**
* The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)
*/
get reason(): any;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
get onabort(): any | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
set onabort(value: any | null);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */
/**
* The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
*/
throwIfAborted(): void;
}
interface Scheduler {
@@ -739,19 +828,27 @@ interface SchedulerWaitOptions {
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.
* The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
*/
declare abstract class ExtendableEvent extends Event {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */
/**
* The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
*/
waitUntil(promise: Promise<any>): void;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) */
/**
* The **`CustomEvent`** interface represents events initialized by an application for any purpose.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
*/
declare class CustomEvent<T = any> extends Event {
constructor(type: string, init?: CustomEventCustomEventInit);
/**
* Returns any custom data event was created with. Typically used for synthetic events.
* The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
*/
@@ -764,39 +861,76 @@ interface CustomEventCustomEventInit {
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.
* The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)
*/
declare class Blob {
constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
/**
* The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)
*/
get size(): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
/**
* The **`type`** read-only property of the Blob interface returns the MIME type of the file.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)
*/
get type(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
/**
* The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)
*/
slice(start?: number, end?: number, type?: string): Blob;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */
/**
* The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)
*/
arrayBuffer(): Promise<ArrayBuffer>;
/**
* The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)
*/
bytes(): Promise<Uint8Array>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
/**
* The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)
*/
text(): Promise<string>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */
/**
* The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)
*/
stream(): ReadableStream;
}
interface BlobOptions {
type?: string;
}
/**
* Provides information about files and allows JavaScript in a web page to access their content.
* The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.
*
* [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);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
/**
* The **`name`** read-only property of the File interface returns the name of the file represented by a File object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
*/
get name(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
/**
* The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
*/
get lastModified(): number;
}
interface FileOptions {
@@ -809,7 +943,11 @@ interface FileOptions {
* [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) */
/**
* The **`open()`** method of the the Cache object matching the `cacheName`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
*/
open(cacheName: string): Promise<Cache>;
readonly default: Cache;
}
@@ -839,14 +977,20 @@ interface CacheQueryOptions {
*/
declare abstract class Crypto {
/**
* The **`Crypto.subtle`** read-only property returns a cryptographic operations.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
*/
get subtle(): SubtleCrypto;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */
/**
* The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)
*/
getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;
/**
* The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)
@@ -855,52 +999,116 @@ declare abstract class Crypto {
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).
* The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)
*/
declare abstract class SubtleCrypto {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt) */
/**
* The **`encrypt()`** method of the SubtleCrypto interface encrypts data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)
*/
encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) */
/**
* The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)
*/
decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign) */
/**
* The **`sign()`** method of the SubtleCrypto interface generates a digital signature.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)
*/
sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify) */
/**
* The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)
*/
verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) */
/**
* The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)
*/
digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey) */
/**
* The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)
*/
generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey) */
/**
* The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.
*
* [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<CryptoKey>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) */
/**
* The **`deriveBits()`** method of the key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)
*/
deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey) */
/**
* The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.
*
* [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<CryptoKey>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey) */
/**
* The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) */
/**
* The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)
*/
wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */
/**
* The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.
*
* [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<CryptoKey>;
timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;
}
/**
* The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
* The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
*/
declare abstract class CryptoKey {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */
/**
* The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)
*/
readonly type: string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */
/**
* The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)
*/
readonly extractable: boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */
/**
* The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)
*/
readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */
/**
* The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)
*/
readonly usages: string[];
}
interface CryptoKeyPair {
@@ -1007,24 +1215,14 @@ declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView>
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.
* The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
*/
declare class TextDecoder {
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.
*
* ```
* var string = "", decoder = new TextDecoder(encoding), buffer;
* while(buffer = next_chunk()) {
* string += decoder.decode(buffer, {stream:true});
* }
* string += decoder.decode(); // end-of-queue
* ```
*
* If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.
* The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
*/
@@ -1034,24 +1232,24 @@ declare class TextDecoder {
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.
* The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
*/
declare class TextEncoder {
constructor();
/**
* Returns the result of running UTF-8's encoder.
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
*/
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.
* The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
*/
encodeInto(input: string, buffer: ArrayBuffer | ArrayBufferView): TextEncoderEncodeIntoResult;
encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
get encoding(): string;
}
interface TextDecoderConstructorOptions {
@@ -1066,16 +1264,41 @@ interface TextEncoderEncodeIntoResult {
written: number;
}
/**
* Events providing information related to errors in scripts or in files.
* The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
*/
declare class ErrorEvent extends Event {
constructor(type: string, init?: ErrorEventErrorEventInit);
/**
* The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)
*/
get filename(): string;
/**
* The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)
*/
get message(): string;
/**
* The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)
*/
get lineno(): number;
/**
* The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)
*/
get colno(): number;
/**
* The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)
*/
get error(): any;
}
interface ErrorEventErrorEventInit {
@@ -1086,27 +1309,131 @@ interface ErrorEventErrorEventInit {
error?: any;
}
/**
* 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".
* The **`MessageEvent`** interface represents a message received by a target object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
*/
declare class MessageEvent extends Event {
constructor(type: string, initializer: MessageEventInit);
/**
* The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
*/
readonly data: any;
/**
* The **`origin`** read-only property of the origin of the message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
*/
readonly origin: string | null;
/**
* The **`lastEventId`** read-only property of the unique ID for the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
*/
readonly lastEventId: string;
/**
* The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
*/
readonly source: MessagePort | null;
/**
* The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
*/
readonly ports: MessagePort[];
}
interface MessageEventInit {
data: ArrayBuffer | string;
}
/**
* The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)
*/
declare abstract class PromiseRejectionEvent extends Event {
/**
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)
*/
readonly promise: Promise<any>;
/**
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)
*/
readonly reason: any;
}
/**
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
*/
declare class FormData {
constructor();
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */
/**
* The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
*/
append(name: string, value: string | Blob): void;
/**
* The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
*/
append(name: string, value: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */
/**
* The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)
*/
append(name: string, value: Blob, filename?: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) */
/**
* The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)
*/
delete(name: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) */
/**
* The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)
*/
get(name: string): (File | string) | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) */
/**
* The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)
*/
getAll(name: string): (File | string)[];
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) */
/**
* The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)
*/
has(name: string): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */
/**
* The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
*/
set(name: string, value: string | Blob): void;
/**
* The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
*/
set(name: string, value: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */
/**
* The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)
*/
set(name: string, value: Blob, filename?: string): void;
/* Returns an array of key, value pairs for every entry in the list. */
entries(): IterableIterator<[
@@ -1194,37 +1521,69 @@ interface 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.
* This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
*/
declare abstract class FetchEvent extends ExtendableEvent {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */
/**
* The **`request`** read-only property of the the event handler.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)
*/
readonly request: Request;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */
/**
* The **`respondWith()`** method of allows you to provide a promise for a Response yourself.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)
*/
respondWith(promise: Response | Promise<Response>): void;
passThroughOnException(): void;
}
type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;
/**
* 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.
* The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
*/
declare class Headers {
constructor(init?: HeadersInit);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get) */
/**
* The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)
*/
get(name: string): string | null;
getAll(name: string): string[];
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie) */
/**
* The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
*/
getSetCookie(): string[];
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has) */
/**
* The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)
*/
has(name: string): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set) */
/**
* The **`set()`** method of the Headers interface sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)
*/
set(name: string, value: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append) */
/**
* The **`append()`** method of the Headers interface appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)
*/
append(name: string, value: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete) */
/**
* The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)
*/
delete(name: string): void;
forEach<This = unknown>(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. */
@@ -1249,6 +1608,7 @@ declare abstract class Body {
get bodyUsed(): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
arrayBuffer(): Promise<ArrayBuffer>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */
bytes(): Promise<Uint8Array>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
text(): Promise<string>;
@@ -1260,7 +1620,7 @@ declare abstract class Body {
blob(): Promise<Blob>;
}
/**
* This Fetch API interface represents the response to a request.
* The **`Response`** interface of the Fetch API represents the response to a request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
*/
@@ -1272,28 +1632,60 @@ declare var Response: {
json(any: any, maybeInit?: (ResponseInit | Response)): Response;
};
/**
* This Fetch API interface represents the response to a request.
* The **`Response`** interface of the Fetch API represents the response to a request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
*/
interface Response extends Body {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
/**
* The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)
*/
clone(): Response;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
/**
* The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)
*/
status: number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
/**
* The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)
*/
statusText: string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
/**
* The **`headers`** read-only property of the with the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)
*/
headers: Headers;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
/**
* The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)
*/
ok: boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
/**
* The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)
*/
redirected: boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
/**
* The **`url`** read-only property of the Response interface contains the URL of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)
*/
url: string;
webSocket: WebSocket | null;
cf: any | undefined;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type) */
/**
* The **`type`** read-only property of the Response interface contains the type of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)
*/
type: "default" | "error";
}
interface ResponseInit {
@@ -1306,7 +1698,7 @@ interface ResponseInit {
}
type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;
/**
* This Fetch API interface represents a resource request.
* The **`Request`** interface of the Fetch API represents a resource request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
*/
@@ -1315,59 +1707,67 @@ declare var Request: {
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;
};
/**
* This Fetch API interface represents a resource request.
* The **`Request`** interface of the Fetch API represents a resource request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
*/
interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
/**
* The **`clone()`** method of the Request interface creates a copy of the current `Request` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)
*/
clone(): Request<CfHostMetadata, Cf>;
/**
* Returns request's HTTP method, which is "GET" by default.
* The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
*/
method: string;
/**
* Returns the URL of request as a string.
* The **`url`** read-only property of the Request interface contains the URL of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
*/
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.
* The **`headers`** read-only property of the with the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/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.
* The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
*/
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.
* The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
*/
signal: AbortSignal;
cf: Cf | undefined;
cf?: Cf;
/**
* 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]
* The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
*/
integrity: string;
/* Returns a boolean indicating whether or not request can outlive the global in which it was created. */
/**
* The **`keepalive`** read-only property of the Request interface contains the request's `keepalive` setting (`true` or `false`), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
*/
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.
* The **`cache`** read-only property of the Request interface contains the cache mode of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
*/
cache?: "no-store";
cache?: "no-store" | "no-cache";
}
interface RequestInit<Cf = CfProperties> {
/* A string to set request's method. */
@@ -1381,14 +1781,14 @@ interface RequestInit<Cf = CfProperties> {
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" | "no-cache";
/* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
integrity?: string;
/* An AbortSignal to set request's signal. */
signal?: (AbortSignal | null);
encodeResponseBody?: "automatic" | "manual";
}
type Service<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T>;
type Service<T extends (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher<InstanceType<T>> : T extends Rpc.WorkerEntrypointBranded ? Fetcher<T> : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded> ? never : Fetcher<undefined>;
type Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | "fetch" | "connect"> : unknown) & {
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
@@ -1560,6 +1960,7 @@ interface R2ObjectBody extends R2Object {
get body(): ReadableStream;
get bodyUsed(): boolean;
arrayBuffer(): Promise<ArrayBuffer>;
bytes(): Promise<Uint8Array>;
text(): Promise<string>;
json<T>(): Promise<T>;
blob(): Promise<Blob>;
@@ -1683,6 +2084,8 @@ interface Transformer<I = any, O = any> {
expectedLength?: number;
}
interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
/**
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
*
@@ -1701,8 +2104,6 @@ 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<R = any> = {
@@ -1713,24 +2114,52 @@ type ReadableStreamReadResult<R = any> = {
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.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
interface ReadableStream<R = any> {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked) */
/**
* The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)
*/
get locked(): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel) */
/**
* The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)
*/
cancel(reason?: any): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
/**
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
getReader(): ReadableStreamDefaultReader<R>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */
/**
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough) */
/**
* The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)
*/
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo) */
/**
* The **`pipeTo()`** method of the ReadableStream interface pipes the current `ReadableStream` to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)
*/
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */
/**
* The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)
*/
tee(): [
ReadableStream<R>,
ReadableStream<R>
@@ -1739,7 +2168,7 @@ interface ReadableStream<R = any> {
[Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
}
/**
* 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.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -1748,24 +2177,48 @@ declare const ReadableStream: {
new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
};
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader) */
/**
* The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)
*/
declare class ReadableStreamDefaultReader<R = any> {
constructor(stream: ReadableStream);
get closed(): Promise<void>;
cancel(reason?: any): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read) */
/**
* The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)
*/
read(): Promise<ReadableStreamReadResult<R>>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock) */
/**
* The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)
*/
releaseLock(): void;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */
/**
* The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)
*/
declare class ReadableStreamBYOBReader {
constructor(stream: ReadableStream);
get closed(): Promise<void>;
cancel(reason?: any): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
/**
* The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
*/
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
/**
* The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)
*/
releaseLock(): void;
readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;
}
@@ -1780,115 +2233,259 @@ interface ReadableStreamGetReaderOptions {
*/
mode: "byob";
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
/**
* The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a 'pull request' for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).
*
* [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) */
/**
* The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)
*/
get view(): Uint8Array | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
/**
* The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)
*/
respond(bytesWritten: number): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
/**
* The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)
*/
respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;
get atLeast(): number | null;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) */
/**
* The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)
*/
declare abstract class ReadableStreamDefaultController<R = any> {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */
/**
* The **`desiredSize`** read-only property of the required to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)
*/
get desiredSize(): number | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close) */
/**
* The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)
*/
close(): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */
/**
* The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)
*/
enqueue(chunk?: R): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */
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;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
get desiredSize(): number | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
close(): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
/**
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)
*/
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.
* The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
*/
declare abstract class ReadableByteStreamController {
/**
* The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)
*/
get byobRequest(): ReadableStreamBYOBRequest | null;
/**
* The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its 'desired size'.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)
*/
get desiredSize(): number | null;
/**
* The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)
*/
close(): void;
/**
* The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)
*/
enqueue(chunk: ArrayBuffer | ArrayBufferView): void;
/**
* The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)
*/
error(reason: any): void;
}
/**
* The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
*/
declare abstract class WritableStreamDefaultController {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal) */
/**
* The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)
*/
get signal(): AbortSignal;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */
/**
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)
*/
error(reason?: any): void;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController) */
/**
* The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)
*/
declare abstract class TransformStreamDefaultController<O = any> {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize) */
/**
* The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)
*/
get desiredSize(): number | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue) */
/**
* The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)
*/
enqueue(chunk?: O): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */
/**
* The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)
*/
error(reason: any): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate) */
/**
* The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)
*/
terminate(): void;
}
interface ReadableWritablePair<R = any, W = any> {
readable: ReadableStream<R>;
/**
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
*
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
*/
writable: WritableStream<W>;
readable: ReadableStream<R>;
}
/**
* 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.
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
*/
declare class WritableStream<W = any> {
constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked) */
/**
* The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)
*/
get locked(): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort) */
/**
* The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)
*/
abort(reason?: any): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */
/**
* The **`close()`** method of the WritableStream interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)
*/
close(): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */
/**
* The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)
*/
getWriter(): WritableStreamDefaultWriter<W>;
}
/**
* 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.
* The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the `WritableStream` ensuring that no other streams can write to the underlying sink.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)
*/
declare class WritableStreamDefaultWriter<W = any> {
constructor(stream: WritableStream);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */
/**
* The **`closed`** read-only property of the the stream errors or the writer's lock is released.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)
*/
get closed(): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready) */
/**
* The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)
*/
get ready(): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */
/**
* The **`desiredSize`** read-only property of the to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)
*/
get desiredSize(): number | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort) */
/**
* The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)
*/
abort(reason?: any): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */
/**
* The **`close()`** method of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)
*/
close(): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */
/**
* The **`write()`** method of the operation.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)
*/
write(chunk?: W): Promise<void>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */
/**
* The **`releaseLock()`** method of the corresponding stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)
*/
releaseLock(): void;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream) */
/**
* The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)
*/
declare class TransformStream<I = any, O = any> {
constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */
/**
* The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)
*/
get readable(): ReadableStream<O>;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */
/**
* The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)
*/
get writable(): WritableStream<I>;
}
declare class FixedLengthStream extends IdentityTransformStream {
@@ -1903,20 +2500,36 @@ interface IdentityTransformStreamQueuingStrategy {
interface ReadableStreamValuesOptions {
preventCancel?: boolean;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) */
/**
* The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)
*/
declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) */
/**
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)
*/
declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream) */
/**
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)
*/
declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
constructor();
get encoding(): string;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream) */
/**
* The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)
*/
declare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {
constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
get encoding(): string;
@@ -1928,25 +2541,33 @@ interface TextDecoderStreamTextDecoderStreamInit {
ignoreBOM?: boolean;
}
/**
* This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams.
* The **`ByteLengthQueuingStrategy`** interface of the Streams API 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<ArrayBufferView> {
constructor(init: QueuingStrategyInit);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */
/**
* The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)
*/
get highWaterMark(): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */
get size(): (chunk?: any) => number;
}
/**
* This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams.
* The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)
*/
declare class CountQueuingStrategy implements QueuingStrategy {
constructor(init: QueuingStrategyInit);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */
/**
* The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)
*/
get highWaterMark(): number;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */
get size(): (chunk?: any) => number;
@@ -1979,6 +2600,7 @@ interface TraceItem {
readonly scriptVersion?: ScriptVersion;
readonly dispatchNamespace?: string;
readonly scriptTags?: string[];
readonly durableObjectId?: string;
readonly outcome: string;
readonly executionModel: string;
readonly truncated: boolean;
@@ -2064,111 +2686,231 @@ interface UnsafeTraceMetrics {
fromTrace(item: TraceItem): TraceMetrics;
}
/**
* The URL interface represents an object providing static methods used for creating object URLs.
* The **`URL`** interface is used to parse, construct, normalize, and encode URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
*/
declare class URL {
constructor(url: string | URL, base?: string | URL);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */
/**
* The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)
*/
get origin(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
/**
* The **`href`** property of the URL interface is a string containing the whole URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
*/
get href(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */
/**
* The **`href`** property of the URL interface is a string containing the whole URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
*/
set href(value: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
/**
* The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
*/
get protocol(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */
/**
* The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
*/
set protocol(value: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
/**
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
get username(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */
/**
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
set username(value: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
/**
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
get password(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */
/**
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
set password(value: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
/**
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
get host(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */
/**
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
set host(value: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
/**
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
get hostname(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */
/**
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
set hostname(value: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
/**
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
get port(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */
/**
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
set port(value: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
/**
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
get pathname(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */
/**
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
set pathname(value: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
/**
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
get search(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */
/**
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
set search(value: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
/**
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
get hash(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */
/**
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
set hash(value: string);
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */
/**
* The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
*/
get searchParams(): URLSearchParams;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */
/**
* The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
*/
toJSON(): string;
/*function toString() { [native code] }*/
toString(): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
/**
* The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)
*/
static canParse(url: string, base?: string): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static) */
/**
* The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)
*/
static parse(url: string, base?: string): URL | null;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static) */
/**
* The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
*/
static createObjectURL(object: File | Blob): string;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static) */
/**
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
*/
static revokeObjectURL(object_url: string): void;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
/**
* The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)
*/
declare class URLSearchParams {
constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
/**
* The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)
*/
get size(): number;
/**
* Appends a specified key/value pair as a new search parameter.
* The **`append()`** method of the URLSearchParams interface 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;
/**
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
* The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
*/
delete(name: string, value?: string): void;
/**
* Returns the first value associated to the given search parameter.
* The **`get()`** method of the URLSearchParams interface 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;
/**
* Returns all the values association with a given search parameter.
* The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
*/
getAll(name: string): string[];
/**
* Returns a Boolean indicating if such a search parameter exists.
* The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
*/
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.
* The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
*/
set(name: string, value: string): void;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
/**
* The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
*/
sort(): void;
/* Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[
@@ -2180,7 +2922,7 @@ declare class URLSearchParams {
/* Returns a list of values in the search params. */
values(): IterableIterator<string>;
forEach<This = unknown>(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. */
/*function toString() { [native code] }*/
toString(): string;
[Symbol.iterator](): IterableIterator<[
key: string,
@@ -2231,26 +2973,26 @@ interface URLPatternOptions {
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.
* A `CloseEvent` is sent to clients using WebSockets when the connection is closed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
*/
declare class CloseEvent extends Event {
constructor(type: string, initializer?: CloseEventInit);
/**
* Returns the WebSocket connection close code provided by the server.
* The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
*/
readonly code: number;
/**
* Returns the WebSocket connection close reason provided by the server.
* The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
*/
readonly reason: string;
/**
* Returns true if the connection closed cleanly; false otherwise.
* The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
*/
@@ -2261,23 +3003,6 @@ interface CloseEventInit {
reason?: string;
wasClean?: boolean;
}
/**
* A message received by a target object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
*/
declare class MessageEvent extends Event {
constructor(type: string, initializer: MessageEventInit);
/**
* Returns the data of the message.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
*/
readonly data: ArrayBuffer | string;
}
interface MessageEventInit {
data: ArrayBuffer | string;
}
type WebSocketEventMap = {
close: CloseEvent;
message: MessageEvent;
@@ -2285,7 +3010,7 @@ type WebSocketEventMap = {
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.
* The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
*/
@@ -2302,20 +3027,20 @@ declare var WebSocket: {
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.
* The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
*/
interface WebSocket extends EventTarget<WebSocketEventMap> {
accept(): void;
accept(options?: WebSocketAcceptOptions): void;
/**
* Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
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.
* The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
*/
@@ -2323,29 +3048,45 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
serializeAttachment(attachment: any): void;
deserializeAttachment(): any | null;
/**
* Returns the state of the WebSocket object's connection. It can have the values described below.
* The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
*/
readyState: number;
/**
* Returns the URL that was used to establish the WebSocket connection.
* The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
*/
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.
* The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the `protocols` parameter when creating the WebSocket object, or the empty string if no connection is established.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
*/
protocol: string | null;
/**
* Returns the extensions selected by the server, if any.
* The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
*/
extensions: string | null;
/**
* The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)
*/
binaryType: "blob" | "arraybuffer";
}
interface WebSocketAcceptOptions {
/**
* When set to `true`, receiving a server-initiated WebSocket Close frame will not
* automatically send a reciprocal Close frame, leaving the connection in a half-open
* state. This is useful for proxying scenarios where you need to coordinate closing
* both sides independently. Defaults to `false` when the
* `no_web_socket_half_open_by_default` compatibility flag is enabled.
*/
allowHalfOpen?: boolean;
}
declare const WebSocketPair: {
new (): {
@@ -2404,29 +3145,33 @@ interface SocketInfo {
remoteAddress?: string;
localAddress?: string;
}
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
/**
* The **`EventSource`** interface is web content's interface to server-sent events.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)
*/
declare class EventSource extends EventTarget {
constructor(url: string, init?: EventSourceEventSourceInit);
/**
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
* The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
*/
close(): void;
/**
* Returns the URL providing the event stream.
* The **`url`** read-only property of the URL of the source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
*/
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.
* The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
*/
get withCredentials(): boolean;
/**
* Returns the state of this EventSource object's connection. It can have the values described below.
* The **`readyState`** read-only property of the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
*/
@@ -2459,11 +3204,310 @@ interface Container {
destroy(error?: any): Promise<void>;
signal(signo: number): void;
getTcpPort(port: number): Fetcher;
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
}
interface ContainerStartupOptions {
entrypoint?: string[];
enableInternet: boolean;
env?: Record<string, string>;
hardTimeout?: (number | bigint);
}
/**
* The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
*/
declare abstract class MessagePort extends EventTarget {
/**
* The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
*/
postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;
/**
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
*/
close(): void;
/**
* The **`start()`** method of the MessagePort interface starts the sending of messages queued 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);
}
/**
* The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
*/
declare class MessageChannel {
constructor();
/**
* The **`port1`** read-only property of the the port attached to the context that originated the channel.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
*/
readonly port1: MessagePort;
/**
* The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
*/
readonly port2: MessagePort;
}
interface MessagePortPostMessageOptions {
transfer?: any[];
}
type LoopbackForExport<T extends (new (...args: any[]) => Rpc.EntrypointBranded) | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? LoopbackServiceStub<InstanceType<T>> : T extends new (...args: any[]) => Rpc.DurableObjectBranded ? LoopbackDurableObjectClass<InstanceType<T>> : T extends ExportedHandler<any, any, any> ? LoopbackServiceStub<undefined> : undefined;
type LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: {
props?: Props;
}) => Fetcher<T> : (opts: {
props?: any;
}) => Fetcher<T>);
type LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: {
props?: Props;
}) => DurableObjectClass<T> : (opts: {
props?: any;
}) => DurableObjectClass<T>);
interface SyncKvStorage {
get<T = unknown>(key: string): T | undefined;
list<T = unknown>(options?: SyncKvListOptions): Iterable<[
string,
T
]>;
put<T>(key: string, value: T): void;
delete(key: string): boolean;
}
interface SyncKvListOptions {
start?: string;
startAfter?: string;
end?: string;
prefix?: string;
reverse?: boolean;
limit?: number;
}
interface WorkerStub {
getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>;
}
interface WorkerStubEntrypointOptions {
props?: any;
}
interface WorkerLoader {
get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;
load(code: WorkerLoaderWorkerCode): WorkerStub;
}
interface WorkerLoaderModule {
js?: string;
cjs?: string;
text?: string;
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
compatibilityFlags?: string[];
allowExperimental?: boolean;
mainModule: string;
modules: Record<string, WorkerLoaderModule | string>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
streamingTails?: Fetcher[];
}
/**
* 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 abstract class Performance {
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */
get timeOrigin(): number;
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */
now(): number;
/**
* The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
*/
toJSON(): object;
}
// AI Search V2 API Error Interfaces
interface AiSearchInternalError extends Error {
}
interface AiSearchNotFoundError extends Error {
}
interface AiSearchNameNotSetError extends Error {
}
// AI Search V2 Request Types
type AiSearchSearchRequest = {
messages: Array<{
role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
content: string | null;
}>;
ai_search_options?: {
retrieval?: {
retrieval_type?: 'vector' | 'keyword' | 'hybrid';
/** Match threshold (0-1, default 0.4) */
match_threshold?: number;
/** Maximum number of results (1-50, default 10) */
max_num_results?: number;
filters?: VectorizeVectorMetadataFilter;
/** Context expansion (0-3, default 0) */
context_expansion?: number;
[key: string]: unknown;
};
query_rewrite?: {
enabled?: boolean;
model?: string;
rewrite_prompt?: string;
[key: string]: unknown;
};
reranking?: {
/** Enable reranking (default false) */
enabled?: boolean;
model?: '@cf/baai/bge-reranker-base' | '';
/** Match threshold (0-1, default 0.4) */
match_threshold?: number;
[key: string]: unknown;
};
[key: string]: unknown;
};
};
type AiSearchChatCompletionsRequest = {
messages: Array<{
role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';
content: string | null;
}>;
model?: string;
stream?: boolean;
ai_search_options?: {
retrieval?: {
retrieval_type?: 'vector' | 'keyword' | 'hybrid';
match_threshold?: number;
max_num_results?: number;
filters?: VectorizeVectorMetadataFilter;
context_expansion?: number;
[key: string]: unknown;
};
query_rewrite?: {
enabled?: boolean;
model?: string;
rewrite_prompt?: string;
[key: string]: unknown;
};
reranking?: {
enabled?: boolean;
model?: '@cf/baai/bge-reranker-base' | '';
match_threshold?: number;
[key: string]: unknown;
};
[key: string]: unknown;
};
[key: string]: unknown;
};
// AI Search V2 Response Types
type AiSearchSearchResponse = {
search_query: string;
chunks: Array<{
id: string;
type: string;
/** Match score (0-1) */
score: number;
text: string;
item: {
timestamp?: number;
key: string;
metadata?: Record<string, unknown>;
};
scoring_details?: {
/** Keyword match score (0-1) */
keyword_score?: number;
/** Vector similarity score (0-1) */
vector_score?: number;
};
}>;
};
type AiSearchListResponse = Array<{
id: string;
internal_id?: string;
account_id?: string;
account_tag?: string;
/** Whether the instance is enabled (default true) */
enable?: boolean;
type?: 'r2' | 'web-crawler';
source?: string;
[key: string]: unknown;
}>;
type AiSearchConfig = {
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
id: string;
type: 'r2' | 'web-crawler';
source: string;
source_params?: object;
/** Token ID (UUID format) */
token_id?: string;
ai_gateway_id?: string;
/** Enable query rewriting (default false) */
rewrite_query?: boolean;
/** Enable reranking (default false) */
reranking?: boolean;
embedding_model?: string;
ai_search_model?: string;
};
type AiSearchInstance = {
id: string;
enable?: boolean;
type?: 'r2' | 'web-crawler';
source?: string;
[key: string]: unknown;
};
// AI Search Instance Service - Instance-level operations
declare abstract class AiSearchInstanceService {
/**
* Search the AI Search instance for relevant chunks.
* @param params Search request with messages and AI search options
* @returns Search response with matching chunks
*/
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
/**
* Generate chat completions with AI Search context.
* @param params Chat completions request with optional streaming
* @returns Response object (if streaming) or chat completion result
*/
chatCompletions(params: AiSearchChatCompletionsRequest): Promise<Response | object>;
/**
* Delete this AI Search instance.
*/
delete(): Promise<void>;
}
// AI Search Account Service - Account-level operations
declare abstract class AiSearchAccountService {
/**
* List all AI Search instances in the account.
* @returns Array of AI Search instances
*/
list(): Promise<AiSearchListResponse>;
/**
* Get an AI Search instance by ID.
* @param name Instance ID
* @returns Instance service for performing operations
*/
get(name: string): AiSearchInstanceService;
/**
* Create a new AI Search instance.
* @param config Instance configuration
* @returns Instance service for performing operations
*/
create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
}
type AiImageClassificationInput = {
image: number[];
@@ -2519,6 +3563,18 @@ declare abstract class BaseAiImageTextToText {
inputs: AiImageTextToTextInput;
postProcessedOutputs: AiImageTextToTextOutput;
}
type AiMultimodalEmbeddingsInput = {
image: string;
text: string[];
};
type AiIMultimodalEmbeddingsOutput = {
data: number[][];
shape: number[];
};
declare abstract class BaseAiMultimodalEmbeddings {
inputs: AiImageTextToTextInput;
postProcessedOutputs: AiImageTextToTextOutput;
}
type AiObjectDetectionInput = {
image: number[];
};
@@ -2649,13 +3705,28 @@ type AiTextGenerationInput = {
tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>);
functions?: AiTextGenerationFunctionsInput[];
};
type AiTextGenerationToolLegacyOutput = {
name: string;
arguments: unknown;
};
type AiTextGenerationToolOutput = {
id: string;
type: "function";
function: {
name: string;
arguments: string;
};
};
type UsageTags = {
prompt_tokens: number;
completion_tokens: number;
total_tokens: number;
};
type AiTextGenerationOutput = {
response?: string;
tool_calls?: {
name: string;
arguments: unknown;
}[];
} | ReadableStream;
tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[];
usage?: UsageTags;
};
declare abstract class BaseAiTextGeneration {
inputs: AiTextGenerationInput;
postProcessedOutputs: AiTextGenerationOutput;
@@ -2701,6 +3772,402 @@ declare abstract class BaseAiTranslation {
inputs: AiTranslationInput;
postProcessedOutputs: AiTranslationOutput;
}
/**
* Workers AI support for OpenAI's Responses API
* Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts
*
* It's a stripped down version from its source.
* It currently supports basic function calling, json mode and accepts images as input.
*
* It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools.
* We plan to add those incrementally as model + platform capabilities evolve.
*/
type ResponsesInput = {
background?: boolean | null;
conversation?: string | ResponseConversationParam | null;
include?: Array<ResponseIncludable> | null;
input?: string | ResponseInput;
instructions?: string | null;
max_output_tokens?: number | null;
parallel_tool_calls?: boolean | null;
previous_response_id?: string | null;
prompt_cache_key?: string;
reasoning?: Reasoning | null;
safety_identifier?: string;
service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
stream?: boolean | null;
stream_options?: StreamOptions | null;
temperature?: number | null;
text?: ResponseTextConfig;
tool_choice?: ToolChoiceOptions | ToolChoiceFunction;
tools?: Array<Tool>;
top_p?: number | null;
truncation?: "auto" | "disabled" | null;
};
type ResponsesOutput = {
id?: string;
created_at?: number;
output_text?: string;
error?: ResponseError | null;
incomplete_details?: ResponseIncompleteDetails | null;
instructions?: string | Array<ResponseInputItem> | null;
object?: "response";
output?: Array<ResponseOutputItem>;
parallel_tool_calls?: boolean;
temperature?: number | null;
tool_choice?: ToolChoiceOptions | ToolChoiceFunction;
tools?: Array<Tool>;
top_p?: number | null;
max_output_tokens?: number | null;
previous_response_id?: string | null;
prompt?: ResponsePrompt | null;
reasoning?: Reasoning | null;
safety_identifier?: string;
service_tier?: "auto" | "default" | "flex" | "scale" | "priority" | null;
status?: ResponseStatus;
text?: ResponseTextConfig;
truncation?: "auto" | "disabled" | null;
usage?: ResponseUsage;
};
type EasyInputMessage = {
content: string | ResponseInputMessageContentList;
role: "user" | "assistant" | "system" | "developer";
type?: "message";
};
type ResponsesFunctionTool = {
name: string;
parameters: {
[key: string]: unknown;
} | null;
strict: boolean | null;
type: "function";
description?: string | null;
};
type ResponseIncompleteDetails = {
reason?: "max_output_tokens" | "content_filter";
};
type ResponsePrompt = {
id: string;
variables?: {
[key: string]: string | ResponseInputText | ResponseInputImage;
} | null;
version?: string | null;
};
type Reasoning = {
effort?: ReasoningEffort | null;
generate_summary?: "auto" | "concise" | "detailed" | null;
summary?: "auto" | "concise" | "detailed" | null;
};
type ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText;
type ResponseContentReasoningText = {
text: string;
type: "reasoning_text";
};
type ResponseConversationParam = {
id: string;
};
type ResponseCreatedEvent = {
response: Response;
sequence_number: number;
type: "response.created";
};
type ResponseCustomToolCallOutput = {
call_id: string;
output: string | Array<ResponseInputText | ResponseInputImage>;
type: "custom_tool_call_output";
id?: string;
};
type ResponseError = {
code: "server_error" | "rate_limit_exceeded" | "invalid_prompt" | "vector_store_timeout" | "invalid_image" | "invalid_image_format" | "invalid_base64_image" | "invalid_image_url" | "image_too_large" | "image_too_small" | "image_parse_error" | "image_content_policy_violation" | "invalid_image_mode" | "image_file_too_large" | "unsupported_image_media_type" | "empty_image_file" | "failed_to_download_image" | "image_file_not_found";
message: string;
};
type ResponseErrorEvent = {
code: string | null;
message: string;
param: string | null;
sequence_number: number;
type: "error";
};
type ResponseFailedEvent = {
response: Response;
sequence_number: number;
type: "response.failed";
};
type ResponseFormatText = {
type: "text";
};
type ResponseFormatJSONObject = {
type: "json_object";
};
type ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject;
type ResponseFormatTextJSONSchemaConfig = {
name: string;
schema: {
[key: string]: unknown;
};
type: "json_schema";
description?: string;
strict?: boolean | null;
};
type ResponseFunctionCallArgumentsDeltaEvent = {
delta: string;
item_id: string;
output_index: number;
sequence_number: number;
type: "response.function_call_arguments.delta";
};
type ResponseFunctionCallArgumentsDoneEvent = {
arguments: string;
item_id: string;
name: string;
output_index: number;
sequence_number: number;
type: "response.function_call_arguments.done";
};
type ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent;
type ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>;
type ResponseFunctionToolCall = {
arguments: string;
call_id: string;
name: string;
type: "function_call";
id?: string;
status?: "in_progress" | "completed" | "incomplete";
};
interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {
id: string;
}
type ResponseFunctionToolCallOutputItem = {
id: string;
call_id: string;
output: string | Array<ResponseInputText | ResponseInputImage>;
type: "function_call_output";
status?: "in_progress" | "completed" | "incomplete";
};
type ResponseIncludable = "message.input_image.image_url" | "message.output_text.logprobs";
type ResponseIncompleteEvent = {
response: Response;
sequence_number: number;
type: "response.incomplete";
};
type ResponseInput = Array<ResponseInputItem>;
type ResponseInputContent = ResponseInputText | ResponseInputImage;
type ResponseInputImage = {
detail: "low" | "high" | "auto";
type: "input_image";
/**
* Base64 encoded image
*/
image_url?: string | null;
};
type ResponseInputImageContent = {
type: "input_image";
detail?: "low" | "high" | "auto" | null;
/**
* Base64 encoded image
*/
image_url?: string | null;
};
type ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem;
type ResponseInputItemFunctionCallOutput = {
call_id: string;
output: string | ResponseFunctionCallOutputItemList;
type: "function_call_output";
id?: string | null;
status?: "in_progress" | "completed" | "incomplete" | null;
};
type ResponseInputItemMessage = {
content: ResponseInputMessageContentList;
role: "user" | "system" | "developer";
status?: "in_progress" | "completed" | "incomplete";
type?: "message";
};
type ResponseInputMessageContentList = Array<ResponseInputContent>;
type ResponseInputMessageItem = {
id: string;
content: ResponseInputMessageContentList;
role: "user" | "system" | "developer";
status?: "in_progress" | "completed" | "incomplete";
type?: "message";
};
type ResponseInputText = {
text: string;
type: "input_text";
};
type ResponseInputTextContent = {
text: string;
type: "input_text";
};
type ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem;
type ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem;
type ResponseOutputItemAddedEvent = {
item: ResponseOutputItem;
output_index: number;
sequence_number: number;
type: "response.output_item.added";
};
type ResponseOutputItemDoneEvent = {
item: ResponseOutputItem;
output_index: number;
sequence_number: number;
type: "response.output_item.done";
};
type ResponseOutputMessage = {
id: string;
content: Array<ResponseOutputText | ResponseOutputRefusal>;
role: "assistant";
status: "in_progress" | "completed" | "incomplete";
type: "message";
};
type ResponseOutputRefusal = {
refusal: string;
type: "refusal";
};
type ResponseOutputText = {
text: string;
type: "output_text";
logprobs?: Array<Logprob>;
};
type ResponseReasoningItem = {
id: string;
summary: Array<ResponseReasoningSummaryItem>;
type: "reasoning";
content?: Array<ResponseReasoningContentItem>;
encrypted_content?: string | null;
status?: "in_progress" | "completed" | "incomplete";
};
type ResponseReasoningSummaryItem = {
text: string;
type: "summary_text";
};
type ResponseReasoningContentItem = {
text: string;
type: "reasoning_text";
};
type ResponseReasoningTextDeltaEvent = {
content_index: number;
delta: string;
item_id: string;
output_index: number;
sequence_number: number;
type: "response.reasoning_text.delta";
};
type ResponseReasoningTextDoneEvent = {
content_index: number;
item_id: string;
output_index: number;
sequence_number: number;
text: string;
type: "response.reasoning_text.done";
};
type ResponseRefusalDeltaEvent = {
content_index: number;
delta: string;
item_id: string;
output_index: number;
sequence_number: number;
type: "response.refusal.delta";
};
type ResponseRefusalDoneEvent = {
content_index: number;
item_id: string;
output_index: number;
refusal: string;
sequence_number: number;
type: "response.refusal.done";
};
type ResponseStatus = "completed" | "failed" | "in_progress" | "cancelled" | "queued" | "incomplete";
type ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent;
type ResponseCompletedEvent = {
response: Response;
sequence_number: number;
type: "response.completed";
};
type ResponseTextConfig = {
format?: ResponseFormatTextConfig;
verbosity?: "low" | "medium" | "high" | null;
};
type ResponseTextDeltaEvent = {
content_index: number;
delta: string;
item_id: string;
logprobs: Array<Logprob>;
output_index: number;
sequence_number: number;
type: "response.output_text.delta";
};
type ResponseTextDoneEvent = {
content_index: number;
item_id: string;
logprobs: Array<Logprob>;
output_index: number;
sequence_number: number;
text: string;
type: "response.output_text.done";
};
type Logprob = {
token: string;
logprob: number;
top_logprobs?: Array<TopLogprob>;
};
type TopLogprob = {
token?: string;
logprob?: number;
};
type ResponseUsage = {
input_tokens: number;
output_tokens: number;
total_tokens: number;
};
type Tool = ResponsesFunctionTool;
type ToolChoiceFunction = {
name: string;
type: "function";
};
type ToolChoiceOptions = "none";
type ReasoningEffort = "minimal" | "low" | "medium" | "high" | null;
type StreamOptions = {
include_obfuscation?: boolean;
};
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";
} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse;
interface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {
/**
* The async request id that can be used to obtain the results.
*/
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
@@ -2730,6 +4197,132 @@ 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;
} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse;
interface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {
/**
* The async request id that can be used to obtain the results.
*/
request_id?: string;
}
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";
} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse;
interface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {
/**
* The async request id that can be used to obtain the results.
*/
request_id?: string;
}
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";
} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse;
interface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {
/**
* The async request id that can be used to obtain the results.
*/
request_id?: string;
}
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.
@@ -2821,7 +4414,7 @@ interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
/**
* Preprocess the audio with a voice activity detection model.
*/
vad_filter?: string;
vad_filter?: boolean;
/**
* A text prompt to help provide context to the model on the contents of the audio.
*/
@@ -2911,8 +4504,13 @@ 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;
interface BGEM3InputQueryAndContexts {
type Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | {
/**
* Batch of the embeddings requests to run using async-queue
*/
requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[];
};
interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {
/**
* A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts
*/
@@ -2931,15 +4529,41 @@ interface BGEM3InputQueryAndContexts {
*/
truncate_inputs?: boolean;
}
interface BGEM3InputEmbedding {
interface Ai_Cf_Baai_Bge_M3_Input_Embedding {
text: string | string[];
/**
* When provided with too long context should the model error out or truncate the context to fit?
*/
truncate_inputs?: boolean;
}
type Ai_Cf_Baai_Bge_M3_Output = BGEM3OuputQuery | BGEM3OutputEmbeddingForContexts | BGEM3OuputEmbedding;
interface BGEM3OuputQuery {
interface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {
/**
* 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;
/**
* List of provided contexts. Note that the index in this array is important, as the response will refer to it.
*/
contexts: {
/**
* One of the provided context content
*/
text?: string;
}[];
/**
* When provided with too long context should the model error out or truncate the context to fit?
*/
truncate_inputs?: boolean;
}
interface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {
text: string | string[];
/**
* When provided with too long context should the model error out or truncate the context to fit?
*/
truncate_inputs?: boolean;
}
type Ai_Cf_Baai_Bge_M3_Output = Ai_Cf_Baai_Bge_M3_Ouput_Query | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts | Ai_Cf_Baai_Bge_M3_Ouput_Embedding | Ai_Cf_Baai_Bge_M3_AsyncResponse;
interface Ai_Cf_Baai_Bge_M3_Ouput_Query {
response?: {
/**
* Index of the context in the request
@@ -2951,7 +4575,7 @@ interface BGEM3OuputQuery {
score?: number;
}[];
}
interface BGEM3OutputEmbeddingForContexts {
interface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {
response?: number[][];
shape?: number[];
/**
@@ -2959,7 +4583,7 @@ interface BGEM3OutputEmbeddingForContexts {
*/
pooling?: "mean" | "cls";
}
interface BGEM3OuputEmbedding {
interface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {
shape?: number[];
/**
* Embeddings of the requested text values
@@ -2970,6 +4594,12 @@ interface BGEM3OuputEmbedding {
*/
pooling?: "mean" | "cls";
}
interface Ai_Cf_Baai_Bge_M3_AsyncResponse {
/**
* The async request id that can be used to obtain the results.
*/
request_id?: string;
}
declare abstract class Base_Ai_Cf_Baai_Bge_M3 {
inputs: Ai_Cf_Baai_Bge_M3_Input;
postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;
@@ -2994,8 +4624,8 @@ 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;
}
type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages;
interface Prompt {
type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt | Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages;
interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {
/**
* The input text prompt for the model to generate a response.
*/
@@ -3046,7 +4676,7 @@ interface Prompt {
*/
lora?: string;
}
interface Messages {
interface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {
/**
* An array of message objects representing the conversation history.
*/
@@ -3054,13 +4684,38 @@ interface 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.
* 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
*/
content: 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;
};
};
}[];
image?: number[] | string;
image?: number[] | (string & NonNullable<unknown>);
functions?: {
name: string;
code: string;
@@ -3207,11 +4862,313 @@ type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {
*/
name?: string;
}[];
} | ReadableStream;
};
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;
}
type Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch;
interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {
/**
* The input text prompt for the model to generate a response.
*/
prompt: string;
/**
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
*/
lora?: string;
response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {
/**
* An array of message objects representing the conversation history.
*/
messages: {
/**
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
*/
role: string;
/**
* The content of the message as a string.
*/
content: string;
}[];
functions?: {
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?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {
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;
/**
* Prompt for the text generation model
*/
prompt?: string;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2;
}[];
}
interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
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;
}[];
} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse;
interface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {
/**
* The async request id that can be used to obtain the results.
*/
request_id?: string;
}
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;
}
interface Ai_Cf_Meta_Llama_Guard_3_8B_Input {
/**
* An array of message objects representing the conversation history.
@@ -3311,8 +5268,255 @@ 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;
}
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 {
type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt | Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages;
interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {
/**
* The input text prompt for the model to generate a response.
*/
prompt: string;
/**
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
*/
lora?: string;
response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {
/**
* An array of message objects representing the conversation history.
*/
messages: {
/**
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
*/
role: string;
/**
* The content of the message as a string.
*/
content: string;
}[];
functions?: {
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?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
type Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_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;
}[];
};
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;
}
type Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages;
interface Ai_Cf_Qwen_Qwq_32B_Prompt {
/**
* The input text prompt for the model to generate a response.
*/
@@ -3362,7 +5566,7 @@ interface Ai_Cf_Meta_Llama_4_Prompt {
*/
presence_penalty?: number;
}
interface Ai_Cf_Meta_Llama_4_Messages {
interface Ai_Cf_Qwen_Qwq_32B_Messages {
/**
* An array of message objects representing the conversation history.
*/
@@ -3493,7 +5697,1025 @@ interface Ai_Cf_Meta_Llama_4_Messages {
};
})[];
/**
* JSON schema that should be fufilled for the response.
* JSON schema that should be fulfilled for the response.
*/
guided_json?: object;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
type Ai_Cf_Qwen_Qwq_32B_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;
}[];
};
declare abstract class Base_Ai_Cf_Qwen_Qwq_32B {
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 = Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt | Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages;
interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {
/**
* The input text prompt for the model to generate a response.
*/
prompt: string;
/**
* JSON schema that should be fulfilled for the response.
*/
guided_json?: object;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {
/**
* An array of message objects representing the conversation history.
*/
messages: {
/**
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
*/
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;
};
};
}[];
functions?: {
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;
};
};
};
};
})[];
/**
* JSON schema that should be fulfilled for the response.
*/
guided_json?: object;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
type Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_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;
}[];
};
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;
}
type Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages;
interface Ai_Cf_Google_Gemma_3_12B_It_Prompt {
/**
* The input text prompt for the model to generate a response.
*/
prompt: string;
/**
* JSON schema that should be fulfilled for the response.
*/
guided_json?: object;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Google_Gemma_3_12B_It_Messages {
/**
* An array of message objects representing the conversation history.
*/
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;
};
}[];
}[];
functions?: {
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;
};
};
};
};
})[];
/**
* JSON schema that should be fulfilled for the response.
*/
guided_json?: object;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
type Ai_Cf_Google_Gemma_3_12B_It_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;
}[];
};
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;
}
type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch;
interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {
/**
* The input text prompt for the model to generate a response.
*/
prompt: string;
/**
* JSON schema that should be fulfilled for the response.
*/
guided_json?: object;
response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {
/**
* An array of message objects representing the conversation history.
*/
messages: {
/**
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
*/
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;
};
};
}[];
functions?: {
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?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
/**
* JSON schema that should be fulfilled for the response.
*/
guided_json?: object;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {
requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[];
}
interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {
/**
* The input text prompt for the model to generate a response.
*/
prompt: string;
/**
* JSON schema that should be fulfilled for the response.
*/
guided_json?: object;
response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {
/**
* An array of message objects representing the conversation history.
*/
messages: {
/**
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
*/
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;
};
};
}[];
functions?: {
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?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;
/**
* JSON schema that should be fulfilled for the response.
*/
guided_json?: object;
/**
@@ -3564,19 +6786,1772 @@ type Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {
*/
tool_calls?: {
/**
* The arguments passed to be passed to the tool call request
* The tool call id.
*/
arguments?: object;
id?: string;
/**
* The name of the tool to be called
* Specifies the type of tool (e.g., 'function').
*/
name?: string;
type?: string;
/**
* Details of the function tool.
*/
function?: {
/**
* The name of the tool to be called
*/
name?: string;
/**
* The arguments passed to be passed to the tool call request
*/
arguments?: object;
};
}[];
} | string;
};
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;
}
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch;
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {
/**
* The input text prompt for the model to generate a response.
*/
prompt: string;
/**
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
*/
lora?: string;
response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {
/**
* An array of message objects representing the conversation history.
*/
messages: {
/**
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
*/
role: string;
/**
* The content of the message as a string.
*/
content: string;
}[];
functions?: {
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?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {
requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[];
}
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {
/**
* The input text prompt for the model to generate a response.
*/
prompt: string;
/**
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
*/
lora?: string;
response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {
/**
* An array of message objects representing the conversation history.
*/
messages: {
/**
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
*/
role: string;
/**
* The content of the message as a string.
*/
content: string;
}[];
functions?: {
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?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
type Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response | string | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse;
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {
/**
* Unique identifier for the completion
*/
id?: string;
/**
* Object type identifier
*/
object?: "chat.completion";
/**
* Unix timestamp of when the completion was created
*/
created?: number;
/**
* Model used for the completion
*/
model?: string;
/**
* List of completion choices
*/
choices?: {
/**
* Index of the choice in the list
*/
index?: number;
/**
* The message generated by the model
*/
message?: {
/**
* Role of the message author
*/
role: string;
/**
* The content of the message
*/
content: string;
/**
* Internal reasoning content (if available)
*/
reasoning_content?: string;
/**
* Tool calls made by the assistant
*/
tool_calls?: {
/**
* Unique identifier for the tool call
*/
id: string;
/**
* Type of tool call
*/
type: "function";
function: {
/**
* Name of the function to call
*/
name: string;
/**
* JSON string of arguments for the function
*/
arguments: string;
};
}[];
};
/**
* Reason why the model stopped generating
*/
finish_reason?: string;
/**
* Stop reason (may be null)
*/
stop_reason?: string | null;
/**
* Log probabilities (if requested)
*/
logprobs?: {} | null;
}[];
/**
* 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;
};
/**
* Log probabilities for the prompt (if requested)
*/
prompt_logprobs?: {} | null;
}
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {
/**
* Unique identifier for the completion
*/
id?: string;
/**
* Object type identifier
*/
object?: "text_completion";
/**
* Unix timestamp of when the completion was created
*/
created?: number;
/**
* Model used for the completion
*/
model?: string;
/**
* List of completion choices
*/
choices?: {
/**
* Index of the choice in the list
*/
index: number;
/**
* The generated text completion
*/
text: string;
/**
* Reason why the model stopped generating
*/
finish_reason: string;
/**
* Stop reason (may be null)
*/
stop_reason?: string | null;
/**
* Log probabilities (if requested)
*/
logprobs?: {} | null;
/**
* Log probabilities for the prompt (if requested)
*/
prompt_logprobs?: {} | null;
}[];
/**
* 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;
};
}
interface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {
/**
* The async request id that can be used to obtain the results.
*/
request_id?: string;
}
declare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 {
inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input;
postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output;
}
interface Ai_Cf_Deepgram_Nova_3_Input {
audio: {
body: object;
contentType: string;
};
/**
* Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param.
*/
custom_topic_mode?: "extended" | "strict";
/**
* Custom topics you want the model to detect within your input audio or text if present Submit up to 100
*/
custom_topic?: string;
/**
* Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in addition those submitted using the custom_intents param
*/
custom_intent_mode?: "extended" | "strict";
/**
* Custom intents you want the model to detect within your input audio if present
*/
custom_intent?: string;
/**
* Identifies and extracts key entities from content in submitted audio
*/
detect_entities?: boolean;
/**
* Identifies the dominant language spoken in submitted audio
*/
detect_language?: boolean;
/**
* Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0
*/
diarize?: boolean;
/**
* Identify and extract key entities from content in submitted audio
*/
dictation?: boolean;
/**
* Specify the expected encoding of your submitted audio
*/
encoding?: "linear16" | "flac" | "mulaw" | "amr-nb" | "amr-wb" | "opus" | "speex" | "g729";
/**
* Arbitrary key-value pairs that are attached to the API response for usage in downstream processing
*/
extra?: string;
/**
* Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'
*/
filler_words?: boolean;
/**
* Key term prompting can boost or suppress specialized terminology and brands.
*/
keyterm?: string;
/**
* Keywords can boost or suppress specialized terminology and brands.
*/
keywords?: string;
/**
* The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available.
*/
language?: string;
/**
* Spoken measurements will be converted to their corresponding abbreviations.
*/
measurements?: boolean;
/**
* Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip.
*/
mip_opt_out?: boolean;
/**
* Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio
*/
mode?: "general" | "medical" | "finance";
/**
* Transcribe each audio channel independently.
*/
multichannel?: boolean;
/**
* Numerals converts numbers from written format to numerical format.
*/
numerals?: boolean;
/**
* Splits audio into paragraphs to improve transcript readability.
*/
paragraphs?: boolean;
/**
* Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.
*/
profanity_filter?: boolean;
/**
* Add punctuation and capitalization to the transcript.
*/
punctuate?: boolean;
/**
* Redaction removes sensitive information from your transcripts.
*/
redact?: string;
/**
* Search for terms or phrases in submitted audio and replaces them.
*/
replace?: string;
/**
* Search for terms or phrases in submitted audio.
*/
search?: string;
/**
* Recognizes the sentiment throughout a transcript or text.
*/
sentiment?: boolean;
/**
* Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.
*/
smart_format?: boolean;
/**
* Detect topics throughout a transcript or text.
*/
topics?: boolean;
/**
* Segments speech into meaningful semantic units.
*/
utterances?: boolean;
/**
* Seconds to wait before detecting a pause between words in submitted audio.
*/
utt_split?: number;
/**
* The number of channels in the submitted audio
*/
channels?: number;
/**
* Specifies whether the streaming endpoint should provide ongoing transcription updates as more audio is received. When set to true, the endpoint sends continuous updates, meaning transcription results may evolve over time. Note: Supported only for webosockets.
*/
interim_results?: boolean;
/**
* Indicates how long model will wait to detect whether a speaker has finished speaking or pauses for a significant period of time. When set to a value, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final parameter set to true. Can also be set to false to disable endpointing
*/
endpointing?: string;
/**
* Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.
*/
vad_events?: boolean;
/**
* Indicates how long model will wait to send an UtteranceEnd message after a word has been transcribed. Use with interim_results. Note: Supported only for webosockets.
*/
utterance_end_ms?: boolean;
}
interface Ai_Cf_Deepgram_Nova_3_Output {
results?: {
channels?: {
alternatives?: {
confidence?: number;
transcript?: string;
words?: {
confidence?: number;
end?: number;
start?: number;
word?: string;
}[];
}[];
}[];
summary?: {
result?: string;
short?: string;
};
sentiments?: {
segments?: {
text?: string;
start_word?: number;
end_word?: number;
sentiment?: string;
sentiment_score?: number;
}[];
average?: {
sentiment?: string;
sentiment_score?: number;
};
};
};
}
declare abstract class Base_Ai_Cf_Deepgram_Nova_3 {
inputs: Ai_Cf_Deepgram_Nova_3_Input;
postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;
}
interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {
queries?: string | string[];
/**
* Optional instruction for the task
*/
instruction?: string;
documents?: string | string[];
text?: string | string[];
}
interface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {
data?: number[][];
shape?: number[];
}
declare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B {
inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input;
postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output;
}
type Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {
/**
* readable stream with audio data and content-type specified for that data
*/
audio: {
body: object;
contentType: string;
};
/**
* type of data PCM data that's sent to the inference server as raw array
*/
dtype?: "uint8" | "float32" | "float64";
} | {
/**
* base64 encoded audio data
*/
audio: string;
/**
* type of data PCM data that's sent to the inference server as raw array
*/
dtype?: "uint8" | "float32" | "float64";
};
interface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {
/**
* if true, end-of-turn was detected
*/
is_complete?: boolean;
/**
* probability of the end-of-turn detection
*/
probability?: number;
}
declare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {
inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;
postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;
}
declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {
inputs: ResponsesInput;
postProcessedOutputs: ResponsesOutput;
}
declare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {
inputs: ResponsesInput;
postProcessedOutputs: ResponsesOutput;
}
interface Ai_Cf_Leonardo_Phoenix_1_0_Input {
/**
* A text description of the image you want to generate.
*/
prompt: string;
/**
* Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt
*/
guidance?: number;
/**
* Random seed for reproducibility of the image generation
*/
seed?: number;
/**
* The height of the generated image in pixels
*/
height?: number;
/**
* The width of the generated image in pixels
*/
width?: number;
/**
* The number of diffusion steps; higher values can improve quality but take longer
*/
num_steps?: number;
/**
* Specify what to exclude from the generated images
*/
negative_prompt?: string;
}
/**
* The generated image in JPEG format
*/
type Ai_Cf_Leonardo_Phoenix_1_0_Output = string;
declare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {
inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;
postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;
}
interface Ai_Cf_Leonardo_Lucid_Origin_Input {
/**
* A text description of the image you want to generate.
*/
prompt: string;
/**
* Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt
*/
guidance?: number;
/**
* Random seed for reproducibility of the image generation
*/
seed?: number;
/**
* The height of the generated image in pixels
*/
height?: number;
/**
* The width of the generated image in pixels
*/
width?: number;
/**
* The number of diffusion steps; higher values can improve quality but take longer
*/
num_steps?: number;
/**
* The number of diffusion steps; higher values can improve quality but take longer
*/
steps?: number;
}
interface Ai_Cf_Leonardo_Lucid_Origin_Output {
/**
* The generated image in Base64 format.
*/
image?: string;
}
declare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {
inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;
postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;
}
interface Ai_Cf_Deepgram_Aura_1_Input {
/**
* Speaker used to produce the audio.
*/
speaker?: "angus" | "asteria" | "arcas" | "orion" | "orpheus" | "athena" | "luna" | "zeus" | "perseus" | "helios" | "hera" | "stella";
/**
* Encoding of the output audio.
*/
encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";
/**
* Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..
*/
container?: "none" | "wav" | "ogg";
/**
* The text content to be converted to speech
*/
text: string;
/**
* Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable
*/
sample_rate?: number;
/**
* The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.
*/
bit_rate?: number;
}
/**
* The generated audio in MP3 format
*/
type Ai_Cf_Deepgram_Aura_1_Output = string;
declare abstract class Base_Ai_Cf_Deepgram_Aura_1 {
inputs: Ai_Cf_Deepgram_Aura_1_Input;
postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;
}
interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {
/**
* Input text to translate. Can be a single string or a list of strings.
*/
text: string | string[];
/**
* Target language to translate to
*/
target_language: "asm_Beng" | "awa_Deva" | "ben_Beng" | "bho_Deva" | "brx_Deva" | "doi_Deva" | "eng_Latn" | "gom_Deva" | "gon_Deva" | "guj_Gujr" | "hin_Deva" | "hne_Deva" | "kan_Knda" | "kas_Arab" | "kas_Deva" | "kha_Latn" | "lus_Latn" | "mag_Deva" | "mai_Deva" | "mal_Mlym" | "mar_Deva" | "mni_Beng" | "mni_Mtei" | "npi_Deva" | "ory_Orya" | "pan_Guru" | "san_Deva" | "sat_Olck" | "snd_Arab" | "snd_Deva" | "tam_Taml" | "tel_Telu" | "urd_Arab" | "unr_Deva";
}
interface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {
/**
* Translated texts
*/
translations: string[];
}
declare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B {
inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input;
postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output;
}
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch;
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {
/**
* The input text prompt for the model to generate a response.
*/
prompt: string;
/**
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
*/
lora?: string;
response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {
/**
* An array of message objects representing the conversation history.
*/
messages: {
/**
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
*/
role: string;
/**
* The content of the message as a string.
*/
content: string;
}[];
functions?: {
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?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {
requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[];
}
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {
/**
* The input text prompt for the model to generate a response.
*/
prompt: string;
/**
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
*/
lora?: string;
response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {
/**
* An array of message objects representing the conversation history.
*/
messages: {
/**
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
*/
role: string;
/**
* The content of the message as a string.
*/
content: string;
}[];
functions?: {
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?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3;
/**
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
*/
raw?: boolean;
/**
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
*/
stream?: boolean;
/**
* The maximum number of tokens to generate in the response.
*/
max_tokens?: number;
/**
* Controls the randomness of the output; higher values produce more random results.
*/
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;
/**
* 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;
}
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {
type?: "json_object" | "json_schema";
json_schema?: unknown;
}
type Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response | string | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse;
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response {
/**
* Unique identifier for the completion
*/
id?: string;
/**
* Object type identifier
*/
object?: "chat.completion";
/**
* Unix timestamp of when the completion was created
*/
created?: number;
/**
* Model used for the completion
*/
model?: string;
/**
* List of completion choices
*/
choices?: {
/**
* Index of the choice in the list
*/
index?: number;
/**
* The message generated by the model
*/
message?: {
/**
* Role of the message author
*/
role: string;
/**
* The content of the message
*/
content: string;
/**
* Internal reasoning content (if available)
*/
reasoning_content?: string;
/**
* Tool calls made by the assistant
*/
tool_calls?: {
/**
* Unique identifier for the tool call
*/
id: string;
/**
* Type of tool call
*/
type: "function";
function: {
/**
* Name of the function to call
*/
name: string;
/**
* JSON string of arguments for the function
*/
arguments: string;
};
}[];
};
/**
* Reason why the model stopped generating
*/
finish_reason?: string;
/**
* Stop reason (may be null)
*/
stop_reason?: string | null;
/**
* Log probabilities (if requested)
*/
logprobs?: {} | null;
}[];
/**
* 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;
};
/**
* Log probabilities for the prompt (if requested)
*/
prompt_logprobs?: {} | null;
}
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response {
/**
* Unique identifier for the completion
*/
id?: string;
/**
* Object type identifier
*/
object?: "text_completion";
/**
* Unix timestamp of when the completion was created
*/
created?: number;
/**
* Model used for the completion
*/
model?: string;
/**
* List of completion choices
*/
choices?: {
/**
* Index of the choice in the list
*/
index: number;
/**
* The generated text completion
*/
text: string;
/**
* Reason why the model stopped generating
*/
finish_reason: string;
/**
* Stop reason (may be null)
*/
stop_reason?: string | null;
/**
* Log probabilities (if requested)
*/
logprobs?: {} | null;
/**
* Log probabilities for the prompt (if requested)
*/
prompt_logprobs?: {} | null;
}[];
/**
* 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;
};
}
interface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {
/**
* The async request id that can be used to obtain the results.
*/
request_id?: string;
}
declare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It {
inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input;
postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output;
}
interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {
/**
* Input text to embed. Can be a single string or a list of strings.
*/
text: string | string[];
}
interface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {
/**
* Embedding vectors, where each vector is a list of floats.
*/
data: number[][];
/**
* Shape of the embedding data as [number_of_embeddings, embedding_dimension].
*
* @minItems 2
* @maxItems 2
*/
shape: [
number,
number
];
}
declare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B {
inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input;
postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output;
}
interface Ai_Cf_Deepgram_Flux_Input {
/**
* Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM.
*/
encoding: "linear16";
/**
* Sample rate of the audio stream in Hz.
*/
sample_rate: string;
/**
* End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid Values 0.3 - 0.9.
*/
eager_eot_threshold?: string;
/**
* End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.
*/
eot_threshold?: string;
/**
* A turn will be finished when this much time has passed after speech, regardless of EOT confidence.
*/
eot_timeout_ms?: string;
/**
* Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.
*/
keyterm?: string;
/**
* Opts out requests from the Deepgram Model Improvement Program. Refer to Deepgram Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip
*/
mip_opt_out?: "true" | "false";
/**
* Label your requests for the purpose of identification during usage reporting
*/
tag?: string;
}
/**
* Output will be returned as websocket messages.
*/
interface Ai_Cf_Deepgram_Flux_Output {
/**
* The unique identifier of the request (uuid)
*/
request_id?: string;
/**
* Starts at 0 and increments for each message the server sends to the client.
*/
sequence_id?: number;
/**
* The type of event being reported.
*/
event?: "Update" | "StartOfTurn" | "EagerEndOfTurn" | "TurnResumed" | "EndOfTurn";
/**
* The index of the current turn
*/
turn_index?: number;
/**
* Start time in seconds of the audio range that was transcribed
*/
audio_window_start?: number;
/**
* End time in seconds of the audio range that was transcribed
*/
audio_window_end?: number;
/**
* Text that was said over the course of the current turn
*/
transcript?: string;
/**
* The words in the transcript
*/
words?: {
/**
* The individual punctuated, properly-cased word from the transcript
*/
word: string;
/**
* Confidence that this word was transcribed correctly
*/
confidence: number;
}[];
/**
* Confidence that no more speech is coming in this turn
*/
end_of_turn_confidence?: number;
}
declare abstract class Base_Ai_Cf_Deepgram_Flux {
inputs: Ai_Cf_Deepgram_Flux_Input;
postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output;
}
interface Ai_Cf_Deepgram_Aura_2_En_Input {
/**
* Speaker used to produce the audio.
*/
speaker?: "amalthea" | "andromeda" | "apollo" | "arcas" | "aries" | "asteria" | "athena" | "atlas" | "aurora" | "callista" | "cora" | "cordelia" | "delia" | "draco" | "electra" | "harmonia" | "helena" | "hera" | "hermes" | "hyperion" | "iris" | "janus" | "juno" | "jupiter" | "luna" | "mars" | "minerva" | "neptune" | "odysseus" | "ophelia" | "orion" | "orpheus" | "pandora" | "phoebe" | "pluto" | "saturn" | "thalia" | "theia" | "vesta" | "zeus";
/**
* Encoding of the output audio.
*/
encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";
/**
* Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..
*/
container?: "none" | "wav" | "ogg";
/**
* The text content to be converted to speech
*/
text: string;
/**
* Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable
*/
sample_rate?: number;
/**
* The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.
*/
bit_rate?: number;
}
/**
* The generated audio in MP3 format
*/
type Ai_Cf_Deepgram_Aura_2_En_Output = string;
declare abstract class Base_Ai_Cf_Deepgram_Aura_2_En {
inputs: Ai_Cf_Deepgram_Aura_2_En_Input;
postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output;
}
interface Ai_Cf_Deepgram_Aura_2_Es_Input {
/**
* Speaker used to produce the audio.
*/
speaker?: "sirio" | "nestor" | "carina" | "celeste" | "alvaro" | "diana" | "aquila" | "selena" | "estrella" | "javier";
/**
* Encoding of the output audio.
*/
encoding?: "linear16" | "flac" | "mulaw" | "alaw" | "mp3" | "opus" | "aac";
/**
* Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..
*/
container?: "none" | "wav" | "ogg";
/**
* The text content to be converted to speech
*/
text: string;
/**
* Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable
*/
sample_rate?: number;
/**
* The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.
*/
bit_rate?: number;
}
/**
* The generated audio in MP3 format
*/
type Ai_Cf_Deepgram_Aura_2_Es_Output = string;
declare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {
inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;
postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;
}
interface AiModels {
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
@@ -3585,11 +8560,8 @@ interface AiModels {
"@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
"@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
"@cf/myshell-ai/melotts": BaseAiTextToSpeech;
"@cf/baai/bge-base-en-v1.5": BaseAiTextEmbeddings;
"@cf/baai/bge-small-en-v1.5": BaseAiTextEmbeddings;
"@cf/baai/bge-large-en-v1.5": BaseAiTextEmbeddings;
"@cf/google/embeddinggemma-300m": BaseAiTextEmbeddings;
"@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;
@@ -3623,41 +8595,74 @@ interface AiModels {
"@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/meta/llama-3.3-70b-instruct-fp8-fast": BaseAiTextGeneration;
"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b": BaseAiTextGeneration;
"@cf/meta/m2m100-1.2b": BaseAiTranslation;
"@cf/ibm-granite/granite-4.0-h-micro": 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/qwen/qwen3-30b-a3b-fp8": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8;
"@cf/deepgram/nova-3": Base_Ai_Cf_Deepgram_Nova_3;
"@cf/qwen/qwen3-embedding-0.6b": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B;
"@cf/pipecat-ai/smart-turn-v2": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;
"@cf/openai/gpt-oss-120b": Base_Ai_Cf_Openai_Gpt_Oss_120B;
"@cf/openai/gpt-oss-20b": Base_Ai_Cf_Openai_Gpt_Oss_20B;
"@cf/leonardo/phoenix-1.0": Base_Ai_Cf_Leonardo_Phoenix_1_0;
"@cf/leonardo/lucid-origin": Base_Ai_Cf_Leonardo_Lucid_Origin;
"@cf/deepgram/aura-1": Base_Ai_Cf_Deepgram_Aura_1;
"@cf/ai4bharat/indictrans2-en-indic-1B": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B;
"@cf/aisingapore/gemma-sea-lion-v4-27b-it": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It;
"@cf/pfnet/plamo-embedding-1b": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B;
"@cf/deepgram/flux": Base_Ai_Cf_Deepgram_Flux;
"@cf/deepgram/aura-2-en": Base_Ai_Cf_Deepgram_Aura_2_En;
"@cf/deepgram/aura-2-es": Base_Ai_Cf_Deepgram_Aura_2_Es;
}
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;
/**
* Establish websocket connections, only works for supported models
*/
websocket?: boolean;
/**
* Tag your requests to group and view them in Cloudflare dashboard.
*
* Rules:
* Tags must only contain letters, numbers, and the symbols: : - . / @
* Each tag can have maximum 50 characters.
* Maximum 5 tags are allowed each request.
* Duplicate tags will removed.
*/
tags?: string[];
gateway?: GatewayOptions;
returnRawResponse?: boolean;
prefix?: string;
extraHeaders?: object;
};
type ConversionResponse = {
name: string;
mimeType: string;
format: "markdown";
tokens: number;
data: string;
};
type AiModelsSearchParams = {
author?: string;
hide_experimental?: boolean;
@@ -3691,25 +8696,60 @@ type AiModelListType = Record<string, any>;
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
aiGatewayLogId: string | null;
gateway(gatewayId: string): AiGateway;
/**
* Access the AI Search API for managing AI-powered search instances.
*
* This is the new API that replaces AutoRAG with better namespace separation:
* - Account-level operations: `list()`, `create()`
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
*
* @example
* ```typescript
* // List all AI Search instances
* const instances = await env.AI.aiSearch.list();
*
* // Search an instance
* const results = await env.AI.aiSearch.get('my-search').search({
* messages: [{ role: 'user', content: 'What is the policy?' }],
* ai_search_options: {
* retrieval: { max_num_results: 10 }
* }
* });
*
* // Generate chat completions with AI Search context
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
* messages: [{ role: 'user', content: 'What is the policy?' }],
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
* });
* ```
*/
aiSearch(): AiSearchAccountService;
/**
* @deprecated AutoRAG has been replaced by AI Search.
* Use `env.AI.aiSearch` instead for better API design and new features.
*
* Migration guide:
* - `env.AI.autorag().list()` `env.AI.aiSearch.list()`
* - `env.AI.autorag('id').search({ query: '...' })` `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
* - `env.AI.autorag('id').aiSearch(...)` `env.AI.aiSearch.get('id').chatCompletions(...)`
*
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
*
* @see AiSearchAccountService
* @param autoragId Optional instance ID (omit for account-level operations)
*/
autorag(autoragId: string): AutoRAG;
run<Name extends keyof AiModelList, Options extends AiOptions>(model: Name, inputs: AiModelList[Name]["inputs"], options?: Options): Promise<Options extends {
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 : AiModelList[Name]["postProcessedOutputs"]>;
} | {
websocket: true;
} ? Response : InputOptions extends {
stream: true;
} ? ReadableStream : AiModelList[Name]["postProcessedOutputs"]>;
models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
toMarkdown(files: {
name: string;
blob: Blob;
}[], options?: {
gateway?: GatewayOptions;
extraHeaders?: object;
}): Promise<ConversionResponse[]>;
toMarkdown(files: {
name: string;
blob: Blob;
}, options?: {
gateway?: GatewayOptions;
extraHeaders?: object;
}): Promise<ConversionResponse>;
toMarkdown(): ToMarkdownService;
toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;
toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;
}
type GatewayRetries = {
maxAttempts?: 1 | 2 | 3 | 4 | 5;
@@ -3727,6 +8767,12 @@ type GatewayOptions = {
requestTimeoutMs?: number;
retries?: GatewayRetries;
};
type UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {
/**
** @deprecated
*/
id?: string;
};
type AiGatewayPatchLog = {
score?: number | null;
feedback?: -1 | 1 | null;
@@ -3795,17 +8841,34 @@ declare abstract class AiGateway {
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
getLog(logId: string): Promise<AiGatewayLog>;
run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: {
gateway?: GatewayOptions;
gateway?: UniversalGatewayOptions;
extraHeaders?: object;
}): Promise<Response>;
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
}
/**
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
* @see AiSearchInternalError
*/
interface AutoRAGInternalError extends Error {
}
/**
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
* @see AiSearchNotFoundError
*/
interface AutoRAGNotFoundError extends Error {
}
/**
* @deprecated This error type is no longer used in the AI Search API.
*/
interface AutoRAGUnauthorizedError extends Error {
}
/**
* @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
* @see AiSearchNameNotSetError
*/
interface AutoRAGNameNotSetError extends Error {
}
type ComparisonFilter = {
key: string;
type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
@@ -3815,6 +8878,11 @@ type CompoundFilter = {
type: 'and' | 'or';
filters: ComparisonFilter[];
};
/**
* @deprecated AutoRAG has been replaced by AI Search.
* Use AiSearchSearchRequest with the new API instead.
* @see AiSearchSearchRequest
*/
type AutoRagSearchRequest = {
query: string;
filters?: CompoundFilter | ComparisonFilter;
@@ -3823,14 +8891,34 @@ type AutoRagSearchRequest = {
ranker?: string;
score_threshold?: number;
};
reranking?: {
enabled?: boolean;
model?: string;
};
rewrite_query?: boolean;
};
/**
* @deprecated AutoRAG has been replaced by AI Search.
* Use AiSearchChatCompletionsRequest with the new API instead.
* @see AiSearchChatCompletionsRequest
*/
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
stream?: boolean;
system_prompt?: string;
};
/**
* @deprecated AutoRAG has been replaced by AI Search.
* Use AiSearchChatCompletionsRequest with stream: true instead.
* @see AiSearchChatCompletionsRequest
*/
type AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {
stream: true;
};
/**
* @deprecated AutoRAG has been replaced by AI Search.
* Use AiSearchSearchResponse with the new API instead.
* @see AiSearchSearchResponse
*/
type AutoRagSearchResponse = {
object: 'vector_store.search_results.page';
search_query: string;
@@ -3847,13 +8935,65 @@ type AutoRagSearchResponse = {
has_more: boolean;
next_page: string | null;
};
/**
* @deprecated AutoRAG has been replaced by AI Search.
* Use AiSearchListResponse with the new API instead.
* @see AiSearchListResponse
*/
type AutoRagListResponse = {
id: string;
enable: boolean;
type: string;
source: string;
vectorize_name: string;
paused: boolean;
status: string;
}[];
/**
* @deprecated AutoRAG has been replaced by AI Search.
* The new API returns different response formats for chat completions.
*/
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
response: string;
};
/**
* @deprecated AutoRAG has been replaced by AI Search.
* Use the new AI Search API instead: `env.AI.aiSearch`
*
* Migration guide:
* - `env.AI.autorag().list()` `env.AI.aiSearch.list()`
* - `env.AI.autorag('id').search(...)` `env.AI.aiSearch.get('id').search(...)`
* - `env.AI.autorag('id').aiSearch(...)` `env.AI.aiSearch.get('id').chatCompletions(...)`
*
* @see AiSearchAccountService
* @see AiSearchInstanceService
*/
declare abstract class AutoRAG {
/**
* @deprecated Use `env.AI.aiSearch.list()` instead.
* @see AiSearchAccountService.list
*/
list(): Promise<AutoRagListResponse>;
/**
* @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
* Note: The new API uses a messages array instead of a query string.
* @see AiSearchInstanceService.search
*/
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
/**
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
* @see AiSearchInstanceService.chatCompletions
*/
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
/**
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
* @see AiSearchInstanceService.chatCompletions
*/
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
/**
* @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
* @see AiSearchInstanceService.chatCompletions
*/
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;
}
interface BasicImageTransformations {
@@ -3892,6 +9032,12 @@ interface BasicImageTransformations {
* breaks aspect ratio
*/
fit?: "scale-down" | "contain" | "cover" | "crop" | "pad" | "squeeze";
/**
* Image segmentation using artificial intelligence models. Sets pixels not
* within selected segment area to transparent e.g "foreground" sets every
* background pixel as transparent.
*/
segment?: "foreground";
/**
* When cropping with fit: "cover", this defines the side or point that should
* be left uncropped. The value is either a string
@@ -3904,7 +9050,7 @@ 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?: 'face' | '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(),
@@ -4191,13 +9337,13 @@ interface IncomingRequestCfPropertiesBase extends Record<string, unknown> {
*
* @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.
*
@@ -4321,7 +9467,7 @@ interface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {
* 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 {
/**
@@ -4598,6 +9744,10 @@ interface D1Meta {
* The region of the database instance that executed the query.
*/
served_by_region?: string;
/**
* The three letters airport code of the colo that executed the query.
*/
served_by_colo?: string;
/**
* True if-and-only-if the database instance that executed the query was the primary.
*/
@@ -4608,6 +9758,11 @@ interface D1Meta {
*/
sql_duration_ms: number;
};
/**
* Number of total attempts to execute the query, due to automatic retries.
* Note: All other fields in the response like `timings` only apply to the last attempt.
*/
total_attempts?: number;
}
interface D1Response {
success: true;
@@ -4625,11 +9780,11 @@ 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"
'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";
| 'first-unconstrained';
type D1SessionBookmark = string;
declare abstract class D1Database {
prepare(query: string): D1PreparedStatement;
@@ -4681,6 +9836,15 @@ declare abstract class D1PreparedStatement {
// ignored when `Disposable` is included in the standard lib.
interface Disposable {
}
/**
* The returned data after sending an email
*/
interface EmailSendResult {
/**
* The Email Message ID
*/
messageId: string;
}
/**
* An email message that can be sent from a Worker.
*/
@@ -4722,24 +9886,55 @@ interface ForwardableEmailMessage extends EmailMessage {
* @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<void>;
forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;
/**
* 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<void>;
reply(message: EmailMessage): Promise<EmailSendResult>;
}
/** A file attachment for an email message */
type EmailAttachment = {
disposition: 'inline';
contentId: string;
filename: string;
type: string;
content: string | ArrayBuffer | ArrayBufferView;
} | {
disposition: 'attachment';
contentId?: undefined;
filename: string;
type: string;
content: string | ArrayBuffer | ArrayBufferView;
};
/** An Email Address */
interface EmailAddress {
name: string;
email: string;
}
/**
* A binding that allows a Worker to send email messages.
*/
interface SendEmail {
send(message: EmailMessage): Promise<void>;
send(message: EmailMessage): Promise<EmailSendResult>;
send(builder: {
from: string | EmailAddress;
to: string | string[];
subject: string;
replyTo?: string | EmailAddress;
cc?: string | string[];
bcc?: string | string[];
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}): Promise<EmailSendResult>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
}
declare type EmailExportedHandler<Env = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext) => void | Promise<void>;
declare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
declare module "cloudflare:email" {
let _EmailMessage: {
prototype: EmailMessage;
@@ -4747,11 +9942,27 @@ declare module "cloudflare:email" {
};
export { _EmailMessage as EmailMessage };
}
/**
* Hello World binding to serve as an explanatory example. DO NOT USE
*/
interface HelloWorldBinding {
/**
* Retrieve the current stored value
*/
get(): Promise<{
value: string;
ms?: number;
}>;
/**
* Set a new stored value
*/
set(value: string): Promise<void>;
}
interface Hyperdrive {
/**
* Connect directly to Hyperdrive as if it's your database, returning a TCP socket.
*
* Calling this method returns an idential socket to if you call
* Calling this method returns an identical socket to if you call
* `connect("host:port")` using the `host` and `port` fields from this object.
* Pick whichever approach works better with your preferred DB client library.
*
@@ -4824,7 +10035,8 @@ type ImageTransform = {
fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop';
flip?: 'h' | 'v' | 'hv';
gamma?: number;
gravity?: 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {
segment?: 'foreground';
gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {
x?: number;
y?: number;
mode: 'remainder' | 'box-center';
@@ -4832,7 +10044,7 @@ type ImageTransform = {
rotate?: 0 | 90 | 180 | 270;
saturation?: number;
sharpen?: number;
trim?: "border" | {
trim?: 'border' | {
top?: number;
bottom?: number;
left?: number;
@@ -4854,24 +10066,109 @@ type ImageDrawOptions = {
bottom?: number;
right?: number;
};
type ImageInputOptions = {
encoding?: 'base64';
};
type ImageOutputOptions = {
format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba';
quality?: number;
background?: string;
anim?: boolean;
};
interface ImageMetadata {
id: string;
filename?: string;
uploaded?: string;
requireSignedURLs: boolean;
meta?: Record<string, unknown>;
variants: string[];
draft?: boolean;
creator?: string;
}
interface ImageUploadOptions {
id?: string;
filename?: string;
requireSignedURLs?: boolean;
metadata?: Record<string, unknown>;
creator?: string;
encoding?: 'base64';
}
interface ImageUpdateOptions {
requireSignedURLs?: boolean;
metadata?: Record<string, unknown>;
creator?: string;
}
interface ImageListOptions {
limit?: number;
cursor?: string;
sortOrder?: 'asc' | 'desc';
creator?: string;
}
interface ImageList {
images: ImageMetadata[];
cursor?: string;
listComplete: boolean;
}
interface HostedImagesBinding {
/**
* Get detailed metadata for a hosted image
* @param imageId The ID of the image (UUID or custom ID)
* @returns Image metadata, or null if not found
*/
details(imageId: string): Promise<ImageMetadata | null>;
/**
* Get the raw image data for a hosted image
* @param imageId The ID of the image (UUID or custom ID)
* @returns ReadableStream of image bytes, or null if not found
*/
image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;
/**
* Upload a new hosted image
* @param image The image file to upload
* @param options Upload configuration
* @returns Metadata for the uploaded image
* @throws {@link ImagesError} if upload fails
*/
upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;
/**
* Update hosted image metadata
* @param imageId The ID of the image
* @param options Properties to update
* @returns Updated image metadata
* @throws {@link ImagesError} if update fails
*/
update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;
/**
* Delete a hosted image
* @param imageId The ID of the image
* @returns True if deleted, false if not found
*/
delete(imageId: string): Promise<boolean>;
/**
* List hosted images with pagination
* @param options List configuration
* @returns List of images with pagination info
* @throws {@link ImagesError} if list fails
*/
list(options?: ImageListOptions): Promise<ImageList>;
}
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<Uint8Array>): Promise<ImageInfoResponse>;
info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>;
/**
* Begin applying a series of transformations to an image
* @param stream The image bytes
* @returns A transform handle
*/
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;
/**
* Access hosted images CRUD operations
*/
readonly hosted: HostedImagesBinding;
}
interface ImageTransformer {
/**
@@ -4894,6 +10191,9 @@ interface ImageTransformer {
*/
output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
}
type ImageTransformationOutputOptions = {
encoding?: 'base64';
};
interface ImageTransformationResult {
/**
* The image as a response, ready to store in cache or return to users
@@ -4906,13 +10206,138 @@ interface ImageTransformationResult {
/**
* The bytes of the response
*/
image(): ReadableStream<Uint8Array>;
image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>;
}
interface ImagesError extends Error {
readonly code: number;
readonly message: string;
readonly stack?: string;
}
/**
* Media binding for transforming media streams.
* Provides the entry point for media transformation operations.
*/
interface MediaBinding {
/**
* Creates a media transformer from an input stream.
* @param media - The input media bytes
* @returns A MediaTransformer instance for applying transformations
*/
input(media: ReadableStream<Uint8Array>): MediaTransformer;
}
/**
* Media transformer for applying transformation operations to media content.
* Handles sizing, fitting, and other input transformation parameters.
*/
interface MediaTransformer {
/**
* Applies transformation options to the media content.
* @param transform - Configuration for how the media should be transformed
* @returns A generator for producing the transformed media output
*/
transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;
/**
* Generates the final media output with specified options.
* @param output - Configuration for the output format and parameters
* @returns The final transformation result containing the transformed media
*/
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
}
/**
* Generator for producing media transformation results.
* Configures the output format and parameters for the transformed media.
*/
interface MediaTransformationGenerator {
/**
* Generates the final media output with specified options.
* @param output - Configuration for the output format and parameters
* @returns The final transformation result containing the transformed media
*/
output(output?: MediaTransformationOutputOptions): MediaTransformationResult;
}
/**
* Result of a media transformation operation.
* Provides multiple ways to access the transformed media content.
*/
interface MediaTransformationResult {
/**
* Returns the transformed media as a readable stream of bytes.
* @returns A promise containing a readable stream with the transformed media
*/
media(): Promise<ReadableStream<Uint8Array>>;
/**
* Returns the transformed media as an HTTP response object.
* @returns The transformed media as a Promise<Response>, ready to store in cache or return to users
*/
response(): Promise<Response>;
/**
* Returns the MIME type of the transformed media.
* @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')
*/
contentType(): Promise<string>;
}
/**
* Configuration options for transforming media input.
* Controls how the media should be resized and fitted.
*/
type MediaTransformationInputOptions = {
/** How the media should be resized to fit the specified dimensions */
fit?: 'contain' | 'cover' | 'scale-down';
/** Target width in pixels */
width?: number;
/** Target height in pixels */
height?: number;
};
/**
* Configuration options for Media Transformations output.
* Controls the format, timing, and type of the generated output.
*/
type MediaTransformationOutputOptions = {
/**
* Output mode determining the type of media to generate
*/
mode?: 'video' | 'spritesheet' | 'frame' | 'audio';
/** Whether to include audio in the output */
audio?: boolean;
/**
* Starting timestamp for frame extraction or start time for clips. (e.g. '2s').
*/
time?: string;
/**
* Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').
*/
duration?: string;
/**
* Number of frames in the spritesheet.
*/
imageCount?: number;
/**
* Output format for the generated media.
*/
format?: 'jpg' | 'png' | 'm4a';
};
/**
* Error object for media transformation operations.
* Extends the standard Error interface with additional media-specific information.
*/
interface MediaError extends Error {
readonly code: number;
readonly message: string;
readonly stack?: string;
}
declare module 'cloudflare:node' {
interface NodeStyleServer {
listen(...args: unknown[]): this;
address(): {
port?: number | null | undefined;
};
}
export function httpServerHandler(port: number): ExportedHandler;
export function httpServerHandler(options: {
port: number;
}): ExportedHandler;
export function httpServerHandler(server: NodeStyleServer): ExportedHandler;
}
type Params<P extends string = any> = Record<P, string | string[]>;
type EventContext<Env, P extends string, Data> = {
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
@@ -4957,7 +10382,7 @@ declare module "cloudflare:pipelines" {
protected ctx: ExecutionContext;
constructor(ctx: ExecutionContext, env: Env);
/**
* run recieves an array of PipelineRecord which can be
* run receives an array of PipelineRecord which can be
* transformed and returned to the pipeline
* @param records Incoming records from the pipeline to be transformed
* @param metadata Information about the specific pipeline calling the transformation entrypoint
@@ -5123,15 +10548,54 @@ declare namespace Rpc {
// 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<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & {
[K in Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>]: MethodOrProperty<T[K]>;
};
export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{
[K in keyof T]: MethodOrProperty<T[K]>;
}, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>;
}
declare namespace Cloudflare {
// Type of `env`.
//
// The specific project can extend `Env` by redeclaring it in project-specific files. Typescript
// will merge all declarations.
//
// You can use `wrangler types` to generate the `Env` type automatically.
interface Env {
}
// Project-specific parameters used to inform types.
//
// This interface is, again, intended to be declared in project-specific files, and then that
// declaration will be merged with this one.
//
// A project should have a declaration like this:
//
// interface GlobalProps {
// // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type
// // of `ctx.exports`.
// mainModule: typeof import("my-main-module");
//
// // Declares which of the main module's exports are configured with durable storage, and
// // thus should behave as Durable Object namsepace bindings.
// durableNamespaces: "MyDurableObject" | "AnotherDurableObject";
// }
//
// You can use `wrangler types` to generate `GlobalProps` automatically.
interface GlobalProps {
}
// Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not
// present.
type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default;
// The type of the program's main module exports, if known. Requires `GlobalProps` to declare the
// `mainModule` property.
type MainModule = GlobalProp<"mainModule", {}>;
// The type of ctx.exports, which contains loopback bindings for all top-level exports.
type Exports = {
[K in keyof MainModule]: LoopbackForExport<MainModule[K]>
// If the export is listed in `durableNamespaces`, then it is also a
// DurableObjectNamespace.
& (K extends GlobalProp<"durableNamespaces", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {});
};
}
declare module 'cloudflare:workers' {
declare namespace CloudflareWorkersModule {
export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;
export const RpcStub: {
new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;
@@ -5140,25 +10604,27 @@ declare module 'cloudflare:workers' {
[Rpc.__RPC_TARGET_BRAND]: never;
}
// `protected` fields don't appear in `keyof`s, so can't be accessed over RPC
export abstract class WorkerEntrypoint<Env = unknown> implements Rpc.WorkerEntrypointBranded {
export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded {
[Rpc.__WORKER_ENTRYPOINT_BRAND]: never;
protected ctx: ExecutionContext;
protected ctx: ExecutionContext<Props>;
protected env: Env;
constructor(ctx: ExecutionContext, env: Env);
email?(message: ForwardableEmailMessage): void | Promise<void>;
fetch?(request: Request): Response | Promise<Response>;
tail?(events: TraceItem[]): void | Promise<void>;
trace?(traces: TraceItem[]): void | Promise<void>;
scheduled?(controller: ScheduledController): void | Promise<void>;
queue?(batch: MessageBatch<unknown>): void | Promise<void>;
scheduled?(controller: ScheduledController): void | Promise<void>;
tail?(events: TraceItem[]): void | Promise<void>;
tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
test?(controller: TestController): void | Promise<void>;
trace?(traces: TraceItem[]): void | Promise<void>;
}
export abstract class DurableObject<Env = unknown> implements Rpc.DurableObjectBranded {
export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {
[Rpc.__DURABLE_OBJECT_BRAND]: never;
protected ctx: DurableObjectState;
protected ctx: DurableObjectState<Props>;
protected env: Env;
constructor(ctx: DurableObjectState, env: Env);
fetch?(request: Request): Response | Promise<Response>;
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
fetch?(request: Request): Response | Promise<Response>;
webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;
webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
@@ -5167,6 +10633,7 @@ declare module 'cloudflare:workers' {
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?: {
@@ -5186,9 +10653,12 @@ declare module 'cloudflare:workers' {
timestamp: Date;
type: string;
};
export type WorkflowStepContext = {
attempt: number;
};
export abstract class WorkflowStep {
do<T extends Rpc.Serializable<T>>(name: string, callback: () => Promise<T>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: () => Promise<T>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {
@@ -5196,6 +10666,7 @@ declare module 'cloudflare:workers' {
timeout?: WorkflowTimeoutDuration | number;
}): Promise<WorkflowStepEvent<T>>;
}
export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown';
export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded {
[Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;
protected ctx: ExecutionContext;
@@ -5203,7 +10674,15 @@ declare module 'cloudflare:workers' {
constructor(ctx: ExecutionContext, env: Env);
run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
}
export function waitUntil(promise: Promise<unknown>): void;
export function withEnv(newEnv: unknown, fn: () => unknown): unknown;
export function withExports(newExports: unknown, fn: () => unknown): unknown;
export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown;
export const env: Cloudflare.Env;
export const exports: Cloudflare.Exports;
}
declare module 'cloudflare:workers' {
export = CloudflareWorkersModule;
}
interface SecretsStoreSecret {
/**
@@ -5216,6 +10695,808 @@ declare module "cloudflare:sockets" {
function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;
export { _connect as connect };
}
/**
* Binding entrypoint for Cloudflare Stream.
*
* Usage:
* - Binding-level operations:
* `await env.STREAM.videos.upload`
* `await env.STREAM.videos.createDirectUpload`
* `await env.STREAM.videos.*`
* `await env.STREAM.watermarks.*`
* - Per-video operations:
* `await env.STREAM.video(id).downloads.*`
* `await env.STREAM.video(id).captions.*`
*
* Example usage:
* ```ts
* await env.STREAM.video(id).downloads.generate();
*
* const video = env.STREAM.video(id)
* const captions = video.captions.list();
* const videoDetails = video.details()
* ```
*/
interface StreamBinding {
/**
* Returns a handle scoped to a single video for per-video operations.
* @param id The unique identifier for the video.
* @returns A handle for per-video operations.
*/
video(id: string): StreamVideoHandle;
/**
* Uploads a new video from a File.
* @param file The video file to upload.
* @returns The uploaded video details.
* @throws {BadRequestError} if the upload parameter is invalid
* @throws {QuotaReachedError} if the account storage capacity is exceeded
* @throws {MaxFileSizeError} if the file size is too large
* @throws {RateLimitedError} if the server received too many requests
* @throws {InternalError} if an unexpected error occurs
*/
upload(file: File): Promise<StreamVideo>;
/**
* Uploads a new video from a provided URL.
* @param url The URL to upload from.
* @param params Optional upload parameters.
* @returns The uploaded video details.
* @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid
* @throws {QuotaReachedError} if the account storage capacity is exceeded
* @throws {MaxFileSizeError} if the file size is too large
* @throws {RateLimitedError} if the server received too many requests
* @throws {AlreadyUploadedError} if a video was already uploaded to this URL
* @throws {InternalError} if an unexpected error occurs
*/
upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;
/**
* Creates a direct upload that allows video uploads without an API key.
* @param params Parameters for the direct upload
* @returns The direct upload details.
* @throws {BadRequestError} if the parameters are invalid
* @throws {RateLimitedError} if the server received too many requests
* @throws {InternalError} if an unexpected error occurs
*/
createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;
videos: StreamVideos;
watermarks: StreamWatermarks;
}
/**
* Handle for operations scoped to a single Stream video.
*/
interface StreamVideoHandle {
/**
* The unique identifier for the video.
*/
id: string;
/**
* Get a full videos details
* @returns The full video details.
* @throws {NotFoundError} if the video is not found
* @throws {InternalError} if an unexpected error occurs
*/
details(): Promise<StreamVideo>;
/**
* Update details for a single video.
* @param params The fields to update for the video.
* @returns The updated video details.
* @throws {NotFoundError} if the video is not found
* @throws {BadRequestError} if the parameters are invalid
* @throws {InternalError} if an unexpected error occurs
*/
update(params: StreamUpdateVideoParams): Promise<StreamVideo>;
/**
* Deletes a video and its copies from Cloudflare Stream.
* @returns A promise that resolves when deletion completes.
* @throws {NotFoundError} if the video is not found
* @throws {InternalError} if an unexpected error occurs
*/
delete(): Promise<void>;
/**
* Creates a signed URL token for a video.
* @returns The signed token that was created.
* @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed
*/
generateToken(): Promise<string>;
downloads: StreamScopedDownloads;
captions: StreamScopedCaptions;
}
interface StreamVideo {
/**
* The unique identifier for the video.
*/
id: string;
/**
* A user-defined identifier for the media creator.
*/
creator: string | null;
/**
* The thumbnail URL for the video.
*/
thumbnail: string;
/**
* The thumbnail timestamp percentage.
*/
thumbnailTimestampPct: number;
/**
* Indicates whether the video is ready to stream.
*/
readyToStream: boolean;
/**
* The date and time the video became ready to stream.
*/
readyToStreamAt: string | null;
/**
* Processing status information.
*/
status: StreamVideoStatus;
/**
* A user modifiable key-value store.
*/
meta: Record<string, string>;
/**
* The date and time the video was created.
*/
created: string;
/**
* The date and time the video was last modified.
*/
modified: string;
/**
* The date and time at which the video will be deleted.
*/
scheduledDeletion: string | null;
/**
* The size of the video in bytes.
*/
size: number;
/**
* The preview URL for the video.
*/
preview?: string;
/**
* Origins allowed to display the video.
*/
allowedOrigins: Array<string>;
/**
* Indicates whether signed URLs are required.
*/
requireSignedURLs: boolean | null;
/**
* The date and time the video was uploaded.
*/
uploaded: string | null;
/**
* The date and time when the upload URL expires.
*/
uploadExpiry: string | null;
/**
* The maximum size in bytes for direct uploads.
*/
maxSizeBytes: number | null;
/**
* The maximum duration in seconds for direct uploads.
*/
maxDurationSeconds: number | null;
/**
* The video duration in seconds. -1 indicates unknown.
*/
duration: number;
/**
* Input metadata for the original upload.
*/
input: StreamVideoInput;
/**
* Playback URLs for the video.
*/
hlsPlaybackUrl: string;
dashPlaybackUrl: string;
/**
* The watermark applied to the video, if any.
*/
watermark: StreamWatermark | null;
/**
* The live input id associated with the video, if any.
*/
liveInputId?: string | null;
/**
* The source video id if this is a clip.
*/
clippedFromId: string | null;
/**
* Public details associated with the video.
*/
publicDetails: StreamPublicDetails | null;
}
type StreamVideoStatus = {
/**
* The current processing state.
*/
state: string;
/**
* The current processing step.
*/
step?: string;
/**
* The percent complete as a string.
*/
pctComplete?: string;
/**
* An error reason code, if applicable.
*/
errorReasonCode: string;
/**
* An error reason text, if applicable.
*/
errorReasonText: string;
};
type StreamVideoInput = {
/**
* The input width in pixels.
*/
width: number;
/**
* The input height in pixels.
*/
height: number;
};
type StreamPublicDetails = {
/**
* The public title for the video.
*/
title: string | null;
/**
* The public share link.
*/
share_link: string | null;
/**
* The public channel link.
*/
channel_link: string | null;
/**
* The public logo URL.
*/
logo: string | null;
};
type StreamDirectUpload = {
/**
* The URL an unauthenticated upload can use for a single multipart request.
*/
uploadURL: string;
/**
* A Cloudflare-generated unique identifier for a media item.
*/
id: string;
/**
* The watermark profile applied to the upload.
*/
watermark: StreamWatermark | null;
/**
* The scheduled deletion time, if any.
*/
scheduledDeletion: string | null;
};
type StreamDirectUploadCreateParams = {
/**
* The maximum duration in seconds for a video upload.
*/
maxDurationSeconds: number;
/**
* The date and time after upload when videos will not be accepted.
*/
expiry?: string;
/**
* A user-defined identifier for the media creator.
*/
creator?: string;
/**
* A user modifiable key-value store used to reference other systems of record for
* managing videos.
*/
meta?: Record<string, string>;
/**
* Lists the origins allowed to display the video.
*/
allowedOrigins?: Array<string>;
/**
* Indicates whether the video can be accessed using the id. When set to `true`,
* a signed token must be generated with a signing key to view the video.
*/
requireSignedURLs?: boolean;
/**
* The thumbnail timestamp percentage.
*/
thumbnailTimestampPct?: number;
/**
* The date and time at which the video will be deleted. Include `null` to remove
* a scheduled deletion.
*/
scheduledDeletion?: string | null;
/**
* The watermark profile to apply.
*/
watermark?: StreamDirectUploadWatermark;
};
type StreamDirectUploadWatermark = {
/**
* The unique identifier for the watermark profile.
*/
id: string;
};
type StreamUrlUploadParams = {
/**
* Lists the origins allowed to display the video. Enter allowed origin
* domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
* video to be viewed on any origin.
*/
allowedOrigins?: Array<string>;
/**
* A user-defined identifier for the media creator.
*/
creator?: string;
/**
* A user modifiable key-value store used to reference other systems of
* record for managing videos.
*/
meta?: Record<string, string>;
/**
* Indicates whether the video can be a accessed using the id. When
* set to `true`, a signed token must be generated with a signing key to view the
* video.
*/
requireSignedURLs?: boolean;
/**
* Indicates the date and time at which the video will be deleted. Omit
* the field to indicate no change, or include with a `null` value to remove an
* existing scheduled deletion. If specified, must be at least 30 days from upload
* time.
*/
scheduledDeletion?: string | null;
/**
* The timestamp for a thumbnail image calculated as a percentage value
* of the video's duration. To convert from a second-wise timestamp to a
* percentage, divide the desired timestamp by the total duration of the video. If
* this value is not set, the default thumbnail image is taken from 0s of the
* video.
*/
thumbnailTimestampPct?: number;
/**
* The identifier for the watermark profile
*/
watermarkId?: string;
};
interface StreamScopedCaptions {
/**
* Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
* One caption or subtitle file per language is allowed.
* @param language The BCP 47 language tag for the caption or subtitle.
* @param file The caption or subtitle file to upload.
* @returns The created caption entry.
* @throws {NotFoundError} if the video is not found
* @throws {BadRequestError} if the language or file is invalid
* @throws {MaxFileSizeError} if the file size is too large
* @throws {InternalError} if an unexpected error occurs
*/
upload(language: string, file: File): Promise<StreamCaption>;
/**
* Generate captions or subtitles for the provided language via AI.
* @param language The BCP 47 language tag to generate.
* @returns The generated caption entry.
* @throws {NotFoundError} if the video is not found
* @throws {BadRequestError} if the language is invalid
* @throws {StreamError} if a generated caption already exists
* @throws {StreamError} if the video duration is too long
* @throws {StreamError} if the video is missing audio
* @throws {StreamError} if the requested language is not supported
* @throws {InternalError} if an unexpected error occurs
*/
generate(language: string): Promise<StreamCaption>;
/**
* Lists the captions or subtitles.
* Use the language parameter to filter by a specific language.
* @param language The optional BCP 47 language tag to filter by.
* @returns The list of captions or subtitles.
* @throws {NotFoundError} if the video or caption is not found
* @throws {InternalError} if an unexpected error occurs
*/
list(language?: string): Promise<StreamCaption[]>;
/**
* Removes the captions or subtitles from a video.
* @param language The BCP 47 language tag to remove.
* @returns A promise that resolves when deletion completes.
* @throws {NotFoundError} if the video or caption is not found
* @throws {InternalError} if an unexpected error occurs
*/
delete(language: string): Promise<void>;
}
interface StreamScopedDownloads {
/**
* Generates a download for a video when a video is ready to view. Available
* types are `default` and `audio`. Defaults to `default` when omitted.
* @param downloadType The download type to create.
* @returns The current downloads for the video.
* @throws {NotFoundError} if the video is not found
* @throws {BadRequestError} if the download type is invalid
* @throws {StreamError} if the video duration is too long to generate a download
* @throws {StreamError} if the video is not ready to stream
* @throws {InternalError} if an unexpected error occurs
*/
generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;
/**
* Lists the downloads created for a video.
* @returns The current downloads for the video.
* @throws {NotFoundError} if the video or downloads are not found
* @throws {InternalError} if an unexpected error occurs
*/
get(): Promise<StreamDownloadGetResponse>;
/**
* Delete the downloads for a video. Available types are `default` and `audio`.
* Defaults to `default` when omitted.
* @param downloadType The download type to delete.
* @returns A promise that resolves when deletion completes.
* @throws {NotFoundError} if the video or downloads are not found
* @throws {InternalError} if an unexpected error occurs
*/
delete(downloadType?: StreamDownloadType): Promise<void>;
}
interface StreamVideos {
/**
* Lists all videos in a users account.
* @returns The list of videos.
* @throws {BadRequestError} if the parameters are invalid
* @throws {InternalError} if an unexpected error occurs
*/
list(params?: StreamVideosListParams): Promise<StreamVideo[]>;
}
interface StreamWatermarks {
/**
* Generate a new watermark profile
* @param file The image file to upload
* @param params The watermark creation parameters.
* @returns The created watermark profile.
* @throws {BadRequestError} if the parameters are invalid
* @throws {InvalidURLError} if the URL is invalid
* @throws {MaxFileSizeError} if the file size is too large
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
* @throws {InternalError} if an unexpected error occurs
*/
generate(file: File, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;
/**
* Generate a new watermark profile
* @param url The image url to upload
* @param params The watermark creation parameters.
* @returns The created watermark profile.
* @throws {BadRequestError} if the parameters are invalid
* @throws {InvalidURLError} if the URL is invalid
* @throws {MaxFileSizeError} if the file size is too large
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
* @throws {InternalError} if an unexpected error occurs
*/
generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;
/**
* Lists all watermark profiles for an account.
* @returns The list of watermark profiles.
* @throws {InternalError} if an unexpected error occurs
*/
list(): Promise<StreamWatermark[]>;
/**
* Retrieves details for a single watermark profile.
* @param watermarkId The watermark profile identifier.
* @returns The watermark profile details.
* @throws {NotFoundError} if the watermark is not found
* @throws {InternalError} if an unexpected error occurs
*/
get(watermarkId: string): Promise<StreamWatermark>;
/**
* Deletes a watermark profile.
* @param watermarkId The watermark profile identifier.
* @returns A promise that resolves when deletion completes.
* @throws {NotFoundError} if the watermark is not found
* @throws {InternalError} if an unexpected error occurs
*/
delete(watermarkId: string): Promise<void>;
}
type StreamUpdateVideoParams = {
/**
* Lists the origins allowed to display the video. Enter allowed origin
* domains in an array and use `*` for wildcard subdomains. Empty arrays allow the
* video to be viewed on any origin.
*/
allowedOrigins?: Array<string>;
/**
* A user-defined identifier for the media creator.
*/
creator?: string;
/**
* The maximum duration in seconds for a video upload. Can be set for a
* video that is not yet uploaded to limit its duration. Uploads that exceed the
* specified duration will fail during processing. A value of `-1` means the value
* is unknown.
*/
maxDurationSeconds?: number;
/**
* A user modifiable key-value store used to reference other systems of
* record for managing videos.
*/
meta?: Record<string, string>;
/**
* Indicates whether the video can be a accessed using the id. When
* set to `true`, a signed token must be generated with a signing key to view the
* video.
*/
requireSignedURLs?: boolean;
/**
* Indicates the date and time at which the video will be deleted. Omit
* the field to indicate no change, or include with a `null` value to remove an
* existing scheduled deletion. If specified, must be at least 30 days from upload
* time.
*/
scheduledDeletion?: string | null;
/**
* The timestamp for a thumbnail image calculated as a percentage value
* of the video's duration. To convert from a second-wise timestamp to a
* percentage, divide the desired timestamp by the total duration of the video. If
* this value is not set, the default thumbnail image is taken from 0s of the
* video.
*/
thumbnailTimestampPct?: number;
};
type StreamCaption = {
/**
* Whether the caption was generated via AI.
*/
generated?: boolean;
/**
* The language label displayed in the native language to users.
*/
label: string;
/**
* The language tag in BCP 47 format.
*/
language: string;
/**
* The status of a generated caption.
*/
status?: 'ready' | 'inprogress' | 'error';
};
type StreamDownloadStatus = 'ready' | 'inprogress' | 'error';
type StreamDownloadType = 'default' | 'audio';
type StreamDownload = {
/**
* Indicates the progress as a percentage between 0 and 100.
*/
percentComplete: number;
/**
* The status of a generated download.
*/
status: StreamDownloadStatus;
/**
* The URL to access the generated download.
*/
url?: string;
};
/**
* An object with download type keys. Each key is optional and only present if that
* download type has been created.
*/
type StreamDownloadGetResponse = {
/**
* The audio-only download. Only present if this download type has been created.
*/
audio?: StreamDownload;
/**
* The default video download. Only present if this download type has been created.
*/
default?: StreamDownload;
};
type StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';
type StreamWatermark = {
/**
* The unique identifier for a watermark profile.
*/
id: string;
/**
* The size of the image in bytes.
*/
size: number;
/**
* The height of the image in pixels.
*/
height: number;
/**
* The width of the image in pixels.
*/
width: number;
/**
* The date and a time a watermark profile was created.
*/
created: string;
/**
* The source URL for a downloaded image. If the watermark profile was created via
* direct upload, this field is null.
*/
downloadedFrom: string | null;
/**
* A short description of the watermark profile.
*/
name: string;
/**
* The translucency of the image. A value of `0.0` makes the image completely
* transparent, and `1.0` makes the image completely opaque. Note that if the image
* is already semi-transparent, setting this to `1.0` will not make the image
* completely opaque.
*/
opacity: number;
/**
* The whitespace between the adjacent edges (determined by position) of the video
* and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded
* video width or length, as determined by the algorithm.
*/
padding: number;
/**
* The size of the image relative to the overall size of the video. This parameter
* will adapt to horizontal and vertical videos automatically. `0.0` indicates no
* scaling (use the size of the image as-is), and `1.0 `fills the entire video.
*/
scale: number;
/**
* The location of the image. Valid positions are: `upperRight`, `upperLeft`,
* `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the
* `padding` parameter.
*/
position: StreamWatermarkPosition;
};
type StreamWatermarkCreateParams = {
/**
* A short description of the watermark profile.
*/
name?: string;
/**
* The translucency of the image. A value of `0.0` makes the image completely
* transparent, and `1.0` makes the image completely opaque. Note that if the
* image is already semi-transparent, setting this to `1.0` will not make the
* image completely opaque.
*/
opacity?: number;
/**
* The whitespace between the adjacent edges (determined by position) of the
* video and the image. `0.0` indicates no padding, and `1.0` indicates a fully
* padded video width or length, as determined by the algorithm.
*/
padding?: number;
/**
* The size of the image relative to the overall size of the video. This
* parameter will adapt to horizontal and vertical videos automatically. `0.0`
* indicates no scaling (use the size of the image as-is), and `1.0 `fills the
* entire video.
*/
scale?: number;
/**
* The location of the image.
*/
position?: StreamWatermarkPosition;
};
type StreamVideosListParams = {
/**
* The maximum number of videos to return.
*/
limit?: number;
/**
* Return videos created before this timestamp.
* (RFC3339/RFC3339Nano)
*/
before?: string;
/**
* Comparison operator for the `before` field.
* @default 'lt'
*/
beforeComp?: StreamPaginationComparison;
/**
* Return videos created after this timestamp.
* (RFC3339/RFC3339Nano)
*/
after?: string;
/**
* Comparison operator for the `after` field.
* @default 'gte'
*/
afterComp?: StreamPaginationComparison;
};
type StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';
/**
* Error object for Stream binding operations.
*/
interface StreamError extends Error {
readonly code: number;
readonly statusCode: number;
readonly message: string;
readonly stack?: string;
}
interface InternalError extends StreamError {
name: 'InternalError';
}
interface BadRequestError extends StreamError {
name: 'BadRequestError';
}
interface NotFoundError extends StreamError {
name: 'NotFoundError';
}
interface ForbiddenError extends StreamError {
name: 'ForbiddenError';
}
interface RateLimitedError extends StreamError {
name: 'RateLimitedError';
}
interface QuotaReachedError extends StreamError {
name: 'QuotaReachedError';
}
interface MaxFileSizeError extends StreamError {
name: 'MaxFileSizeError';
}
interface InvalidURLError extends StreamError {
name: 'InvalidURLError';
}
interface AlreadyUploadedError extends StreamError {
name: 'AlreadyUploadedError';
}
interface TooManyWatermarksError extends StreamError {
name: 'TooManyWatermarksError';
}
type MarkdownDocument = {
name: string;
blob: Blob;
};
type ConversionResponse = {
id: string;
name: string;
mimeType: string;
format: 'markdown';
tokens: number;
data: string;
} | {
id: string;
name: string;
mimeType: string;
format: 'error';
error: string;
};
type ImageConversionOptions = {
descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de';
};
type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOptions = {
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
};
hostname?: string;
cssSelector?: string;
};
docx?: {
images?: EmbeddedImageConversionOptions;
};
image?: ImageConversionOptions;
pdf?: {
images?: EmbeddedImageConversionOptions;
metadata?: boolean;
};
};
type ConversionRequestOptions = {
gateway?: GatewayOptions;
extraHeaders?: object;
conversionOptions?: ConversionOptions;
};
type SupportedFileFormat = {
mimeType: string;
extension: string;
};
declare abstract class ToMarkdownService {
transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;
transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;
supported(): Promise<SupportedFileFormat[]>;
}
declare namespace TailStream {
interface Header {
readonly name: string;
@@ -5225,12 +11506,11 @@ declare namespace TailStream {
readonly type: "fetch";
readonly method: string;
readonly url: string;
readonly cfJson: string;
readonly cfJson?: object;
readonly headers: Header[];
}
interface JsRpcEventInfo {
readonly type: "jsrpc";
readonly methodName: string;
}
interface ScheduledEventInfo {
readonly type: "scheduled";
@@ -5271,10 +11551,6 @@ declare namespace TailStream {
readonly type: "hibernatableWebSocket";
readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage;
}
interface Resume {
readonly type: "resume";
readonly attachment?: any;
}
interface CustomEventInfo {
readonly type: "custom";
}
@@ -5288,20 +11564,18 @@ declare namespace TailStream {
readonly tag?: string;
readonly message?: string;
}
interface Trigger {
readonly traceId: string;
readonly invocationId: string;
readonly spanId: string;
}
interface Onset {
readonly type: "onset";
readonly attributes: Attribute[];
// id for the span being opened by this Onset event.
readonly spanId: string;
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 info: FetchEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo;
}
interface Outcome {
readonly type: "outcome";
@@ -5309,13 +11583,12 @@ declare namespace TailStream {
readonly cpuTime: number;
readonly wallTime: number;
}
interface Hibernate {
readonly type: "hibernate";
}
interface SpanOpen {
readonly type: "spanOpen";
readonly op?: string;
readonly info?: FetchEventInfo | JsRpcEventInfo | Attribute[];
readonly name: string;
// id for the span being opened by this SpanOpen event.
readonly spanId: string;
readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
}
interface SpanClose {
readonly type: "spanClose";
@@ -5335,36 +11608,71 @@ declare namespace TailStream {
interface Log {
readonly type: "log";
readonly level: "debug" | "error" | "info" | "log" | "warn";
readonly message: string;
readonly message: object;
}
interface DroppedEventsDiagnostic {
readonly diagnosticsType: "droppedEvents";
readonly count: number;
}
interface StreamDiagnostic {
readonly type: 'streamDiagnostic';
// To add new diagnostic types, define a new interface and add it to this union type.
readonly diagnostic: DroppedEventsDiagnostic;
}
// This marks the worker handler return information.
// This is separate from Outcome because the worker invocation can live for a long time after
// returning. For example - Websockets that return an http upgrade response but then continue
// streaming information or SSE http connections.
interface Return {
readonly type: "return";
readonly info?: FetchResponseInfo | Attribute[];
}
interface Link {
readonly type: "link";
readonly label?: string;
readonly traceId: string;
readonly invocationId: string;
readonly spanId: string;
readonly info?: FetchResponseInfo;
}
interface Attribute {
readonly type: "attribute";
readonly name: string;
readonly value: string | string[] | boolean | boolean[] | number | number[];
readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[];
}
type Mark = DiagnosticChannelEvent | Exception | Log | Return | Link | Attribute[];
interface TailEvent {
interface Attributes {
readonly type: "attributes";
readonly info: Attribute[];
}
type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;
// Context in which this trace event lives.
interface SpanContext {
// Single id for the entire top-level invocation
// This should be a new traceId for the first worker stage invoked in the eyeball request and then
// same-account service-bindings should reuse the same traceId but cross-account service-bindings
// should use a new traceId.
readonly traceId: string;
// spanId in which this event is handled
// for Onset and SpanOpen events this would be the parent span id
// for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
// For Hibernate and Mark this would be the span under which they were emitted.
// spanId is not set ONLY if:
// 1. This is an Onset event
// 2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
readonly spanId?: string;
}
interface TailEvent<Event extends EventType> {
// invocation id of the currently invoked worker stage.
// invocation id will always be unique to every Onset event and will be the same until the Outcome event.
readonly invocationId: string;
readonly spanId: string;
// Inherited spanContext for this event.
readonly spanContext: SpanContext;
readonly timestamp: Date;
readonly sequence: number;
readonly event: Onset | Outcome | Hibernate | SpanOpen | SpanClose | Mark;
readonly event: Event;
}
type TailEventHandler = (event: TailEvent) => void | Promise<void>;
type TailEventHandlerName = "onset" | "outcome" | "hibernate" | "spanOpen" | "spanClose" | "diagnosticChannel" | "exception" | "log" | "return" | "link" | "attribute";
type TailEventHandlerObject = Record<TailEventHandlerName, TailEventHandler>;
type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>;
type TailEventHandlerObject = {
outcome?: TailEventHandler<Outcome>;
spanOpen?: TailEventHandler<SpanOpen>;
spanClose?: TailEventHandler<SpanClose>;
diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;
exception?: TailEventHandler<Exception>;
log?: TailEventHandler<Log>;
return?: TailEventHandler<Return>;
attributes?: TailEventHandler<Attributes>;
};
type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
}
// Copyright (c) 2022-2023 Cloudflare, Inc.
@@ -5388,13 +11696,16 @@ interface VectorizeError {
*
* This list is expected to grow as support for more operations are released.
*/
type VectorizeVectorMetadataFilterOp = "$eq" | "$ne";
type VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte';
type VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin';
/**
* Filter criteria for vector metadata used to limit the retrieved query result set.
*/
type VectorizeVectorMetadataFilter = {
[field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | {
[Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null;
} | {
[Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[];
};
};
/**
@@ -5677,6 +11988,9 @@ declare abstract class Workflow<PARAMS = unknown> {
*/
public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;
}
type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
type WorkflowRetentionDuration = WorkflowSleepDuration;
interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
/**
* An id for your Workflow instance. Must be unique within the Workflow.
@@ -5686,6 +12000,14 @@ interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
* The event payload the Workflow instance is triggered with
*/
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;
};
}
type InstanceStatus = {
status: 'queued' // means that instance is waiting to be started (see concurrency limits)
@@ -5693,8 +12015,11 @@ type InstanceStatus = {
| '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;
error?: {
name: string;
message: string;
};
output?: unknown;
};
interface WorkflowError {
code?: number;