From e1d64d6ec15c982a7ed469d0609c8362dfac8d56 Mon Sep 17 00:00:00 2001 From: Adam Daley Date: Tue, 1 Sep 2026 05:46:59 +0100 Subject: [PATCH 1/2] Update deps and Scalar docs API --- package-lock.json | 98 +-- src/services/extensions/v2/index.ts | 28 +- src/services/previews/v1/index.ts | 50 +- worker-configuration.d.ts | 1019 +++++++++++++++++++++------ 4 files changed, 900 insertions(+), 295 deletions(-) diff --git a/package-lock.json b/package-lock.json index 55dd15c..adfde64 100644 --- a/package-lock.json +++ b/package-lock.json @@ -392,6 +392,16 @@ } } }, + "node_modules/@cloudflare/vitest-pool-workers/node_modules/zod": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, "node_modules/@cloudflare/workerd-darwin-64": { "version": "1.20260815.1", "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20260815.1.tgz", @@ -1531,9 +1541,9 @@ } }, "node_modules/@hono/zod-validator": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@hono/zod-validator/-/zod-validator-0.9.0.tgz", - "integrity": "sha512-n0ZSXmCiHVIp4Y5wlOOyZCeTd/rsawA/qW1cipB8QOYKZ9N8Tk0nZUZCXho9cu374AN4JpDNKioNKBJ/W+LBug==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/@hono/zod-validator/-/zod-validator-0.9.1.tgz", + "integrity": "sha512-iiv6w0qrIc0arfvCtUqBWsvl4fXjzaTcQcCJTTtCnkawF9HHGE+KjEl0ox3gQJ6rKZEgE3mLExlQCF72M+mNuw==", "license": "MIT", "peerDependencies": { "hono": ">=4.11.2", @@ -2224,9 +2234,9 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", "dev": true, "license": "MIT" }, @@ -2242,12 +2252,12 @@ } }, "node_modules/@octokit/endpoint": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.4.tgz", - "integrity": "sha512-f1cOWoHPmxryJFknxbtDdjODWfV8A9tc8Aae6ermXPNgHFZ/x91AtHIz4gicEjL8hkJiip+u21QHJORfBv/qiA==", + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.5.tgz", + "integrity": "sha512-iXa654H3yFafF/ieHkukfbgWo2rmXD2ceD0ZOtrPhw1bc3FDch1d9N/TNs0FQ1/cIbwb7kspUX8jzIs8nzb9DQ==", "license": "MIT", "dependencies": { - "@octokit/types": "^17.0.0", + "@octokit/types": "^18.0.0", "universal-user-agent": "^7.0.2" }, "engines": { @@ -2255,13 +2265,13 @@ } }, "node_modules/@octokit/graphql": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.4.tgz", - "integrity": "sha512-5s15CCiY8XXQ+FG+b1YQcl6Z2FA++nwAz/tg2VUrTmnMncP+2nnGUEYANImdnxsA2Fnq+Mbl7hDjUTw7cFAwcg==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.5.tgz", + "integrity": "sha512-bt/hm03LeU6Vy7FwTrkkC9p3XGT/lBwClglMqxBSe5/q0E5CdJTXeAqEI0vlw89/LF/G6tryTIH8HirZ3prMVg==", "license": "MIT", "dependencies": { - "@octokit/request": "^10.0.13", - "@octokit/types": "^17.0.0", + "@octokit/request": "^10.0.16", + "@octokit/types": "^18.0.0", "universal-user-agent": "^7.0.0" }, "engines": { @@ -2269,20 +2279,20 @@ } }, "node_modules/@octokit/openapi-types": { - "version": "28.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-28.0.0.tgz", - "integrity": "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ==", + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-29.0.1.tgz", + "integrity": "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg==", "license": "MIT" }, "node_modules/@octokit/request": { - "version": "10.0.15", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.15.tgz", - "integrity": "sha512-3CBg9aJ0hO9Pjyij8LbK/xYtEaPws9SW7xKz67daPNxQB1q5Y9OMA7DDOG0A6Hwf9ygGu3tvzusg0LXQ8/wAjA==", + "version": "10.0.16", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.16.tgz", + "integrity": "sha512-A0zWGjHzISIb+9ccG8s0dq7LKO5zVpJLRICjgUb+sJxEWqn8RUHB1rD3AE51+PECvXHIxqZ1VVvs4fHTSD9nUQ==", "license": "MIT", "dependencies": { - "@octokit/endpoint": "^11.0.3", - "@octokit/request-error": "^7.1.1", - "@octokit/types": "^17.0.0", + "@octokit/endpoint": "^11.0.5", + "@octokit/request-error": "^7.1.2", + "@octokit/types": "^18.0.0", "content-type": "^3.0.0", "json-with-bigint": "^3.5.12", "universal-user-agent": "^7.0.2" @@ -2292,24 +2302,24 @@ } }, "node_modules/@octokit/request-error": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.1.1.tgz", - "integrity": "sha512-+eaY7G2VVpSf2pc5Gn1+mph837V/d/TYTJAgWL9Tb0ogGYcpN3IlAVFgjL+Vv93F/sevrxkvsYCedtpLdcFLzA==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.1.2.tgz", + "integrity": "sha512-XZRuT3xZ84D3gYErI1DZvhJ33dCWVV6uzBtWkaBB4TvA/L6eOeTZodxLFVB44bBEEo3vEx7y00UfX1tBLrtLRg==", "license": "MIT", "dependencies": { - "@octokit/types": "^17.0.0" + "@octokit/types": "^18.0.0" }, "engines": { "node": ">= 20" } }, "node_modules/@octokit/types": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-17.0.0.tgz", - "integrity": "sha512-ByP1v7YL5SMveFPP7+sj0/ZuWCOOg/Chs4NafOMpq6WNIM/hdGY0S7C0TCGDBWu1aGmOxmUIhMx3cO+IdwYZ1Q==", + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-18.0.0.tgz", + "integrity": "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA==", "license": "MIT", "dependencies": { - "@octokit/openapi-types": "^28.0.0" + "@octokit/openapi-types": "^29.0.1" } }, "node_modules/@oxc-project/types": { @@ -4123,9 +4133,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.415", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.415.tgz", - "integrity": "sha512-958V+Kbhtgz+SxXeEVKBjrlKRBIDAYvUJfwhjxMZ5S6ut9jAl7l9ZKBkBrvjyjZE36PabLUo2L8kEeV5O4vgJg==", + "version": "1.5.418", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.418.tgz", + "integrity": "sha512-UzS26r3AEbG5wSoGVpJKqwHIU9zwQN7LHdVIThDrJpS0I5KdlXFMEb8543fhc9dVnIIAST6ar8rhwa00AL5MlA==", "dev": true, "license": "ISC" }, @@ -4636,9 +4646,9 @@ "license": "MIT" }, "node_modules/ignore": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz", - "integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==", + "version": "7.0.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.8.tgz", + "integrity": "sha512-YYNsSlXBjMk92SKnkwvB5LOVSa6OznlFUGcsvrFgNJbJCd0M1XKeFVRc8ZByeCqz32FivYNHJVooLmdqrmvp/Q==", "dev": true, "license": "MIT", "engines": { @@ -5757,9 +5767,9 @@ } }, "node_modules/type-fest": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-5.8.0.tgz", - "integrity": "sha512-YGYEVz3Fm5iy/AybuA0oyNFq7H4CgQNfRp/qfe8nurE1kuCeNm3/vfm9X4Mtl+qLyaKJUh5xrFZwogr41SMjYA==", + "version": "5.9.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-5.9.0.tgz", + "integrity": "sha512-yANm3Jr3GiJ1qgJlxGAVxTOIcEOk1rhQHamlXtnrCK7EHP4HeM9OGxtMg/W7HFdrVzw/ZWJKGVIJusVH85sLtw==", "license": "(MIT OR CC0-1.0)", "dependencies": { "tagged-tag": "^1.0.0" @@ -6358,9 +6368,9 @@ } }, "node_modules/zod": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", - "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz", + "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/src/services/extensions/v2/index.ts b/src/services/extensions/v2/index.ts index 28c4fff..8107d6d 100644 --- a/src/services/extensions/v2/index.ts +++ b/src/services/extensions/v2/index.ts @@ -57,21 +57,20 @@ registerModerationRoutes(extensionsV2); // are covered by the same migration 0020 check. registerDeveloperProfileRoutes(extensionsV2); -extensionsV2.doc31("/openapi.json", { - openapi: "3.1.0", - info: { - title: "FOSSBilling Extensions API (v2)", - version: "2.0.0", - description: - "Self-service extension publishing, ownership, moderation, and public browsing. v1 (/extensions/v1) remains available for existing integrations." - }, - servers: [{ url: "/extensions/v2" }] -}); - -extensionsV2.get( +extensionsV2.route( "/docs", - Scalar({ - url: "/extensions/v2/openapi.json", + Scalar.serve({ + document: () => + extensionsV2.getOpenAPI31Document({ + openapi: "3.1.0", + info: { + title: "FOSSBilling Extensions API (v2)", + version: "2.0.0", + description: + "Self-service extension publishing, ownership, moderation, and public browsing. v1 (/extensions/v1) remains available for existing integrations." + }, + servers: [{ url: "/extensions/v2" }], + }), pageTitle: "FOSSBilling Extensions API (v2)", agent: { disabled: true }, documentDownloadType: "none", @@ -86,6 +85,7 @@ extensionsV2.get( go: true, java: true, js: ["axios", "jquery", "ofetch"], + julia: true, kotlin: true, node: ["axios", "ofetch", "undici"], objc: true, diff --git a/src/services/previews/v1/index.ts b/src/services/previews/v1/index.ts index 5a4012d..ad5faef 100644 --- a/src/services/previews/v1/index.ts +++ b/src/services/previews/v1/index.ts @@ -30,26 +30,48 @@ registerMainRoutes(previewsV1); registerPrRoutes(previewsV1); registerCommitRoutes(previewsV1); -previewsV1.doc31("/openapi.json", { - openapi: "3.1.0", - info: { - title: "FOSSBilling Previews API (v1)", - version: "1.0.0", - description: - "Read-only lookup of FOSSBilling preview builds - the current main preview and per-PR/per-commit builds produced by FOSSBilling/FOSSBilling's GitHub Actions workflows." - }, - servers: [{ url: "/previews/v1" }] -}); - -previewsV1.get( +previewsV1.route( "/docs", - Scalar({ - url: "/previews/v1/openapi.json", + Scalar.serve({ + document: () => + previewsV1.getOpenAPI31Document({ + openapi: "3.1.0", + info: { + title: "FOSSBilling Previews API (v1)", + version: "1.0.0", + description: + "Read-only lookup of FOSSBilling preview builds - the current main preview and per-PR/per-commit builds produced by FOSSBilling/FOSSBilling's GitHub Actions workflows." + }, + servers: [{ url: "/previews/v1" }] + }), pageTitle: "FOSSBilling Previews API (v1)", agent: { disabled: true }, documentDownloadType: "none", hideClientButton: true, hideModels: true, + hiddenClients: { + c: true, + clojure: true, + csharp: true, + dart: true, + fsharp: true, + go: true, + java: true, + js: ["axios", "jquery", "ofetch"], + julia: true, + kotlin: true, + node: ["axios", "ofetch", "undici"], + objc: true, + ocaml: true, + php: ["guzzle", "laravel"], + powershell: true, + python: true, + r: true, + ruby: true, + rust: true, + shell: ["httpie"], + swift: true + }, telemetry: false }) ); diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index a732555..cf70419 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -1,6 +1,6 @@ /* eslint-disable */ // Generated by Wrangler by running `wrangler types --env-interface=CloudflareBindings` (hash: 3699481541fb6006a52b433d336dc475) -// Runtime types generated with workerd@1.20260801.1 2026-06-24 nodejs_compat +// Runtime types generated with workerd@1.20260828.1 2026-06-24 nodejs_compat interface __BaseEnv_CloudflareBindings { AUTH_KV: KVNamespace; CACHE_KV: KVNamespace; @@ -44,26 +44,26 @@ and limitations under the License. // noinspection JSUnusedGlobalSymbols declare var onmessage: never; /** - * 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. + * 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. This is how error conditions are described in web APIs. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) */ declare class DOMException extends Error { constructor(message?: string, name?: string); /** - * The **`message`** read-only property of the a message or description associated with the given error name. + * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */ readonly message: string; /** - * The **`name`** read-only property of the one of the strings associated with an error name. + * The **`name`** read-only property of the DOMException interface returns a string that contains 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. + * 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) @@ -121,61 +121,61 @@ interface Console { */ clear(): void; /** - * The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called. + * 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; /** - * The **`console.countReset()`** static method resets counter used with console/count_static. + * The **`console.countReset()`** static method resets counter used with console.count(). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static) */ countReset(label?: string): void; /** - * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level. + * The **`console.debug()`** static method outputs a message to the console at the "debug" log level. The message is only displayed to the user if the console is configured to display debug output. In most cases, the log level is configured within the console UI. This log level might correspond to the Debug or Verbose log level. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */ debug(...data: any[]): void; /** - * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object. + * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object. In browser consoles, the output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static) */ dir(item?: any, options?: any): void; /** - * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element. + * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element. If it is not possible to display as an element the JavaScript Object view is shown instead. The output is presented as a hierarchical listing of expandable nodes that let you see the contents of child nodes. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static) */ dirxml(...data: any[]): void; /** - * The **`console.error()`** static method outputs a message to the console at the 'error' log level. + * The **`console.error()`** static method outputs a message to the console at the "error" log level. The message is only displayed to the user if the console is configured to display error output. In most cases, the log level is configured within the console UI. The message may be formatted as an error, with red colors and call stack information. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */ error(...data: any[]): void; /** - * 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. + * 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() is called. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static) */ group(...data: any[]): void; /** - * The **`console.groupCollapsed()`** static method creates a new inline group in the console. + * The **`console.groupCollapsed()`** static method creates a new inline group in the console. Unlike console.group(), however, the new group is created collapsed. The user will need to use the disclosure button next to it to expand it, revealing the entries created in the group. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static) */ groupCollapsed(...data: any[]): void; /** - * The **`console.groupEnd()`** static method exits the current inline group in the console. + * The **`console.groupEnd()`** static method exits the current inline group in the console. See Using groups in the console in the console documentation for details and examples. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static) */ groupEnd(): void; /** - * The **`console.info()`** static method outputs a message to the console at the 'info' log level. + * The **`console.info()`** static method outputs a message to the console at the "info" log level. The message is only displayed to the user if the console is configured to display info output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as a small "i" icon next to it. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */ @@ -193,23 +193,24 @@ interface Console { */ table(tabularData?: any, properties?: string[]): void; /** - * The **`console.time()`** static method starts a timer you can use to track how long an operation takes. + * The **`console.time()`** static method starts a timer you can use to track how long an operation takes. You give each timer a unique name, and may have up to 10,000 timers running on a given page. When you call console.timeEnd() with the same name, the browser will output the time, in milliseconds, that elapsed since the timer was started. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */ time(label?: string): void; /** - * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static. + * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time(). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */ timeEnd(label?: string): void; /** - * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static. + * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time(). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static) */ timeLog(label?: string, ...data: any[]): void; + /* The **`console.timeStamp()`** static method adds a single marker to the browser's Performance tool (Firefox bug 1387528, Chrome). This lets you correlate a point in your code with the other events recorded in the timeline, such as layout and paint events. */ timeStamp(label?: string): void; /** * The **`console.trace()`** static method outputs a stack trace to the console. @@ -218,7 +219,7 @@ interface Console { */ trace(...data: any[]): void; /** - * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level. + * The **`console.warn()`** static method outputs a warning message to the console at the "warning" log level. The message is only displayed to the user if the console is configured to display warning output. In most cases, the log level is configured within the console UI. The message may receive special formatting, such as yellow colors and a warning icon. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */ @@ -384,7 +385,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope { declare function addEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetAddEventListenerOptions | boolean): void; declare function removeEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetEventListenerOptions | boolean): void; /** - * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. + * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent(). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) */ @@ -429,6 +430,7 @@ declare const crypto: Crypto; * [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/) */ declare const caches: CacheStorage; +/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/scheduler) */ declare const scheduler: Scheduler; /** * The Workers runtime supports a subset of the Performance API, used to measure timing and performance, @@ -450,6 +452,7 @@ interface ExecutionContext { cache?: CacheContext; readonly access?: CloudflareAccessContext; tracing: Tracing; + abort(reason?: any): void; } type ExportedHandlerFetchHandler = (request: Request>, env: Env, ctx: ExecutionContext) => Response | Promise; type ExportedHandlerConnectHandler = (socket: Socket, env: Env, ctx: ExecutionContext) => void | Promise; @@ -567,7 +570,7 @@ interface DurableObjectState { setHibernatableWebSocketEventTimeout(timeoutMs?: number): void; getHibernatableWebSocketEventTimeout(): number | null; getTags(ws: WebSocket): string[]; - abort(reason?: string): void; + abort(reason?: string, options?: DurableObjectAbortOptions): void; } interface DurableObjectTransaction { get(key: string, options?: DurableObjectGetOptions): Promise; @@ -603,6 +606,9 @@ interface DurableObjectStorage { getBookmarkForTime(timestamp: number | Date): Promise; onNextSessionRestoreBookmark(bookmark: string): Promise; } +interface DurableObjectAbortOptions { + retryAlarm?: boolean; +} interface DurableObjectListOptions { start?: string; startAfter?: string; @@ -653,26 +659,26 @@ interface AnalyticsEngineDataPoint { blobs?: ((ArrayBuffer | string) | null)[]; } /** - * The **`Event`** interface represents an event which takes place on an `EventTarget`. + * 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); /** - * The **`type`** read-only property of the Event interface returns a string containing the event's type. + * The **`type`** read-only property of the Event interface returns a string containing the event's type. It is set when the event is constructed and is the name commonly used to refer to the specific event, such as click, load, or error. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type) */ get type(): string; /** - * The **`eventPhase`** read-only property of the being evaluated. + * The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase) */ get eventPhase(): number; /** - * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM. + * The read-only **`composed`** property of the Event interface returns a boolean value which indicates whether 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) */ @@ -709,13 +715,13 @@ declare class Event { */ get currentTarget(): EventTarget | undefined; /** - * The read-only **`target`** property of the dispatched. + * The read-only **`target`** property of the Event interface is a reference to the object onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event. * * [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. + * The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead. * @deprecated * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement) @@ -728,45 +734,45 @@ declare class Event { */ get timeStamp(): number; /** - * 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. + * The **`isTrusted`** read-only property of the Event interface is a boolean value that is true 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 EventTarget.dispatchEvent(). 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. + * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details. * @deprecated * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) */ get cancelBubble(): boolean; /** - * The **`cancelBubble`** property of the Event interface is deprecated. + * The **`cancelBubble`** property of the Event interface is deprecated. Use Event.stopPropagation() instead. Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details. * @deprecated * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) */ set cancelBubble(value: boolean); /** - * 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. + * The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation) */ stopImmediatePropagation(): void; /** - * 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. + * The **`preventDefault()`** method of the Event interface tells the user agent that the event is being explicitly handled, so its default action, such as page scrolling, link navigation, or pasting text, should not be taken. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault) */ preventDefault(): void; /** - * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. + * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed. If you want to stop those behaviors, see the preventDefault() method. It also does not prevent propagation to other event-handlers of the current element. If you want to stop those, see stopImmediatePropagation(). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation) */ stopPropagation(): void; /** - * 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. + * 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. This does not include nodes in shadow trees if the shadow root was created with its ShadowRoot.mode closed. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath) */ @@ -787,7 +793,7 @@ interface EventListenerObject { } type EventListenerOrEventListenerObject = EventListener | EventListenerObject; /** - * The **`EventTarget`** interface is 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. In other words, any target of events implements the three methods associated with this interface. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget) */ @@ -800,13 +806,13 @@ declare class EventTarget = Record(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetAddEventListenerOptions | boolean): void; /** - * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. + * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) */ removeEventListener(type: Type, handler: EventListenerOrEventListenerObject, options?: EventTargetEventListenerOptions | boolean): void; /** - * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. + * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent(). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) */ @@ -838,7 +844,7 @@ declare class AbortController { */ get signal(): AbortSignal; /** - * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed. + * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed. This is able to abort fetch requests, the consumption of any response bodies, or streams. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort) */ @@ -851,7 +857,7 @@ declare class AbortController { */ declare abstract class AbortSignal extends EventTarget { /** - * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event). + * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an abort event). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */ @@ -863,13 +869,13 @@ declare abstract class AbortSignal extends EventTarget { */ static timeout(delay: number): AbortSignal; /** - * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal. + * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal. The returned abort signal is aborted when any of the input iterable abort signals are aborted. The abort reason will be set to the reason of the first signal that is aborted. If any of the given abort signals are already aborted then so will be the returned AbortSignal. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */ static any(signals: AbortSignal[]): AbortSignal; /** - * 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`). + * 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) */ @@ -885,12 +891,17 @@ declare abstract class AbortSignal extends EventTarget { /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ set onabort(value: any | null); /** - * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing. + * The **`throwIfAborted()`** method throws the signal's abort reason if the signal has been aborted; otherwise it does nothing. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */ throwIfAborted(): void; } +/** + * The **`Scheduler`** interface of the Prioritized Task Scheduling API provides methods for scheduling prioritized tasks. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Scheduler) + */ interface Scheduler { wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise; } @@ -898,20 +909,20 @@ interface SchedulerWaitOptions { signal?: AbortSignal; } /** - * The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle. + * The **`ExtendableEvent`** interface 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. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent) */ declare abstract class ExtendableEvent extends Event { /** - * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. + * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil) */ waitUntil(promise: Promise): void; } /** - * The **`CustomEvent`** interface represents events initialized by an application for any purpose. + * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) */ @@ -950,7 +961,7 @@ declare class Blob { */ get type(): string; /** - * 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. + * 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) */ @@ -968,13 +979,13 @@ declare class Blob { */ bytes(): Promise; /** - * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8. + * The **`text()`** method of the Blob interface returns a Promise that resolves with a string containing the contents of the blob, interpreted as UTF-8. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */ text(): Promise; /** - * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`. + * 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) */ @@ -991,13 +1002,13 @@ interface BlobOptions { declare class File extends Blob { constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions); /** - * The **`name`** read-only property of the File interface returns the name of the file represented by a File object. + * The **`name`** read-only property of the File interface returns the name of the file represented by a File object. For security reasons, the path is excluded from this property. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */ get name(): string; /** - * 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). + * 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). Files without a known last modified date return the current date. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */ @@ -1014,7 +1025,7 @@ interface FileOptions { */ declare abstract class CacheStorage { /** - * The **`open()`** method of the the Cache object matching the `cacheName`. + * The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */ @@ -1047,14 +1058,14 @@ interface CacheQueryOptions { */ declare abstract class Crypto { /** - * The **`Crypto.subtle`** read-only property returns a cryptographic operations. + * The **`Crypto.subtle`** read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations. * Available only in secure contexts. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle) */ get subtle(): SubtleCrypto; /** - * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values. + * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values. The array given as the parameter is filled with random numbers (random in its cryptographic meaning). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */ @@ -1082,7 +1093,7 @@ declare abstract class SubtleCrypto { */ encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise; /** - * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data. + * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data. It takes as arguments a key to decrypt with, some optional extra parameters, and the data to decrypt (also known as "ciphertext"). It returns a Promise which will be fulfilled with the decrypted data (also known as "plaintext"). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt) */ @@ -1100,7 +1111,7 @@ declare abstract class SubtleCrypto { */ verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise; /** - * The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function. + * The **`digest()`** method of the SubtleCrypto interface generates a digest of the given data, using the specified hash function. A digest is a short fixed-length value derived from some variable-length input. Cryptographic digests should exhibit collision-resistance, meaning that it's hard to come up with two different inputs that have the same digest value. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest) */ @@ -1118,7 +1129,7 @@ declare abstract class SubtleCrypto { */ deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise; /** - * The **`deriveBits()`** method of the key. + * The **`deriveBits()`** method of the SubtleCrypto interface can be used to derive an array of bits from a base key. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits) */ @@ -1136,13 +1147,13 @@ declare abstract class SubtleCrypto { */ exportKey(format: string, key: CryptoKey): Promise; /** - * The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key. + * The **`wrapKey()`** method of the SubtleCrypto interface "wraps" a key. This means that it exports the key in an external, portable format, then encrypts the exported key. Wrapping a key helps protect it in untrusted environments, such as inside an otherwise unprotected data store or in transmission over an unprotected network. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey) */ wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise; /** - * The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key. + * The **`unwrapKey()`** method of the SubtleCrypto interface "unwraps" a key. This means that it takes as its input a key that has been exported and then encrypted (also called "wrapped"). It decrypts the key and then imports it, returning a CryptoKey object that can be used in the Web Crypto API. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey) */ @@ -1150,20 +1161,20 @@ declare abstract class SubtleCrypto { timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean; } /** - * 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. + * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods generateKey(), deriveKey(), importKey(), or unwrapKey(). * Available only in secure contexts. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey) */ declare abstract class CryptoKey { /** - * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object. + * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object. It can have the following values: * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */ readonly type: string; /** - * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`. + * 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) */ @@ -1280,12 +1291,15 @@ interface CryptoKeyArbitraryKeyAlgorithm { length?: number; } declare class DigestStream extends WritableStream { - constructor(algorithm: string | SubtleCryptoHashAlgorithm); + constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions); readonly digest: Promise; get bytesWritten(): number | bigint; } +interface DigestStreamOptions { + toWellFormed?: boolean; +} /** - * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc. + * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as UTF-8, ISO-8859-2, or GBK. A decoder takes an array of bytes as input and returns a JavaScript string. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder) */ @@ -1302,20 +1316,20 @@ declare class TextDecoder { get ignoreBOM(): boolean; } /** - * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes. + * The **`TextEncoder`** interface enables you to encode a JavaScript string using UTF-8. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder) */ declare class TextEncoder { constructor(); /** - * 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. + * The **`TextEncoder.encode()`** method takes a string as input, and returns a Uint8Array containing the string encoded using UTF-8. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode) */ encode(input?: string): Uint8Array; /** - * 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. + * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns an object indicating the progress of the encoding. This is potentially more performant than the encode() method — especially when the target buffer is a view into a Wasm heap. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto) */ @@ -1372,6 +1386,9 @@ declare class ErrorEvent extends Event { get error(): any; } interface ErrorEventErrorEventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; message?: string; filename?: string; lineno?: number; @@ -1384,135 +1401,139 @@ interface ErrorEventErrorEventInit { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent) */ declare class MessageEvent extends Event { - constructor(type: string, initializer: MessageEventInit); + constructor(type: string, initializer?: MessageEventInit); /** - * 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. + * The **`data`** read-only property of the MessageEvent interface represents the data sent by the message emitter. * * [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. + * The **`origin`** read-only property of the MessageEvent interface is a string representing 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. + * The **`lastEventId`** read-only property of the MessageEvent interface is a string representing a 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. + * The **`source`** read-only property of the MessageEvent interface is a MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the 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. + * The **`ports`** read-only property of the MessageEvent interface is an array of MessagePort objects 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; + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; + data?: any; + origin?: string; + lastEventId?: string; + source?: MessagePort; + ports?: MessagePort[]; } /** - * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected. + * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected. These events are particularly useful for telemetry and debugging purposes. * * [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. + * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript Promise which was rejected. You can examine the event's PromiseRejectionEvent.reason property to learn why the promise was 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(). + * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). This in theory provides information about why the promise was rejected. * * [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. + * 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 fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data". * * [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. + * 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. + * 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. + * 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. + * 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. + * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a FormData object. If you expect multiple values and want all of them, use the getAll() method instead. * * [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. + * 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. + * 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. + * 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. + * 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. + * 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<(File | string)>; forEach(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void; [Symbol.iterator](): IterableIterator<[ @@ -1591,19 +1612,19 @@ interface DocumentEnd { append(content: string, options?: ContentOptions): DocumentEnd; } /** - * This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope. + * 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. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent) */ declare abstract class FetchEvent extends ExtendableEvent { /** - * The **`request`** read-only property of the the event handler. + * The **`request`** read-only property of the FetchEvent interface returns the Request that triggered the event handler. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request) */ readonly request: Request; /** - * The **`respondWith()`** method of allows you to provide a promise for a Response yourself. + * The **`respondWith()`** method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith) */ @@ -1612,58 +1633,55 @@ declare abstract class FetchEvent extends ExtendableEvent { } type HeadersInit = Headers | Iterable> | Record; /** - * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers. + * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing headers from the list of the request's headers. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers) */ declare class Headers { constructor(init?: HeadersInit); /** - * 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. + * 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. If the requested header doesn't exist in the Headers object, it returns null. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get) */ get(name: string): string | null; getAll(name: string): string[]; /** - * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response. + * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response. This allows Headers objects to handle having multiple Set-Cookie headers, which wasn't possible prior to its implementation. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie) */ getSetCookie(): string[]; /** - * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header. + * 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; /** - * 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. + * 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; /** - * 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. + * 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; /** - * The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object. + * 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, thisArg?: This): void; - /* Returns an iterator allowing to go through all key/value pairs contained in this object. */ entries(): IterableIterator<[ key: string, value: string ]>; - /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */ keys(): IterableIterator; - /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */ values(): IterableIterator; [Symbol.iterator](): IterableIterator<[ key: string, @@ -1726,7 +1744,7 @@ interface Response extends Body { */ statusText: string; /** - * The **`headers`** read-only property of the with the response. + * The **`headers`** read-only property of the Response interface contains the Headers object associated with the response. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */ @@ -1744,7 +1762,7 @@ interface Response extends Body { */ redirected: boolean; /** - * The **`url`** read-only property of the Response interface contains the URL of the response. + * The **`url`** read-only property of the Response interface contains the URL of the response. The value of the url property will be the final URL obtained after any redirects. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */ @@ -1752,7 +1770,7 @@ interface Response extends Body { webSocket: WebSocket | null; cf: any | undefined; /** - * The **`type`** read-only property of the Response interface contains the type of the response. + * The **`type`** read-only property of the Response interface contains the type of the response. The type determines whether scripts are able to access the response body and headers. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type) */ @@ -1783,13 +1801,13 @@ declare var Request: { */ interface Request> extends Body { /** - * The **`clone()`** method of the Request interface creates a copy of the current `Request` object. + * 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; /** - * The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request. + * The **`method`** read-only property of the Request interface contains the request's method (GET, POST, etc.) * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method) */ @@ -1801,7 +1819,7 @@ interface Request> e */ url: string; /** - * The **`headers`** read-only property of the with the request. + * The **`headers`** read-only property of the Request interface contains the Headers object associated with the request. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers) */ @@ -1827,13 +1845,13 @@ interface Request> e */ integrity: string; /** - * 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. + * 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; /** - * The **`cache`** read-only property of the Request interface contains the cache mode of the request. + * The **`cache`** read-only property of the Request interface contains the cache mode of the request. It controls how the request will interact with the browser's HTTP cache. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache) */ @@ -2222,7 +2240,7 @@ type ReadableStreamReadResult = { value?: undefined; }; /** - * The `ReadableStream` interface of the Streams API represents a readable stream of byte data. + * The **`ReadableStream`** interface of the Streams API 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. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream) */ @@ -2240,13 +2258,13 @@ interface ReadableStream { */ cancel(reason?: any): Promise; /** - * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. + * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. While the stream is locked, no other reader can be acquired until this one is released. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */ getReader(): ReadableStreamDefaultReader; /** - * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. + * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it. While the stream is locked, no other reader can be acquired until this one is released. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader) */ @@ -2258,13 +2276,13 @@ interface ReadableStream { */ pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; /** - * 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. + * 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; /** - * The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances. + * The **`tee()`** method of the ReadableStream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee) */ @@ -2276,7 +2294,7 @@ interface ReadableStream { [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator; } /** - * The `ReadableStream` interface of the Streams API represents a readable stream of byte data. + * The **`ReadableStream`** interface of the Streams API 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. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream) */ @@ -2308,7 +2326,7 @@ declare class ReadableStreamDefaultReader { releaseLock(): void; } /** - * The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source. + * The **`ReadableStreamBYOBReader`** interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */ @@ -2317,13 +2335,13 @@ declare class ReadableStreamBYOBReader { get closed(): Promise; cancel(reason?: any): Promise; /** - * 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. + * 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. A request for data will be satisfied from the stream's internal queues if there is any data present. If the stream queues are empty, the request may be supplied as a zero-copy transfer from the underlying byte source. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */ read(view: T): Promise>; /** - * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream. + * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream. After the lock is released, the reader is no longer active. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */ @@ -2342,7 +2360,7 @@ interface ReadableStreamGetReaderOptions { mode: "byob"; } /** - * 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). + * 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) */ @@ -2368,13 +2386,13 @@ declare abstract class ReadableStreamBYOBRequest { get atLeast(): number | null; } /** - * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. + * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. Default controllers are for streams that are not byte streams. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController) */ declare abstract class ReadableStreamDefaultController { /** - * The **`desiredSize`** read-only property of the required to fill the stream's internal queue. + * The **`desiredSize`** read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize) */ @@ -2386,32 +2404,32 @@ declare abstract class ReadableStreamDefaultController { */ close(): void; /** - * The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue. + * The **`enqueue()`** method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue) */ enqueue(chunk?: R): void; /** - * The **`error()`** method of the with the associated stream to error. + * The **`error()`** method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error) */ error(reason: any): void; } /** - * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream. + * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream. It allows control of the state and internal queue of a ReadableStream with an underlying byte source, and enables efficient zero-copy transfer of data from the underlying source to a consumer when the stream's internal queue is empty. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController) */ declare abstract class ReadableByteStreamController { /** - * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests. + * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest) */ get byobRequest(): ReadableStreamBYOBRequest | null; /** - * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its 'desired size'. + * 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) */ @@ -2423,7 +2441,7 @@ declare abstract class ReadableByteStreamController { */ close(): void; /** - * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues). + * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is transferred into the stream's internal queues). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue) */ @@ -2436,7 +2454,7 @@ declare abstract class ReadableByteStreamController { error(reason: any): void; } /** - * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state. + * The **`WritableStreamDefaultController`** interface of the Streams API 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. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController) */ @@ -2448,7 +2466,7 @@ declare abstract class WritableStreamDefaultController { */ get signal(): AbortSignal; /** - * The **`error()`** method of the with the associated stream to error. + * The **`error()`** method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error) */ @@ -2473,7 +2491,7 @@ declare abstract class TransformStreamDefaultController { */ enqueue(chunk?: O): void; /** - * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream. + * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream. Any further interactions with it will fail with the given error message, and any chunks in the queue will be discarded. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error) */ @@ -2495,14 +2513,14 @@ interface ReadableWritablePair { writable: WritableStream; } /** - * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. + * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream) */ declare class WritableStream { constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy); /** - * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer. + * 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) */ @@ -2514,83 +2532,83 @@ declare class WritableStream { */ abort(reason?: any): Promise; /** - * The **`close()`** method of the WritableStream interface closes the associated stream. + * The **`close()`** method of the WritableStream interface closes the associated stream. All chunks written before this method is called are sent before the returned promise is fulfilled. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close) */ close(): Promise; /** - * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. + * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance. While the stream is locked, no other writer can be acquired until this one is released. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter) */ getWriter(): WritableStreamDefaultWriter; } /** - * 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. + * 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); /** - * The **`closed`** read-only property of the the stream errors or the writer's lock is released. + * The **`closed`** read-only property of the WritableStreamDefaultWriter interface returns a Promise that fulfills if the stream becomes closed, or rejects if the stream errors or the writer's lock is released. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed) */ get closed(): Promise; /** - * 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. + * The **`ready`** read-only property of the WritableStreamDefaultWriter interface returns a Promise 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; /** - * The **`desiredSize`** read-only property of the to fill the stream's internal queue. + * The **`desiredSize`** read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize) */ get desiredSize(): number | null; /** - * 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. + * The **`abort()`** method of the WritableStreamDefaultWriter 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/WritableStreamDefaultWriter/abort) */ abort(reason?: any): Promise; /** - * The **`close()`** method of the stream. + * The **`close()`** method of the WritableStreamDefaultWriter interface closes the associated writable stream. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close) */ close(): Promise; /** - * The **`write()`** method of the operation. + * The **`write()`** method of the WritableStreamDefaultWriter interface writes a passed chunk of data to a WritableStream and its underlying sink, then returns a Promise that resolves to indicate the success or failure of the write operation. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write) */ write(chunk?: W): Promise; /** - * The **`releaseLock()`** method of the corresponding stream. + * The **`releaseLock()`** method of the WritableStreamDefaultWriter interface releases the writer's lock on the corresponding stream. After the lock is released, the writer is no longer active. If the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock) */ releaseLock(): void; } /** - * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept. + * 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); /** - * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`. + * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this TransformStream. This stream emits the transformed output data. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable) */ get readable(): ReadableStream; /** - * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`. + * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this TransformStream. This stream accepts input data that will be transformed and emitted to the readable stream. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable) */ @@ -2609,7 +2627,7 @@ interface ReadableStreamValuesOptions { preventCancel?: boolean; } /** - * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data. + * The **`CompressionStream`** interface of the Compression Streams API compresses a stream of data. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) */ @@ -2617,7 +2635,7 @@ declare class CompressionStream extends TransformStream { get encoding(): string; } /** - * 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. + * 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. It is the streaming equivalent of TextDecoder. It implements the same shape as a TransformStream, allowing it to be used in ReadableStream.pipeThrough() and similar methods. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream) */ @@ -2783,6 +2801,12 @@ interface TraceLog { readonly timestamp: number; readonly level: string; readonly message: any; + readonly errorInfo?: (TraceLogErrorInfo | null)[]; +} +interface TraceLogErrorInfo { + name: string; + message: string; + stack?: string; } interface TraceException { readonly timestamp: number; @@ -2803,7 +2827,7 @@ interface UnsafeTraceMetrics { fromTrace(item: TraceItem): TraceMetrics; } /** - * The **`URL`** interface is used to parse, construct, normalize, and encode URL. + * The **`URL`** interface is used to parse, construct, normalize, and encode URLs. It works by providing properties which allow you to easily read and modify the components of a URL. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL) */ @@ -2828,121 +2852,121 @@ declare class URL { */ set href(value: string); /** - * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`. + * 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; /** - * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`. + * 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); /** - * The **`username`** property of the URL interface is a string containing the username component of the URL. + * The **`username`** property of the URL interface is a string containing the username component of the URL. If the URL does not have a username, this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */ get username(): string; /** - * The **`username`** property of the URL interface is a string containing the username component of the URL. + * The **`username`** property of the URL interface is a string containing the username component of the URL. If the URL does not have a username, this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */ set username(value: string); /** - * The **`password`** property of the URL interface is a string containing the password component of the URL. + * The **`password`** property of the URL interface is a string containing the password component of the URL. If the URL does not have a password, this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */ get password(): string; /** - * The **`password`** property of the URL interface is a string containing the password component of the URL. + * The **`password`** property of the URL interface is a string containing the password component of the URL. If the URL does not have a password, this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */ set password(value: string); /** - * 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. + * The **`host`** property of the URL interface is a string containing the host, which is the hostname, and then, if the port of the URL is nonempty, a ":", followed by the port of the URL. If the URL does not have a hostname, this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */ get host(): string; /** - * 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. + * The **`host`** property of the URL interface is a string containing the host, which is the hostname, and then, if the port of the URL is nonempty, a ":", followed by the port of the URL. If the URL does not have a hostname, this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */ set host(value: string); /** - * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. + * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. If the URL does not have a hostname, this property contains an empty string, "". IPv4 and IPv6 addresses are normalized, such as stripping leading zeros, and domain names are converted to IDN. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */ get hostname(): string; /** - * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. + * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL. If the URL does not have a hostname, this property contains an empty string, "". IPv4 and IPv6 addresses are normalized, such as stripping leading zeros, and domain names are converted to IDN. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */ set hostname(value: string); /** - * The **`port`** property of the URL interface is a string containing the port number of the URL. + * The **`port`** property of the URL interface is a string containing the port number of the URL. If the port is the default for the protocol (80 for ws: and http:, 443 for wss: and https:, and 21 for ftp:), this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */ get port(): string; /** - * The **`port`** property of the URL interface is a string containing the port number of the URL. + * The **`port`** property of the URL interface is a string containing the port number of the URL. If the port is the default for the protocol (80 for ws: and http:, 443 for wss: and https:, and 21 for ftp:), this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */ set port(value: string); /** - * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. + * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of path segments, each of which is prefixed by a / character. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */ get pathname(): string; /** - * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. + * The **`pathname`** property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of path segments, each of which is prefixed by a / character. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */ set pathname(value: string); /** - * 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. + * 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. If the URL does not have a search query, this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */ get search(): string; /** - * 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. + * 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. If the URL does not have a search query, this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */ set search(value: string); /** - * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL. + * The **`hash`** property of the URL interface is a string containing a "#" followed by the fragment identifier of the URL. If the URL does not have a fragment identifier, this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */ get hash(): string; /** - * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL. + * The **`hash`** property of the URL interface is a string containing a "#" followed by the fragment identifier of the URL. If the URL does not have a fragment identifier, this property contains an empty string, "". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */ set hash(value: string); /** - * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL. + * The **`searchParams`** read-only property of the URL interface returns a URLSearchParams object allowing access to the GET decoded query arguments contained in the URL. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */ get searchParams(): URLSearchParams; /** - * 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. + * 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 URL.toString(). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */ @@ -2962,13 +2986,13 @@ declare class URL { */ static parse(url: string, base?: string): URL | null; /** - * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter. + * The **`createObjectURL()`** static method of the URL interface creates a string containing a blob URL pointing to the object given in the parameter. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static) */ static createObjectURL(object: File | Blob): string; /** - * 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. + * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL(). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static) */ @@ -3018,25 +3042,22 @@ declare class URLSearchParams { */ has(name: string, value?: string): boolean; /** - * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value. + * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set) */ set(name: string, value: string): void; /** - * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`. + * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns undefined. Key/value pairs are sorted by the values of the UTF-16 code units of the keys. This method uses a stable sorting algorithm (i.e., the relative order between key/value pairs with equal keys will be preserved). * * [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 ]>; - /* Returns a list of keys in the search params. */ keys(): IterableIterator; - /* Returns a list of values in the search params. */ values(): IterableIterator; forEach(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void; /*function toString() { [native code] }*/ @@ -3046,18 +3067,78 @@ declare class URLSearchParams { value: string ]>; } +/** + * The **`URLPattern`** interface of the URL Pattern API matches URLs or parts of URLs against a pattern. The pattern can contain capturing groups that extract parts of the matched URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern) + */ declare class URLPattern { constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions); + /** + * The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol) + */ get protocol(): string; + /** + * The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username) + */ get username(): string; + /** + * The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password) + */ get password(): string; + /** + * The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname) + */ get hostname(): string; + /** + * The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port) + */ get port(): string; + /** + * The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname) + */ get pathname(): string; + /** + * The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search) + */ get search(): string; + /** + * The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash) + */ get hash(): string; + /** + * The **`hasRegExpGroups`** read-only property of the URLPattern interface is a boolean indicating whether or not any of the URLPattern components contain regular expression capturing groups. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hasRegExpGroups) + */ get hasRegExpGroups(): boolean; + /** + * The **`test()`** method of the URLPattern interface takes a URL string or object of URL parts, and returns a boolean indicating if the given input matches the current pattern. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test) + */ test(input?: (string | URLPatternInit), baseURL?: string): boolean; + /** + * The **`exec()`** method of the URLPattern interface takes a URL or object of URL parts, and returns either an object containing the results of matching the URL to the pattern, or null if the URL does not match the pattern. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec) + */ exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null; } interface URLPatternInit { @@ -3090,7 +3171,7 @@ interface URLPatternOptions { ignoreCase?: boolean; } /** - * A `CloseEvent` is sent to clients using WebSockets when the connection is closed. + * 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. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent) */ @@ -3109,13 +3190,16 @@ declare class CloseEvent extends Event { */ readonly reason: string; /** - * The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly. + * 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) */ readonly wasClean: boolean; } interface CloseEventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; code?: number; reason?: string; wasClean?: boolean; @@ -3127,7 +3211,7 @@ type WebSocketEventMap = { error: ErrorEvent; }; /** - * 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. + * 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) */ @@ -3144,20 +3228,20 @@ declare var WebSocket: { readonly CLOSED: number; }; /** - * 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. + * 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(options?: WebSocketAcceptOptions): void; /** - * 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. + * 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. If the data can't be sent (for example, because it needs to be buffered but the buffer is full), the socket is closed automatically. The browser will throw an exception if you call send() when the connection is in the CONNECTING state. If you call send() when the connection is in the CLOSING or CLOSED states, the browser will silently discard the data. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send) */ send(message: (ArrayBuffer | ArrayBufferView) | string): void; /** - * The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing. + * The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close) */ @@ -3177,13 +3261,13 @@ interface WebSocket extends EventTarget { */ url: string | null; /** - * 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. + * 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; /** - * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server. + * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server. This is currently only the empty string or a list of extensions as negotiated by the connection. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions) */ @@ -3270,25 +3354,25 @@ interface SocketInfo { declare class EventSource extends EventTarget { constructor(url: string, init?: EventSourceEventSourceInit); /** - * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None. + * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the EventSource.readyState attribute to 2 (closed). * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close) */ close(): void; /** - * The **`url`** read-only property of the URL of the source. + * The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url) */ get url(): string; /** - * The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set. + * The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials) */ get withCredentials(): boolean; /** - * The **`readyState`** read-only property of the connection. + * The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState) */ @@ -3323,18 +3407,26 @@ interface ContainerExecOptions { cwd?: string; env?: Record; user?: string; + signal?: AbortSignal; + pty?: boolean | ContainerExecPtyOptions; stdin?: ReadableStream | "pipe"; stdout?: "pipe" | "ignore"; stderr?: "pipe" | "ignore" | "combined"; } +interface ContainerExecPtyOptions { + cols?: number; + rows?: number; +} interface ExecProcess { readonly stdin: WritableStream | null; readonly stdout: ReadableStream | null; readonly stderr: ReadableStream | null; readonly pid: number; + readonly isPty: boolean; readonly exitCode: Promise; output(): Promise; kill(signal?: number): void; + resize(cols: number, rows: number): void; } interface Container { get running(): boolean; @@ -3361,25 +3453,42 @@ interface ContainerDirectorySnapshotOptions { dir: string; name?: string; } -interface ContainerDirectorySnapshotRestoreParams { +type ContainerDirectorySnapshotRestoreParams = { snapshot: ContainerDirectorySnapshot; mountPoint?: string; -} +} | { + snapshot?: undefined; + mountPoint: string; +}; interface ContainerSnapshot { id: string; size: number; name?: string; } +interface ContainerSnapshotRestoreParams { + id: string; +} interface ContainerSnapshotOptions { name?: string; } -interface ContainerStartupOptions { +type ContainerStartupOptions = { entrypoint?: string[]; enableInternet: boolean; env?: Record; + instance?: "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | ContainerStartResources; labels?: Record; directorySnapshots?: ContainerDirectorySnapshotRestoreParams[]; - containerSnapshot?: ContainerSnapshot; +} & ({ + image: string; + containerSnapshot?: never; +} | { + image?: never; + containerSnapshot?: ContainerSnapshotRestoreParams; +}); +interface ContainerStartResources { + vcpu: number; + memoryMib: number; + diskMb: number; } /** * 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. @@ -3388,19 +3497,19 @@ interface ContainerStartupOptions { */ declare abstract class MessagePort extends EventTarget { /** - * The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts. + * The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, 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. + * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port. * * [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. + * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start) */ @@ -3416,13 +3525,13 @@ declare abstract class MessagePort extends EventTarget { declare class MessageChannel { constructor(); /** - * The **`port1`** read-only property of the the port attached to the context that originated the channel. + * The **`port1`** read-only property of the MessageChannel interface returns the first port of the message channel — 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. + * The **`port2`** read-only property of the MessageChannel interface returns the second port of the message channel — 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) */ @@ -3482,7 +3591,7 @@ interface WorkerLoaderModule { data?: ArrayBuffer; json?: any; py?: string; - wasm?: ArrayBuffer; + wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module; } interface WorkerLoaderWorkerCode { compatibilityDate: string; @@ -3490,7 +3599,7 @@ interface WorkerLoaderWorkerCode { allowExperimental?: boolean; limits?: workerdResourceLimits; mainModule: string; - modules: Record; + modules: Record; env?: any; globalOutbound?: (Fetcher | null); tails?: Fetcher[]; @@ -3512,7 +3621,7 @@ declare abstract class Performance { /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */ now(): number; /** - * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object. + * The **`toJSON()`** method of the Performance interface is a serializer; it returns a JSON representation of the Performance object. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON) */ @@ -3521,11 +3630,13 @@ declare abstract class Performance { interface Tracing { enterSpan(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T; startActiveSpan(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T; + startSpan(name: string): Span; Span: typeof Span; } declare abstract class Span { get isTraced(): boolean; - setAttribute(key: string, value?: (boolean | number | string)): void; + setAttribute(key: string, value: boolean | number | string): this; + setAttributes(attributes: Record): this; end(): void; } /** @@ -4165,6 +4276,13 @@ type AiSearchListItemsParams = { source?: string; /** JSON-encoded Vectorize filter for metadata filtering. */ metadata_filter?: string; + /** Filter items by their unique ID. Returns at most one item. */ + item_id?: string; + /** + * Filter items by their exact key (object key / filename). Keys are unique + * per source, so combine with `source` to disambiguate across data sources. + */ + key?: string; }; type AiSearchListItemsResponse = { result: AiSearchItemInfo[]; @@ -10062,6 +10180,163 @@ declare abstract class Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT { inputs: ChatCompletionsInput; postProcessedOutputs: ChatCompletionsOutput; } +declare abstract class Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_2 { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input { + /** + * Which Moondream skill to run. + */ + task?: "query" | "caption" | "point" | "detect"; + /** + * Input image as a public HTTPS URL or base64 data URI. Optional for `query`; required for `caption`, `point`, and `detect`. + */ + image?: string; + /** + * Question for the `query` task. + */ + question?: string; + /** + * Caption length for the `caption` task. + */ + caption_length?: "short" | "normal" | "long"; + /** + * Object phrase to locate for `point` and `detect` tasks (e.g. 'person wearing a red shirt'). + */ + target?: string; + /** + * Enable reasoning trace for the `query` task. + */ + reasoning?: boolean; + /** + * Sampling temperature. + */ + temperature?: number; + /** + * Top-p (nucleus) sampling. + */ + top_p?: number; + /** + * Max tokens to generate for `query` and `caption`. + */ + max_tokens?: number; + /** + * Max objects to return for `point` and `detect`. + */ + max_objects?: number; + /** + * Return incremental tokens for `query` and `caption`. `point` and `detect` do not support streaming. + */ + stream?: boolean; +} +interface Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output { + /** + * Reason the generation finished. + */ + finish_reason: string; + metrics: { + /** + * Number of input tokens consumed. + */ + input_tokens: number; + /** + * Number of output tokens generated. + */ + output_tokens: number; + /** + * Prefill time in milliseconds. + */ + prefill_time_ms: number; + /** + * Decode time in milliseconds. + */ + decode_time_ms: number; + /** + * Time to first token in milliseconds. + */ + ttft_ms: number; + }; + /** + * Answer text for the `query` task. Null for other tasks. + */ + answer?: string; + /** + * Caption text for the `caption` task. Null for other tasks. + */ + caption?: string; + /** + * Located points for the `point` task. Null for other tasks. + */ + points?: { + /** + * X coordinate. + */ + x: number; + /** + * Y coordinate. + */ + y: number; + }[]; + /** + * Detected bounding boxes for the `detect` task. Null for other tasks. + */ + objects?: { + /** + * Minimum X coordinate. + */ + x_min: number; + /** + * Minimum Y coordinate. + */ + y_min: number; + /** + * Maximum X coordinate. + */ + x_max: number; + /** + * Maximum Y coordinate. + */ + y_max: number; + }[]; + /** + * Reasoning trace for the `query` task when reasoning=true. Null otherwise. + */ + reasoning?: { + /** + * Reasoning text. + */ + text: string; + /** + * Grounding information. + */ + grounding?: {}[]; + }; +} +declare abstract class Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B { + inputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Input; + postProcessedOutputs: Ai_Cf_Moondream_Moondream3_1_9B_A2B_Output; +} +declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731 { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813 { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Qwen_Qwen3_8_27B { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} +declare abstract class Base_Ai_Cf_Zai_Org_Glm_5_3_Flash { + inputs: ChatCompletionsInput; + postProcessedOutputs: ChatCompletionsOutput; +} interface AiModels { "@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification; "@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage; @@ -10154,6 +10429,13 @@ interface AiModels { "@cf/moonshotai/kimi-k2.6": Base_Ai_Cf_Moonshotai_Kimi_K2_6; "@cf/nvidia/nemotron-3-120b-a12b": Base_Ai_Cf_Nvidia_Nemotron_3_120B_A12B; "@cf/google/gemma-4-26b-a4b-it": Base_Ai_Cf_Google_Gemma_4_26B_A4B_IT; + "@cf/moonshotai/kimi-k2.7-code": Base_Ai_Cf_Moonshotai_Kimi_K2_7_Code; + "@cf/zai-org/glm-5.2": Base_Ai_Cf_Zai_Org_Glm_5_2; + "@cf/moondream/moondream3.1-9B-A2B": Base_Ai_Cf_Moondream_Moondream3_1_9B_A2B; + "@cf/deepseek-ai/deepseek-v4-flash-0731": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Flash_0731; + "@cf/deepseek-ai/deepseek-v4-pro-0813": Base_Ai_Cf_Deepseek_Ai_Deepseek_V4_Pro_0813; + "@cf/qwen/qwen3.8-27b": Base_Ai_Cf_Qwen_Qwen3_8_27B; + "@cf/zai-org/glm-5.3-flash": Base_Ai_Cf_Zai_Org_Glm_5_3_Flash; } type AiOptions = { /** @@ -10903,10 +11185,29 @@ type BrowserRunLinksOptions = BrowserRunCommonOptions & { /** When true, exclude links pointing to external domains. @default false */ excludeExternalLinks?: boolean; }; +type BrowserRunSnapshotFormat = 'content' | 'screenshot' | 'markdown' | 'accessibilityTree'; type BrowserRunSnapshotOptions = BrowserRunCommonOptions & { + /** Which representations of the page to return. At least two distinct formats + * are required; request a single format from its dedicated action instead. + * @default ["content","screenshot"] + */ + formats?: BrowserRunSnapshotFormat[]; /** @see https://pptr.dev/api/puppeteer.screenshotoptions */ screenshotOptions?: Omit; }; +/** Options for the `accessibilityTree` quick action. */ +type BrowserRunAccessibilityTreeOptions = BrowserRunCommonOptions & { + /** When true, prune nodes that carry no semantic meaning, such as generic + * containers. Defaults to true, or to false when `root` is set so that the + * requested subtree is returned as-is. + */ + interestingOnly?: boolean; + /** CSS selector limiting the tree to the matching element's subtree. + * A selector that matches nothing yields `accessibilityTree: null` with + * HTTP 200; a malformed selector is an error. + */ + root?: string; +}; interface BrowserRunJsonBaseOptions { /** Custom AI models to try in order. Max 3. Falls back to next on error. */ custom_ai?: Array<{ @@ -10933,12 +11234,78 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions }); type BrowserRunContentOptions = BrowserRunCommonOptions; type BrowserRunMarkdownOptions = BrowserRunCommonOptions; +type BrowserRunRedirectHop = { + /** URL that returned the redirect. */ + url: string; + /** HTTP status of the redirect. */ + status: number; + /** Redirect response headers, including `location`. */ + headers: Record; +}; type BrowserRunResponseMeta = { /** HTTP status code of the rendered page */ status: number; /** Page title */ title: string; -}; + /** Origin response headers, lowercased. Repeated headers are joined with a newline. Credential and transport-only headers that do not survive rendering are omitted. */ + headers?: Record; + /** URL that served the response, after any redirects the browser followed. */ + finalUrl?: string; + /** HTTP redirects followed to reach `finalUrl`, oldest first. Omitted for direct navigation and for client-side redirects such as meta refresh. An empty array means redirects occurred but their intermediate responses could not be read. */ + redirectChain?: BrowserRunRedirectHop[]; +}; +/** + * A node in the page's accessibility tree, as exposed to assistive technology. + * `role` is the only field always present; the rest are populated when the + * underlying element defines them. + * @see https://pptr.dev/api/puppeteer.serializedaxnode + */ +interface BrowserRunSerializedAXNode { + /** The ARIA role, e.g. `"button"`, `"heading"`, `"RootWebArea"`. */ + role: string; + /** The `aria-autocomplete` value. */ + autocomplete?: string; + /** Checked state of a checkbox, radio, or menu item. */ + checked?: boolean | 'mixed'; + /** Accessible description, typically from `aria-describedby` or `title`. */ + description?: string; + disabled?: boolean; + expanded?: boolean; + /** Whether the element currently holds keyboard focus. */ + focused?: boolean; + /** The kind of popup the element triggers, e.g. `"menu"`, `"dialog"`. */ + haspopup?: string; + /** The `aria-invalid` value. */ + invalid?: string; + /** Keyboard shortcuts bound to the element, from `aria-keyshortcuts`. */ + keyshortcuts?: string; + /** Hierarchical level, e.g. the heading level of an `

`. */ + level?: number; + /** Whether the element is a modal dialog. */ + modal?: boolean; + /** Whether a text input accepts multiple lines. */ + multiline?: boolean; + /** Whether more than one option can be selected. */ + multiselectable?: boolean; + /** Accessible name, e.g. a button's label or an image's alt text. */ + name?: string; + orientation?: string; + /** Pressed state of a toggle button. */ + pressed?: boolean | 'mixed'; + readonly?: boolean; + required?: boolean; + /** Author-supplied role description, from `aria-roledescription`. */ + roledescription?: string; + selected?: boolean; + /** Current value of an input or range element. */ + value?: string | number; + valuemax?: number; + valuemin?: number; + /** Human-readable form of `value`, from `aria-valuetext`. */ + valuetext?: string; + /** Child nodes. Absent for leaf nodes. */ + children?: BrowserRunSerializedAXNode[]; +} /** Success response for `content` action. */ type BrowserRunContentSuccessResponse = { success: true; @@ -10951,6 +11318,7 @@ type BrowserRunLinksSuccessResponse = { success: true; /** Extracted links */ result: string[]; + meta: BrowserRunResponseMeta; }; /** Success response for `scrape` action. */ type BrowserRunScrapeSuccessResponse = { @@ -10981,15 +11349,33 @@ type BrowserRunScrapeSuccessResponse = { }>; }>; }>; + meta: BrowserRunResponseMeta; }; -/** Success response for `snapshot` action. */ +/** Success response for `snapshot` action. Each field is present only when the + * corresponding entry was requested in `formats`. + */ type BrowserRunSnapshotSuccessResponse = { success: true; result: { /** HTML content of the page. */ - content: string; + content?: string; /** Base64-encoded screenshot image. */ - screenshot: string; + screenshot?: string; + /** Markdown content. Prefixed with YAML frontmatter (e.g. `title`) when the + * page provides that metadata. + */ + markdown?: string; + /** Root of the page's accessibility tree. */ + accessibilityTree?: BrowserRunSerializedAXNode; + }; + meta: BrowserRunResponseMeta; +}; +/** Success response for `accessibilityTree` action. */ +type BrowserRunAccessibilityTreeSuccessResponse = { + success: true; + result: { + /** Root of the accessibility tree, or `null` when `root` matched no element. */ + accessibilityTree: BrowserRunSerializedAXNode | null; }; meta: BrowserRunResponseMeta; }; @@ -10998,12 +11384,14 @@ type BrowserRunJsonSuccessResponse = { success: true; /** JSON data extracted from the page using an AI model */ result: Record; + meta: BrowserRunResponseMeta; }; /** Success response for `markdown` action. */ type BrowserRunMarkdownSuccessResponse = { success: true; /** Extracted markdown content */ result: string; + meta: BrowserRunResponseMeta; }; /** Error response for BrowserRun actions. */ type BrowserRunErrorResponse = { @@ -11113,9 +11501,10 @@ declare abstract class BrowserRun { */ quickAction(action: 'links', options: BrowserRunLinksOptions): Promise; /** - * Get both the HTML content and a base64-encoded screenshot of a web page. + * Get several representations of a web page in one request. * @param action - Must be `'snapshot'`. - * @param options - Snapshot options including screenshot settings (encoding is always base64). + * @param options - Snapshot options including the `formats` to return and + * screenshot settings (encoding is always base64). * @returns A `Response` containing one of: * * **Success (HTTP 200):** @@ -11163,6 +11552,26 @@ declare abstract class BrowserRun { * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500) */ quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise; + /** + * Get the accessibility tree of a web page. + * @param action - Must be `'accessibilityTree'`. + * @param options - Options to scope the tree to a subtree and to control + * whether semantically uninteresting nodes are pruned. + * @returns A `Response` containing one of: + * + * **Success (HTTP 200):** + * - `BrowserRunAccessibilityTreeSuccessResponse` JSON with `Content-Type: application/json` + * - `result.accessibilityTree` is `null` when `root` matched no element + * + * **Error:** + * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503) + * - HTTP 422 for a malformed `root` selector + * - HTTP 500 with code `2017` or `2018` when the tree could not be built + * + * **Headers:** + * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500) + */ + quickAction(action: 'accessibilityTree', options: BrowserRunAccessibilityTreeOptions): Promise; } /** * In addition to the properties you can set in the RequestInit dict @@ -12453,6 +12862,15 @@ interface Hyperdrive { * for your database. */ readonly host: string; + /* + * A synthetic IPv4 address (in the reserved 240.0.0.0/4 range) that, like the + * host field, is only valid within the context of the currently running + * Worker and, when passed into the `connect()` function from the + * "cloudflare:sockets" module, will connect to the Hyperdrive instance for + * your database. This is provided for database drivers that require the host + * to be an IP literal rather than a hostname. + */ + readonly ip: string; /* * The port that must be paired the the host field when connecting. */ @@ -12485,6 +12903,27 @@ type ImageInfoResponse = { width: number; height: number; }; +/** + * Parameters for rasterizing text into an image. + */ +type TextRasterize = { + /** The text content to render */ + content: string; + /** rasterization options for the text **/ + options: TextOptions; +}; +type TextOptions = { + /** Font configuration */ + font: { + /** URL to a font file in TrueType (.ttf), OpenType (.otf), WOFF (.woff), or WOFF2 (.woff2) format */ + url: string; + }; + /** Font size in points (pt) */ + size?: number; + /** Text color in CSS format: hex (#RRGGBB or #RRGGBBAA), rgb(r,g,b), rgba(r,g,b,a), or named colors */ + color?: string; +}; +type ImageSource = ReadableStream | TextRasterize; type ImageTransform = { width?: number; height?: number; @@ -12574,6 +13013,9 @@ interface ImageUploadOptions { requireSignedURLs?: boolean; metadata?: Record; creator?: string; + /** + * If 'base64', the input data will be decoded from base64 before processing + */ encoding?: 'base64'; } interface ImageUpdateOptions { @@ -12581,11 +13023,40 @@ interface ImageUpdateOptions { metadata?: Record; creator?: string; } +type ImageMetadataFilterOperators = { + eq?: string | number | boolean; + in?: string[] | number[]; + gt?: number; + gte?: number; + lt?: number; + lte?: number; +}; +type ImageMetadataFilterValue = string | number | boolean | ImageMetadataFilterOperators; +interface ImageListFilter { + metadata?: Record; +} interface ImageListOptions { limit?: number; cursor?: string; sortOrder?: 'asc' | 'desc'; creator?: string; + filter?: ImageListFilter; +} +interface ImageSignedUrlOptions { + variant: string; + expiresIn?: number; + keyName?: string; +} +interface ImageDirectUploadOptions { + id?: string; + requireSignedURLs?: boolean; + metadata?: Record; + creator?: string; + expiresIn?: number; +} +interface ImageDirectUploadResult { + id: string; + uploadURL: string; } interface ImageList { images: ImageMetadata[]; @@ -12603,6 +13074,13 @@ interface ImageHandle { * @returns ReadableStream of image bytes, or null if not found */ bytes(): Promise | null>; + /** + * Generate a signed delivery URL for this hosted image. + * @param options Signing configuration + * @returns A signed image delivery URL + * @throws {@link ImagesError} if signing fails + */ + signedUrl(options: ImageSignedUrlOptions): Promise; /** * Update hosted image metadata * @param options Properties to update @@ -12638,6 +13116,14 @@ interface HostedImagesBinding { * @throws {@link ImagesError} if list fails */ list(options?: ImageListOptions): Promise; + /** + * Create a Direct Creator Upload link, letting an end user upload an + * image straight to Cloudflare without exposing an API token + * @param options Upload link configuration + * @returns The new image ID and the upload URL to hand to the end user + * @throws {@link ImagesError} if creation fails + */ + createDirectUpload(options?: ImageDirectUploadOptions): Promise; } interface ImagesBinding { /** @@ -12652,6 +13138,13 @@ interface ImagesBinding { * @returns A transform handle */ input(stream: ReadableStream, options?: ImageInputOptions): ImageTransformer; + /** + * Begin applying a series of transformations to text + * @param content string to be rendered + * @param options font, optional color and size to use in rendering text + * @returns A transform handle + */ + text(content: string, options: TextOptions): ImageTransformer; /** * Access hosted images CRUD operations */ @@ -12681,11 +13174,15 @@ interface ImageTransformer { type ImageTransformationOutputOptions = { encoding?: 'base64'; }; +type ImageTransformationResponseOptions = { + headers?: HeadersInit; +}; interface ImageTransformationResult { /** * The image as a response, ready to store in cache or return to users + * @param options Options that apply to the returned response, e.g. additional headers */ - response(): Response; + response(options?: ImageTransformationResponseOptions): Response; /** * The content type of the returned image */ @@ -13139,6 +13636,26 @@ declare namespace CloudflareWorkersModule { timeout?: WorkflowTimeoutDuration | number; sensitive?: WorkflowStepSensitivity; }; + // Internal discriminators used only for `WorkflowStep.do` overload + // resolution. They mirror `WorkflowStepConfig` but pin `retries.delay` to a + // single kind so the callback context can be narrowed based on the shape of + // the config argument (rather than on an inferred type parameter, which is + // lost when the caller supplies an explicit return-type argument). Not + // exported: they must not widen the public type surface. + type WorkflowStepConfigWithStaticDelay = Omit & { + retries?: { + limit: number; + delay: WorkflowDelayDuration | number; + backoff?: WorkflowBackoff; + }; + }; + type WorkflowStepConfigWithDelayFunction = Omit & { + retries: { + limit: number; + delay: WorkflowDelayFunction; + backoff?: WorkflowBackoff; + }; + }; export type WorkflowStepRollbackConfig = Pick; export type WorkflowCronSchedule = { /** Cron expression that triggered this event. */ @@ -13176,23 +13693,35 @@ declare namespace CloudflareWorkersModule { sensitive?: WorkflowStepSensitivity; }; }; - export type WorkflowRollbackContext = { - ctx: WorkflowStepContext; + // The rollback handler receives the step context, so it mirrors the same + // delay discriminant as the step callback: when the step was configured with + // a dynamic delay function the resolved `config.retries.delay` is omitted, + // otherwise it is present. `Delay` is threaded from the `WorkflowStep.do` + // overload that matched the step config. + export type WorkflowRollbackContext = { + ctx: WorkflowStepContext; error: Error; output: T | undefined; /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */ stepName: string; }; - export type WorkflowRollbackHandler = (ctx: WorkflowRollbackContext) => Promise; - export type WorkflowStepRollbackOptions = { - rollback: WorkflowRollbackHandler; + export type WorkflowRollbackHandler = (ctx: WorkflowRollbackContext) => Promise; + export type WorkflowStepRollbackOptions = { + rollback: WorkflowRollbackHandler; rollbackConfig?: WorkflowStepRollbackConfig; }; export abstract class WorkflowStep { do>(name: string, callback: (ctx: WorkflowStepContext) => Promise, rollbackOptions?: WorkflowStepRollbackOptions): Promise; - do, const C extends WorkflowStepConfig>(name: string, config: C, callback: (ctx: WorkflowStepContext) => Promise, rollbackOptions?: WorkflowStepRollbackOptions): Promise; + // The config overloads discriminate on the shape of `config.retries.delay` + // so the callback context reflects whether the resolved delay is present + // (static delay) or omitted (dynamic delay function). Each has a single + // type parameter, so an explicit return-type argument (`do(...)`) still + // resolves here. ORDERING IS LOAD-BEARING: the broad `WorkflowStepConfig` + // fallback MUST remain last, otherwise it shadows the discriminating + // overloads and narrowing is silently lost. + do>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext) => Promise, rollbackOptions?: WorkflowStepRollbackOptions): Promise; + do>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext) => Promise, rollbackOptions?: WorkflowStepRollbackOptions): Promise; + do>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise, rollbackOptions?: WorkflowStepRollbackOptions): Promise; sleep: (name: string, duration: WorkflowSleepDuration) => Promise; sleepUntil: (name: string, timestamp: Date | number) => Promise; waitForEvent>(name: string, options: { @@ -13967,11 +14496,12 @@ type MarkdownDocument = { name: string; blob: Blob; }; +type OutputFormat = 'markdown' | 'text'; type ConversionResponse = { id: string; name: string; mimeType: string; - format: 'markdown'; + format: OutputFormat; tokens: number; data: string; } | { @@ -13988,7 +14518,11 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & { convert?: boolean; maxConvertedImages?: number; }; +type ConversionOutputOptions = { + format?: OutputFormat; +}; type ConversionOptions = { + output?: ConversionOutputOptions; html?: { images?: EmbeddedImageConversionOptions & { convertOGImage?: boolean; @@ -14083,7 +14617,7 @@ declare namespace TailStream { interface ConnectEventInfo { readonly type: "connect"; } - type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime"; + type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime" | "aborted"; interface ScriptVersion { readonly id: string; readonly tag?: string; @@ -14137,11 +14671,22 @@ declare namespace TailStream { readonly message: string; readonly stack?: string; } - interface Log { + interface TailStreamErrorInfo { + readonly name: string; + readonly message: string; + readonly stack?: string; + } + type Log = { readonly type: "log"; readonly level: "debug" | "error" | "info" | "log" | "warn"; + readonly errorInfo?: readonly (TailStreamErrorInfo | null)[]; + } & ({ readonly message: object; - } + readonly truncated?: false; + } | { + readonly message: string; + readonly truncated: true; + }); interface DroppedEventsDiagnostic { readonly diagnosticsType: "droppedEvents"; readonly count: number; @@ -14619,10 +15164,31 @@ declare abstract class Workflow { * @returns A promise that resolves with a list of handles for the created instances. */ public createBatch(batch: WorkflowInstanceCreateOptions[]): Promise; + /** + * Delete a batch of Workflow instances and their stored state. + * `deleteBatch` is limited to 100 instances at a time. Duplicate IDs are deleted once. + * The result contains one entry for each input position; IDs that do not exist are returned as per-instance errors. + * @param instanceIds IDs of the Workflow instances to delete + * @returns A promise that resolves with the successfully deleted instances and any per-instance errors. + */ + public deleteBatch(instanceIds: string[]): Promise; } +type WorkflowBatchDeleteResult = { + deleted: { + id: string; + }[]; + errors: { + id: string; + code: number; + message: string; + }[]; +}; type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number; type WorkflowRetentionDuration = WorkflowSleepDuration; +/** Geographic regions supported when creating a Workflow instance. + * Location hints are best-effort placement preferences. */ +type WorkflowInstanceLocationHint = 'wnam' | 'enam' | 'sam' | 'weur' | 'eeur' | 'apac' | 'apac-ne' | 'apac-se' | 'oc' | 'afr' | 'me'; interface WorkflowInstanceCreateOptions { /** * An id for your Workflow instance. Must be unique within the Workflow. @@ -14640,6 +15206,9 @@ interface WorkflowInstanceCreateOptions { successRetention?: WorkflowRetentionDuration; errorRetention?: WorkflowRetentionDuration; }; + /** A best-effort geographic placement preference for the Workflow instance. + * See `WorkflowInstanceLocationHint` for supported regions. */ + locationHint?: WorkflowInstanceLocationHint; } type InstanceStatus = { status: 'queued' // means that instance is waiting to be started (see concurrency limits) @@ -14706,6 +15275,10 @@ declare abstract class WorkflowInstance { * @param options Options for the restart, including an optional step to restart from. */ public restart(options?: WorkflowInstanceRestartOptions): Promise; + /** + * Delete the instance and its stored state. + */ + public delete(): Promise; /** * Returns the current status of the instance. */ From 36bb24e42331ecf5aacb558d9f616e4ec39ca05d Mon Sep 17 00:00:00 2001 From: Adam Daley Date: Tue, 1 Sep 2026 06:03:42 +0100 Subject: [PATCH 2/2] Update OpenAPI doc paths to /docs/openapi.json Correct the OpenAPI document URL from `//openapi.json` to `//docs/openapi.json` across READMEs and tests. --- README.md | 2 +- src/services/extensions/v2/README.md | 2 +- src/services/previews/v1/README.md | 2 +- test/services/extensions/v2/index.test.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7a90edd..f3b94f6 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Each service documents its own endpoints and behaviour: | Extensions | `/extensions/v1`, `/extensions/v2` | [`src/services/extensions/v2/README.md`](src/services/extensions/v2/README.md) | | Previews | `/previews/v1` | [`src/services/previews/v1/README.md`](src/services/previews/v1/README.md) | -Extensions v2 and Previews v1 also publish a live OpenAPI document (`/extensions/v2/openapi.json`, `/previews/v1/openapi.json`) and a reference UI (`/extensions/v2/docs`, `/previews/v1/docs`). +Extensions v2 and Previews v1 also publish a live OpenAPI document (`/extensions/v2/docs/openapi.json`, `/previews/v1/docs/openapi.json`) and a reference UI (`/extensions/v2/docs`, `/previews/v1/docs`). ## Configuration diff --git a/src/services/extensions/v2/README.md b/src/services/extensions/v2/README.md index 8cc1f4f..3a2d688 100644 --- a/src/services/extensions/v2/README.md +++ b/src/services/extensions/v2/README.md @@ -10,7 +10,7 @@ This service owns the complete Extensions domain and its `DB_EXTENSIONS` schema: Endpoints are not listed here. The service publishes its own contract: -- **OpenAPI document:** `GET /extensions/v2/openapi.json` +- **OpenAPI document:** `GET /extensions/v2/docs/openapi.json` - **Reference UI:** `GET /extensions/v2/docs` ## The Extension Lifecycle diff --git a/src/services/previews/v1/README.md b/src/services/previews/v1/README.md index 5cbb4d1..e8152da 100644 --- a/src/services/previews/v1/README.md +++ b/src/services/previews/v1/README.md @@ -26,7 +26,7 @@ it only resolves and redirects. Endpoints are not listed here. The service publishes its own contract: -- **OpenAPI document:** `GET /previews/v1/openapi.json` +- **OpenAPI document:** `GET /previews/v1/docs/openapi.json` - **Reference UI:** `GET /previews/v1/docs` ## Resource Model diff --git a/test/services/extensions/v2/index.test.ts b/test/services/extensions/v2/index.test.ts index 7522ad9..9cfe51c 100644 --- a/test/services/extensions/v2/index.test.ts +++ b/test/services/extensions/v2/index.test.ts @@ -12,7 +12,7 @@ setupExtensionsV2Tests(); describe("Extensions API v2", () => { describe("OpenAPI docs", () => { it("serves a generated OpenAPI document", async () => { - const res = await get("/extensions/v2/openapi.json", {}); + const res = await get("/extensions/v2/docs/openapi.json", {}); expect(res.status).toBe(200); const spec = (await res.json()) as { openapi: string;