diff --git a/demos/remote-mcp-server-descope-auth/README.md b/demos/remote-mcp-server-descope-auth/README.md
index 98655a27c3..7e63be616a 100644
--- a/demos/remote-mcp-server-descope-auth/README.md
+++ b/demos/remote-mcp-server-descope-auth/README.md
@@ -80,7 +80,6 @@ To explore your new MCP api, you can use the [MCP Inspector](https://modelcontex
-
## Deploy to Cloudflare
1. Create a KV namespace for production:
@@ -120,11 +119,16 @@ Then, using the `Streamable HTTP` transport, enter the `workers.dev` URL (ex: `h
You've now connected to your MCP server from a remote MCP client. Authentication runs through the Descope OAuth flow โ no manual bearer token needed.
+## Architecture
+
+This server uses the **stateless MCP handler** from the [MCP SDK v2](https://developers.cloudflare.com/agents/model-context-protocol/guides/migrate-to-mcp-sdk-v2/) (protocol revision `2026-07-28`). Instead of the old stateful `McpAgent` Durable Object, requests are served by [`createMcpHandler`](https://developers.cloudflare.com/agents/model-context-protocol/mcp-handler-api/) from `agents/mcp/server` โ so there is no Durable Object binding or migration to configure.
+
## Features
The MCP server implementation includes:
+- โก Stateless MCP SDK v2 handler (no Durable Object required)
- ๐ OAuth 2.0/2.1 Authorization Server Metadata (RFC 8414)
- ๐ Dynamic Client Registration (RFC 7591)
- ๐ PKCE Support
diff --git a/demos/remote-mcp-server-descope-auth/package.json b/demos/remote-mcp-server-descope-auth/package.json
index e8e66823a5..9cc5532836 100644
--- a/demos/remote-mcp-server-descope-auth/package.json
+++ b/demos/remote-mcp-server-descope-auth/package.json
@@ -8,11 +8,14 @@
"format": "oxfmt --write .",
"lint:fix": "oxlint --fix",
"start": "wrangler dev",
- "cf-typegen": "wrangler types"
+ "cf-typegen": "wrangler types",
+ "type-check": "tsc --noEmit"
},
"dependencies": {
"@cloudflare/workers-oauth-provider": "^0.8.1",
- "agents": "^0.17.1",
+ "@modelcontextprotocol/sdk": "1.30.0",
+ "@modelcontextprotocol/server": "2.0.0",
+ "agents": "^0.20.1",
"hono": "^4.12.27",
"zod": "^4.4.3"
},
diff --git a/demos/remote-mcp-server-descope-auth/src/descope-utils.ts b/demos/remote-mcp-server-descope-auth/src/descope-utils.ts
index b7165ebb98..fcf2750b12 100644
--- a/demos/remote-mcp-server-descope-auth/src/descope-utils.ts
+++ b/demos/remote-mcp-server-descope-auth/src/descope-utils.ts
@@ -77,7 +77,7 @@ export async function fetchDescopeAuthToken({
return [null, new Response("Failed to fetch access token", { status: 500 })];
}
- const body = await resp.json();
+ const body = (await resp.json()) as { access_token?: string };
const accessToken = body.access_token as string;
if (!accessToken) {
return [null, new Response("Missing access token", { status: 400 })];
diff --git a/demos/remote-mcp-server-descope-auth/src/env.d.ts b/demos/remote-mcp-server-descope-auth/src/env.d.ts
new file mode 100644
index 0000000000..bd3edaab53
--- /dev/null
+++ b/demos/remote-mcp-server-descope-auth/src/env.d.ts
@@ -0,0 +1,14 @@
+interface Env {
+ DESCOPE_CLIENT_ID: string;
+ DESCOPE_CLIENT_SECRET: string;
+ COOKIE_ENCRYPTION_KEY: string;
+}
+
+
+declare namespace Cloudflare {
+ interface Env {
+ DESCOPE_CLIENT_ID: string;
+ DESCOPE_CLIENT_SECRET: string;
+ COOKIE_ENCRYPTION_KEY: string;
+ }
+}
diff --git a/demos/remote-mcp-server-descope-auth/src/index.ts b/demos/remote-mcp-server-descope-auth/src/index.ts
index d3512071fe..959a9cadd5 100644
--- a/demos/remote-mcp-server-descope-auth/src/index.ts
+++ b/demos/remote-mcp-server-descope-auth/src/index.ts
@@ -1,72 +1,91 @@
import OAuthProvider from "@cloudflare/workers-oauth-provider";
-import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
-import { McpAgent } from "agents/mcp";
+import { McpServer } from "@modelcontextprotocol/server";
+import { createMcpHandler, getMcpAuthContext } from "agents/mcp/server";
import { z } from "zod";
import { DescopeHandler } from "./descope-handler";
+import type { Props } from "./descope-utils";
-// Context from the auth process, encrypted & stored in the auth token
-// and provided to the DurableMCP as this.props
-type Props = {
- sub: string;
- name: string;
- email: string;
- accessToken: string;
-};
+function requireProps(): Props {
+ const props = getMcpAuthContext()?.props as Props | undefined;
+ if (!props) {
+ throw new Error("Missing authenticated Descope context");
+ }
+ return props;
+}
-export class MyMCP extends McpAgent, Props> {
- server = new McpServer({
+
+function createServer() {
+ const server = new McpServer({
name: "Descope OAuth Proxy Demo",
version: "1.0.0",
});
- async init() {
- // Hello, world!
- this.server.tool(
- "add",
- "Add two numbers the way only MCP can",
- { a: z.number(), b: z.number() },
- async ({ a, b }) => ({
- content: [{ text: String(a + b), type: "text" }],
- }),
- );
- // Use the upstream access token to access user info
- this.server.tool(
- "getUserInfo",
- "Get authenticated user info from Descope",
- {},
- async () => {
- return {
- content: [
- {
- text: JSON.stringify({
- email: this.props!.email,
- name: this.props!.name,
- sub: this.props!.sub,
- }),
- type: "text",
- },
- ],
- };
- },
- );
+ server.registerTool(
+ "add",
+ {
+ description: "Add two numbers the way only MCP can",
+ inputSchema: z.object({ a: z.number(), b: z.number() }),
+ },
+ async ({ a, b }) => ({
+ content: [{ type: "text", text: String(a + b) }],
+ }),
+ );
- // Return the access token
- this.server.tool("getToken", "Get the Descope access token", {}, async () => ({
- content: [
- {
- text: String(`User's token: ${this.props!.accessToken}`),
- type: "text",
- },
- ],
- }));
- }
+ // Use the authenticated context to return user info
+ server.registerTool(
+ "getUserInfo",
+ {
+ description: "Get authenticated user info from Descope",
+ inputSchema: z.object({}),
+ },
+ async () => {
+ const props = requireProps();
+ return {
+ content: [
+ {
+ type: "text",
+ text: JSON.stringify({
+ email: props.email,
+ name: props.name,
+ sub: props.sub,
+ }),
+ },
+ ],
+ };
+ },
+ );
+
+ // Return the access token
+ server.registerTool(
+ "getToken",
+ {
+ description: "Get the Descope access token",
+ inputSchema: z.object({}),
+ },
+ async () => {
+ const props = requireProps();
+ return {
+ content: [{ type: "text", text: `User's token: ${props.accessToken}` }],
+ };
+ },
+ );
+
+ return server;
}
+const mcpHandler = createMcpHandler(createServer);
+
export default new OAuthProvider({
- apiHandler: MyMCP.serve("/mcp"),
+ // OAuthProvider verifies the bearer token and populates the request
+ // context with the decrypted props before delegating to the MCP handler.
+ apiHandler: {
+ fetch: (request: Request, env: unknown, ctx: ExecutionContext) =>
+ mcpHandler(request, env, ctx),
+ },
apiRoute: "/mcp",
authorizeEndpoint: "/authorize",
+ clientIdMetadataDocumentEnabled: true,
clientRegistrationEndpoint: "/register",
defaultHandler: DescopeHandler as any,
tokenEndpoint: "/token",
diff --git a/demos/remote-mcp-server-descope-auth/worker-configuration.d.ts b/demos/remote-mcp-server-descope-auth/worker-configuration.d.ts
index 5920efa300..aceab38347 100644
--- a/demos/remote-mcp-server-descope-auth/worker-configuration.d.ts
+++ b/demos/remote-mcp-server-descope-auth/worker-configuration.d.ts
@@ -1,16 +1,17 @@
-// Generated by Wrangler by running `wrangler types` (hash: bc1f6c3ad4ff6888d59f85f32b5649c9)
-// Runtime types generated with workerd@1.20250409.0 2025-03-10
+/* eslint-disable */
+// Generated by Wrangler by running `wrangler types` (hash: a84a58adebc0817fc5210ef4e6aca4c4)
+// Runtime types generated with workerd@1.20260625.1 2026-07-02 nodejs_compat
+interface __BaseEnv_Env {
+ OAUTH_KV: KVNamespace;
+ ASSETS: Fetcher;
+}
declare namespace Cloudflare {
- interface Env {
- OAUTH_KV: KVNamespace;
- DESCOPE_CLIENT_ID: string;
- DESCOPE_CLIENT_SECRET: string;
- COOKIE_ENCRYPTION_KEY: string;
- MCP_OBJECT: DurableObjectNamespace;
- OAUTH_PROVIDER: import("@cloudflare/workers-oauth-provider").OAuthHelpers;
+ interface GlobalProps {
+ mainModule: typeof import("./src/index");
}
+ interface Env extends __BaseEnv_Env {}
}
-interface Env extends Cloudflare.Env {}
+interface Env extends __BaseEnv_Env {}
// Begin runtime types
/*! *****************************************************************************
@@ -31,17 +32,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)
@@ -85,45 +95,121 @@ type WorkerGlobalScopeEventMap = {
declare abstract class WorkerGlobalScope extends EventTarget {
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;
@@ -208,7 +294,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)
@@ -262,6 +348,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;
@@ -311,7 +399,7 @@ declare function removeEventListener 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(
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(
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(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,
@@ -381,102 +469,116 @@ declare const Cloudflare: Cloudflare;
declare const origin: string;
declare const navigator: Navigator;
interface TestController {}
-interface ExecutionContext {
+interface ExecutionContext {
waitUntil(promise: Promise): void;
passThroughOnException(): void;
- props: any;
+ readonly exports: Cloudflare.Exports;
+ readonly props: Props;
+ cache?: CacheContext;
+ readonly access?: CloudflareAccessContext;
+ tracing: Tracing;
}
-type ExportedHandlerFetchHandler = (
+type ExportedHandlerFetchHandler = (
request: Request>,
env: Env,
- ctx: ExecutionContext,
+ ctx: ExecutionContext,
) => Response | Promise;
-type ExportedHandlerTailHandler = (
+type ExportedHandlerConnectHandler = (
+ socket: Socket,
+ env: Env,
+ ctx: ExecutionContext,
+) => void | Promise;
+type ExportedHandlerTailHandler = (
events: TraceItem[],
env: Env,
- ctx: ExecutionContext,
+ ctx: ExecutionContext,
) => void | Promise;
-type ExportedHandlerTraceHandler = (
+type ExportedHandlerTraceHandler = (
traces: TraceItem[],
env: Env,
- ctx: ExecutionContext,
+ ctx: ExecutionContext,
) => void | Promise;
-type ExportedHandlerTailStreamHandler = (
- event: TailStream.TailEvent,
+type ExportedHandlerTailStreamHandler = (
+ event: TailStream.TailEvent,
env: Env,
- ctx: ExecutionContext,
+ ctx: ExecutionContext,
) => TailStream.TailEventHandlerType | Promise;
-type ExportedHandlerScheduledHandler = (
+type ExportedHandlerScheduledHandler = (
controller: ScheduledController,
env: Env,
- ctx: ExecutionContext,
+ ctx: ExecutionContext,
) => void | Promise;
-type ExportedHandlerQueueHandler = (
+type ExportedHandlerQueueHandler = (
batch: MessageBatch,
env: Env,
- ctx: ExecutionContext,
+ ctx: ExecutionContext,
) => void | Promise;
-type ExportedHandlerTestHandler = (
+type ExportedHandlerTestHandler = (
controller: TestController,
env: Env,
- ctx: ExecutionContext,
+ ctx: ExecutionContext,
) => void | Promise;
-interface ExportedHandler {
- fetch?: ExportedHandlerFetchHandler;
- tail?: ExportedHandlerTailHandler;
- trace?: ExportedHandlerTraceHandler;
- tailStream?: ExportedHandlerTailStreamHandler;
- scheduled?: ExportedHandlerScheduledHandler;
- test?: ExportedHandlerTestHandler;
- email?: EmailExportedHandler;
- queue?: ExportedHandlerQueueHandler;
+interface ExportedHandler<
+ Env = unknown,
+ QueueHandlerMessage = unknown,
+ CfHostMetadata = unknown,
+ Props = unknown,
+> {
+ fetch?: ExportedHandlerFetchHandler;
+ connect?: ExportedHandlerConnectHandler;
+ tail?: ExportedHandlerTailHandler;
+ trace?: ExportedHandlerTraceHandler;
+ tailStream?: ExportedHandlerTailStreamHandler;
+ scheduled?: ExportedHandlerScheduledHandler;
+ test?: ExportedHandlerTestHandler;
+ email?: EmailExportedHandler;
+ queue?: ExportedHandlerQueueHandler;
}
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;
- /* [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 platform: string;
+ readonly language: string;
+ readonly languages: string[];
}
interface AlarmInvocationInfo {
readonly isRetry: boolean;
readonly retryCount: number;
+ readonly scheduledTime: number;
}
interface Cloudflare {
readonly compatibilityFlags: Record;
}
+interface CachePurgeError {
+ code: number;
+ message: string;
+}
+interface CachePurgeResult {
+ success: boolean;
+ errors: CachePurgeError[];
+}
+interface CachePurgeOptions {
+ tags?: string[];
+ pathPrefixes?: string[];
+ purgeEverything?: boolean;
+}
+interface CacheContext {
+ purge(options: CachePurgeOptions): Promise;
+}
+interface CloudflareAccessContext {
+ readonly aud: string;
+ getIdentity(): Promise;
+}
+declare abstract class ColoLocalActorNamespace {
+ get(actorId: string): Fetcher;
+}
interface DurableObject {
fetch(request: Request): Response | Promise;
+ connect?(socket: Socket): void | Promise;
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise;
webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise;
webSocketClose?(
@@ -489,7 +591,7 @@ interface DurableObject {
}
type DurableObjectStub = Fetcher<
T,
- "alarm" | "webSocketMessage" | "webSocketClose" | "webSocketError"
+ "alarm" | "connect" | "webSocketMessage" | "webSocketClose" | "webSocketError"
> & {
readonly id: DurableObjectId;
readonly name?: string;
@@ -498,8 +600,11 @@ interface DurableObjectId {
toString(): string;
equals(other: DurableObjectId): boolean;
readonly name?: string;
+ readonly jurisdiction?: string;
}
-interface DurableObjectNamespace {
+declare abstract class DurableObjectNamespace<
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
+> {
newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
idFromName(name: string): DurableObjectId;
idFromString(id: string): DurableObjectId;
@@ -507,9 +612,13 @@ interface DurableObjectNamespace;
+ getByName(
+ name: string,
+ options?: DurableObjectNamespaceGetDurableObjectOptions,
+ ): DurableObjectStub;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
}
-type DurableObjectJurisdiction = "eu" | "fedramp";
+type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -520,17 +629,25 @@ type DurableObjectLocationHint =
| "weur"
| "eeur"
| "apac"
+ | "apac-ne"
+ | "apac-se"
| "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 {
waitUntil(promise: Promise): void;
+ readonly exports: Cloudflare.Exports;
+ readonly props: Props;
readonly id: DurableObjectId;
readonly storage: DurableObjectStorage;
container?: Container;
+ facets: DurableObjectFacets;
blockConcurrencyWhile(callback: () => Promise): Promise;
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
getWebSockets(tag?: string): WebSocket[];
@@ -570,6 +687,7 @@ interface DurableObjectStorage {
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise;
sync(): Promise;
sql: SqlStorage;
+ kv: SyncKvStorage;
transactionSync(closure: () => T): T;
getCurrentBookmark(): Promise;
getBookmarkForTime(timestamp: number | Date): Promise;
@@ -606,6 +724,19 @@ declare class WebSocketRequestResponsePair {
get request(): string;
get response(): string;
}
+interface DurableObjectFacets {
+ get(
+ name: string,
+ getStartupOptions: () => FacetStartupOptions | Promise>,
+ ): Fetcher;
+ abort(name: string, reason: any): void;
+ delete(name: string): void;
+ clone(src: string, dst: string): void;
+}
+interface FacetStartupOptions {
+ id?: DurableObjectId | string;
+ class: DurableObjectClass;
+}
interface AnalyticsEngineDataset {
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
}
@@ -615,116 +746,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)
*/
@@ -747,26 +882,14 @@ type EventListenerOrEventListenerObject =
| EventListener
| EventListenerObject;
/**
- * 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 = Record> {
constructor();
/**
- * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
- *
- * 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)
*/
@@ -776,7 +899,7 @@ declare class EventTarget = Record = Record 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 {
@@ -858,19 +1001,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): 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 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)
*/
@@ -883,31 +1034,60 @@ 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) */
+ constructor(bits?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);
+ /**
+ * 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;
+ /**
+ * 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;
- /* [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;
- /* [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)
*/
@@ -917,9 +1097,17 @@ declare class File extends Blob {
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 {
@@ -932,7 +1120,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;
readonly default: Cache;
}
@@ -962,12 +1154,17 @@ 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
@@ -980,6 +1177,7 @@ declare abstract class Crypto {
| 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)
@@ -988,49 +1186,77 @@ 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;
- /* [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;
- /* [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;
- /* [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;
- /* [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;
- /* [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;
- /* [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,
@@ -1038,13 +1264,21 @@ declare abstract class SubtleCrypto {
extractable: boolean,
keyUsages: string[],
): Promise;
- /* [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;
- /* [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,
@@ -1052,16 +1286,28 @@ declare abstract class SubtleCrypto {
extractable: boolean,
keyUsages: string[],
): Promise;
- /* [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;
- /* [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;
- /* [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,
@@ -1074,17 +1320,29 @@ declare abstract class SubtleCrypto {
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
@@ -1092,7 +1350,11 @@ declare abstract class CryptoKey {
| 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 {
@@ -1199,24 +1461,14 @@ declare class DigestStream extends WritableStream
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)
*/
@@ -1226,24 +1478,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 {
@@ -1258,16 +1510,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 {
@@ -1278,45 +1555,149 @@ 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/FormData)
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
*/
-declare class FormData {
- constructor();
- /* [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) */
- append(name: string, value: Blob, filename?: string): void;
- /* [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) */
- get(name: string): (File | string) | null;
- /* [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) */
- has(name: string): boolean;
- /* [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) */
- set(name: string, value: Blob, filename?: string): void;
- /* Returns an array of key, value pairs for every entry in the list. */
- entries(): IterableIterator<[key: string, value: File | string]>;
- /* Returns a list of keys in the list. */
- keys(): IterableIterator;
- /* Returns a list of values in the list. */
- values(): IterableIterator;
- forEach(
- callback: (this: This, value: File | string, key: string, parent: FormData) => void,
- thisArg?: This,
- ): void;
- [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
-}
-interface ContentOptions {
- html?: boolean;
-}
-declare class HTMLRewriter {
- constructor();
+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;
+ /**
+ * 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();
+ /**
+ * 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;
+ /**
+ * 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;
+ /**
+ * 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;
+ /**
+ * 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;
+ /**
+ * 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)[];
+ /**
+ * 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;
+ /**
+ * 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;
+ /**
+ * 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<[key: string, value: File | string]>;
+ /* Returns a list of keys in the list. */
+ keys(): IterableIterator;
+ /* Returns a list of values in the list. */
+ values(): IterableIterator;
+ forEach(
+ callback: (this: This, value: File | string, key: string, parent: FormData) => void,
+ thisArg?: This,
+ ): void;
+ [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
+}
+interface ContentOptions {
+ html?: boolean;
+}
+declare class HTMLRewriter {
+ constructor();
on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;
onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;
transform(response: Response): Response;
@@ -1383,37 +1764,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): void;
passThroughOnException(): void;
}
type HeadersInit = Headers | Iterable> | Record;
/**
- * This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consistsย of zero or more name and value pairs. ย You can add to this using methods like append() (see Examples.)ย In all methods of this interface, header names are matched by case-insensitive byte sequence.
+ * 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(
callback: (this: This, value: string, key: string, parent: Headers) => void,
@@ -1434,7 +1847,9 @@ type BodyInit =
| ArrayBufferView
| Blob
| URLSearchParams
- | FormData;
+ | FormData
+ | Iterable
+ | AsyncIterable;
declare abstract class Body {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
get body(): ReadableStream | null;
@@ -1442,6 +1857,7 @@ declare abstract class Body {
get bodyUsed(): boolean;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
arrayBuffer(): Promise;
+ /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */
bytes(): Promise;
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */
text(): Promise;
@@ -1453,7 +1869,7 @@ declare abstract class Body {
blob(): Promise;
}
/**
- * 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)
*/
@@ -1465,28 +1881,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 {
@@ -1501,7 +1949,7 @@ type RequestInfo> =
| Request
| 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)
*/
@@ -1513,59 +1961,67 @@ declare var Request: {
): Request;
};
/**
- * 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> 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;
/**
- * 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 {
/* A string to set request's method. */
@@ -1579,14 +2035,26 @@ interface RequestInit {
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 = Fetcher;
+type Service<
+ T extends
+ | (new (...args: any[]) => Rpc.WorkerEntrypointBranded)
+ | Rpc.WorkerEntrypointBranded
+ | ExportedHandler
+ | undefined = undefined,
+> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
+ ? Fetcher>
+ : T extends Rpc.WorkerEntrypointBranded
+ ? Fetcher
+ : T extends Exclude
+ ? never
+ : Fetcher;
type Fetcher<
T extends Rpc.EntrypointBranded | undefined = undefined,
Reserved extends string = never,
@@ -1730,11 +2198,34 @@ interface KVNamespaceGetWithMetadataResult {
}
type QueueContentType = "text" | "bytes" | "json" | "v8";
interface Queue {
- send(message: Body, options?: QueueSendOptions): Promise;
+ metrics(): Promise;
+ send(message: Body, options?: QueueSendOptions): Promise;
sendBatch(
messages: Iterable>,
options?: QueueSendBatchOptions,
- ): Promise;
+ ): Promise;
+}
+interface QueueSendMetrics {
+ backlogCount: number;
+ backlogBytes: number;
+ oldestMessageTimestamp?: Date;
+}
+interface QueueSendMetadata {
+ metrics: QueueSendMetrics;
+}
+interface QueueSendResponse {
+ metadata: QueueSendMetadata;
+}
+interface QueueSendBatchMetrics {
+ backlogCount: number;
+ backlogBytes: number;
+ oldestMessageTimestamp?: Date;
+}
+interface QueueSendBatchMetadata {
+ metrics: QueueSendBatchMetrics;
+}
+interface QueueSendBatchResponse {
+ metadata: QueueSendBatchMetadata;
}
interface QueueSendOptions {
contentType?: QueueContentType;
@@ -1748,6 +2239,19 @@ interface MessageSendRequest {
contentType?: QueueContentType;
delaySeconds?: number;
}
+interface QueueMetrics {
+ backlogCount: number;
+ backlogBytes: number;
+ oldestMessageTimestamp?: Date;
+}
+interface MessageBatchMetrics {
+ backlogCount: number;
+ backlogBytes: number;
+ oldestMessageTimestamp?: Date;
+}
+interface MessageBatchMetadata {
+ metrics: MessageBatchMetrics;
+}
interface QueueRetryOptions {
delaySeconds?: number;
}
@@ -1762,12 +2266,14 @@ interface Message {
interface QueueEvent extends ExtendableEvent {
readonly messages: readonly Message[];
readonly queue: string;
+ readonly metadata: MessageBatchMetadata;
retryAll(options?: QueueRetryOptions): void;
ackAll(): void;
}
interface MessageBatch {
readonly messages: readonly Message[];
readonly queue: string;
+ readonly metadata: MessageBatchMetadata;
retryAll(options?: QueueRetryOptions): void;
ackAll(): void;
}
@@ -1786,7 +2292,7 @@ interface R2ListOptions {
startAfter?: string;
include?: ("httpMetadata" | "customMetadata")[];
}
-declare abstract class R2Bucket {
+interface R2Bucket {
head(key: string): Promise;
get(
key: string,
@@ -1846,6 +2352,7 @@ interface R2ObjectBody extends R2Object {
get body(): ReadableStream;
get bodyUsed(): boolean;
arrayBuffer(): Promise;
+ bytes(): Promise;
text(): Promise;
json(): Promise;
blob(): Promise;
@@ -1878,11 +2385,11 @@ interface R2PutOptions {
onlyIf?: R2Conditional | Headers;
httpMetadata?: R2HTTPMetadata | Headers;
customMetadata?: Record;
- md5?: ArrayBuffer | string;
- sha1?: ArrayBuffer | string;
- sha256?: ArrayBuffer | string;
- sha384?: ArrayBuffer | string;
- sha512?: ArrayBuffer | string;
+ md5?: (ArrayBuffer | ArrayBufferView) | string;
+ sha1?: (ArrayBuffer | ArrayBufferView) | string;
+ sha256?: (ArrayBuffer | ArrayBufferView) | string;
+ sha384?: (ArrayBuffer | ArrayBufferView) | string;
+ sha512?: (ArrayBuffer | ArrayBufferView) | string;
storageClass?: string;
ssecKey?: ArrayBuffer | string;
}
@@ -1975,6 +2482,8 @@ interface Transformer {
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.
*
@@ -1993,8 +2502,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 =
@@ -2007,33 +2514,61 @@ type ReadableStreamReadResult =
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 {
- /* [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;
- /* [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;
- /* [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(
transform: ReadableWritablePair,
options?: StreamPipeOptions,
): ReadableStream;
- /* [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, options?: StreamPipeOptions): Promise;
- /* [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, ReadableStream];
values(options?: ReadableStreamValuesOptions): AsyncIterableIterator;
[Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator;
}
/**
- * This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
+ * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2048,24 +2583,48 @@ declare const ReadableStream: {
strategy?: QueuingStrategy,
): ReadableStream;
};
-/* [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 {
constructor(stream: ReadableStream);
get closed(): Promise;
cancel(reason?: any): Promise;
- /* [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>;
- /* [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;
cancel(reason?: any): Promise;
- /* [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(view: T): Promise>;
- /* [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(
minElements: number,
@@ -2083,119 +2642,263 @@ 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 {
- /* [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) */
+ /**
+ * 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;
}
-/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) */
+/**
+ * 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 {
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */
+ /**
+ * 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;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize) */
+ /**
+ * 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;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close) */
+ /**
+ * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.
+ *
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)
+ */
close(): void;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */
+ /**
+ * 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;
- /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error) */
+ /**
+ * 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;
}
/**
- * 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 **`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 {
- /* [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 {
+ readable: ReadableStream;
/**
* 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;
- readable: ReadableStream;
}
/**
- * This Streams API interface providesย a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.
+ * 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 {
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;
- /* [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;
- /* [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;
}
/**
- * 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 {
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;
- /* [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;
- /* [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;
- /* [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;
- /* [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;
- /* [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 {
constructor(
transformer?: Transformer,
writableStrategy?: QueuingStrategy,
readableStrategy?: QueuingStrategy,
);
- /* [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;
- /* [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;
}
declare class FixedLengthStream extends IdentityTransformStream {
@@ -2216,23 +2919,39 @@ 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 {
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 {
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 {
constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
get encoding(): string;
@@ -2244,25 +2963,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 {
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;
@@ -2275,6 +3002,11 @@ interface QueuingStrategyInit {
*/
highWaterMark: number;
}
+interface TracePreviewInfo {
+ id: string;
+ slug: string;
+ name: string;
+}
interface ScriptVersion {
id?: string;
tag?: string;
@@ -2289,6 +3021,7 @@ interface TraceItem {
| (
| TraceItemFetchEventInfo
| TraceItemJsRpcEventInfo
+ | TraceItemConnectEventInfo
| TraceItemScheduledEventInfo
| TraceItemAlarmEventInfo
| TraceItemQueueEventInfo
@@ -2307,6 +3040,9 @@ interface TraceItem {
readonly scriptVersion?: ScriptVersion;
readonly dispatchNamespace?: string;
readonly scriptTags?: string[];
+ readonly tailAttributes?: Record;
+ readonly preview?: TracePreviewInfo;
+ readonly durableObjectId?: string;
readonly outcome: string;
readonly executionModel: string;
readonly truncated: boolean;
@@ -2316,6 +3052,7 @@ interface TraceItem {
interface TraceItemAlarmEventInfo {
readonly scheduledTime: Date;
}
+interface TraceItemConnectEventInfo {}
interface TraceItemCustomEventInfo {}
interface TraceItemScheduledEventInfo {
readonly scheduledTime: number;
@@ -2394,111 +3131,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> | Record | 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<[key: string, value: string]>;
@@ -2510,15 +3367,15 @@ declare class URLSearchParams {
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, value: string]>;
}
declare class URLPattern {
constructor(
- input?: string | URLPatternURLPatternInit,
- baseURL?: string | URLPatternURLPatternOptions,
- patternOptions?: URLPatternURLPatternOptions,
+ input?: string | URLPatternInit,
+ baseURL?: string | URLPatternOptions,
+ patternOptions?: URLPatternOptions,
);
get protocol(): string;
get username(): string;
@@ -2528,13 +3385,11 @@ declare class URLPattern {
get pathname(): string;
get search(): string;
get hash(): string;
- test(input?: string | URLPatternURLPatternInit, baseURL?: string): boolean;
- exec(
- input?: string | URLPatternURLPatternInit,
- baseURL?: string,
- ): URLPatternURLPatternResult | null;
+ get hasRegExpGroups(): boolean;
+ test(input?: string | URLPatternInit, baseURL?: string): boolean;
+ exec(input?: string | URLPatternInit, baseURL?: string): URLPatternResult | null;
}
-interface URLPatternURLPatternInit {
+interface URLPatternInit {
protocol?: string;
username?: string;
password?: string;
@@ -2545,45 +3400,45 @@ interface URLPatternURLPatternInit {
hash?: string;
baseURL?: string;
}
-interface URLPatternURLPatternComponentResult {
+interface URLPatternComponentResult {
input: string;
groups: Record;
}
-interface URLPatternURLPatternResult {
- inputs: (string | URLPatternURLPatternInit)[];
- protocol: URLPatternURLPatternComponentResult;
- username: URLPatternURLPatternComponentResult;
- password: URLPatternURLPatternComponentResult;
- hostname: URLPatternURLPatternComponentResult;
- port: URLPatternURLPatternComponentResult;
- pathname: URLPatternURLPatternComponentResult;
- search: URLPatternURLPatternComponentResult;
- hash: URLPatternURLPatternComponentResult;
-}
-interface URLPatternURLPatternOptions {
+interface URLPatternResult {
+ inputs: (string | URLPatternInit)[];
+ protocol: URLPatternComponentResult;
+ username: URLPatternComponentResult;
+ password: URLPatternComponentResult;
+ hostname: URLPatternComponentResult;
+ port: URLPatternComponentResult;
+ pathname: URLPatternComponentResult;
+ search: URLPatternComponentResult;
+ hash: URLPatternComponentResult;
+}
+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)
*/
@@ -2594,23 +3449,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;
@@ -2618,7 +3456,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)
*/
@@ -2635,20 +3473,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 {
- 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)
*/
@@ -2656,29 +3494,45 @@ interface WebSocket extends EventTarget {
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 (): {
@@ -2720,6 +3574,8 @@ interface Socket {
get writable(): WritableStream;
get closed(): Promise;
get opened(): Promise;
+ get upgraded(): boolean;
+ get secureTransport(): "on" | "off" | "starttls";
close(): Promise;
startTls(options?: TlsOptions): Socket;
}
@@ -2739,29 +3595,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)
*/
@@ -2787,6 +3647,28 @@ interface EventSourceEventSourceInit {
withCredentials?: boolean;
fetcher?: Fetcher;
}
+interface ExecOutput {
+ readonly stdout: ArrayBuffer;
+ readonly stderr: ArrayBuffer;
+ readonly exitCode: number;
+}
+interface ContainerExecOptions {
+ cwd?: string;
+ env?: Record;
+ user?: string;
+ stdin?: ReadableStream | "pipe";
+ stdout?: "pipe" | "ignore";
+ stderr?: "pipe" | "ignore" | "combined";
+}
+interface ExecProcess {
+ readonly stdin: WritableStream | null;
+ readonly stdout: ReadableStream | null;
+ readonly stderr: ReadableStream | null;
+ readonly pid: number;
+ readonly exitCode: Promise;
+ output(): Promise;
+ kill(signal?: number): void;
+}
interface Container {
get running(): boolean;
start(options?: ContainerStartupOptions): void;
@@ -2794,2296 +3676,9355 @@ interface Container {
destroy(error?: any): Promise;
signal(signo: number): void;
getTcpPort(port: number): Fetcher;
+ setInactivityTimeout(durationMs: number | bigint): Promise;
+ interceptOutboundHttp(addr: string, binding: Fetcher): Promise;
+ interceptAllOutboundHttp(binding: Fetcher): Promise;
+ snapshotDirectory(
+ options: ContainerDirectorySnapshotOptions,
+ ): Promise;
+ snapshotContainer(options: ContainerSnapshotOptions): Promise;
+ interceptOutboundHttps(addr: string, binding: Fetcher): Promise;
+ exec(cmd: string[], options?: ContainerExecOptions): Promise;
+}
+interface ContainerDirectorySnapshot {
+ id: string;
+ size: number;
+ dir: string;
+ name?: string;
+}
+interface ContainerDirectorySnapshotOptions {
+ dir: string;
+ name?: string;
+}
+interface ContainerDirectorySnapshotRestoreParams {
+ snapshot: ContainerDirectorySnapshot;
+ mountPoint?: string;
+}
+interface ContainerSnapshot {
+ id: string;
+ size: number;
+ name?: string;
+}
+interface ContainerSnapshotOptions {
+ name?: string;
}
interface ContainerStartupOptions {
entrypoint?: string[];
enableInternet: boolean;
env?: Record;
+ labels?: Record;
+ directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
+ containerSnapshot?: ContainerSnapshot;
}
-type AiImageClassificationInput = {
- image: number[];
-};
-type AiImageClassificationOutput = {
- score?: number;
- label?: string;
-}[];
-declare abstract class BaseAiImageClassification {
- inputs: AiImageClassificationInput;
- postProcessedOutputs: AiImageClassificationOutput;
-}
-type AiImageToTextInput = {
- image: number[];
- prompt?: string;
- max_tokens?: number;
- temperature?: number;
- top_p?: number;
- top_k?: number;
- seed?: number;
- repetition_penalty?: number;
- frequency_penalty?: number;
- presence_penalty?: number;
- raw?: boolean;
- messages?: RoleScopedChatInput[];
-};
-type AiImageToTextOutput = {
- description: string;
-};
-declare abstract class BaseAiImageToText {
- inputs: AiImageToTextInput;
- postProcessedOutputs: AiImageToTextOutput;
+/**
+ * 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);
}
-type AiImageTextToTextInput = {
- image: string;
- prompt?: string;
- max_tokens?: number;
- temperature?: number;
- ignore_eos?: boolean;
- top_p?: number;
- top_k?: number;
- seed?: number;
- repetition_penalty?: number;
- frequency_penalty?: number;
- presence_penalty?: number;
- raw?: boolean;
- messages?: RoleScopedChatInput[];
-};
-type AiImageTextToTextOutput = {
- description: string;
-};
-declare abstract class BaseAiImageTextToText {
- inputs: AiImageTextToTextInput;
- postProcessedOutputs: AiImageTextToTextOutput;
+/**
+ * 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;
}
-type AiObjectDetectionInput = {
- image: number[];
-};
-type AiObjectDetectionOutput = {
- score?: number;
- label?: string;
-}[];
-declare abstract class BaseAiObjectDetection {
- inputs: AiObjectDetectionInput;
- postProcessedOutputs: AiObjectDetectionOutput;
+interface MessagePortPostMessageOptions {
+ transfer?: any[];
}
-type AiSentenceSimilarityInput = {
- source: string;
- sentences: string[];
-};
-type AiSentenceSimilarityOutput = number[];
-declare abstract class BaseAiSentenceSimilarity {
- inputs: AiSentenceSimilarityInput;
- postProcessedOutputs: AiSentenceSimilarityOutput;
+type LoopbackForExport<
+ T extends
+ | (new (...args: any[]) => Rpc.EntrypointBranded)
+ | ExportedHandler
+ | undefined = undefined,
+> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
+ ? LoopbackServiceStub>
+ : T extends new (...args: any[]) => Rpc.DurableObjectBranded
+ ? LoopbackDurableObjectClass>
+ : T extends ExportedHandler
+ ? LoopbackServiceStub
+ : undefined;
+type LoopbackServiceStub =
+ Fetcher &
+ (T extends CloudflareWorkersModule.WorkerEntrypoint
+ ? (opts: { props?: Props }) => Fetcher
+ : (opts: { props?: any }) => Fetcher);
+type LoopbackDurableObjectClass =
+ DurableObjectClass &
+ (T extends CloudflareWorkersModule.DurableObject
+ ? (opts: { props?: Props }) => DurableObjectClass
+ : (opts: { props?: any }) => DurableObjectClass);
+interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
+interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
+interface SyncKvStorage {
+ get(key: string): T | undefined;
+ list(options?: SyncKvListOptions): Iterable<[string, T]>;
+ put