This commit is contained in:
Devin Zuczek
2026-10-05 15:05:33 -04:00
parent 16e5f61160
commit 6baef870b2
37 changed files with 5383 additions and 1559 deletions
+6 -5
View File
@@ -24,11 +24,12 @@ RECFLARE_DOMAIN=rec.example.com
# spliced in at deploy time. Required to deploy any worker that uses D1.
# RECFLARE_D1=d44083e1-5bfe-4467-aa9a-f13c5c2496d5
# KV namespace ids, as a compact JSON object keyed by binding name. Each namespace
# is distinct (create with `wrangler kv namespace create <BINDING>`). Kept out of
# the committed wrangler.jsonc (which uses "local" placeholders) and spliced in at
# deploy time. Required to deploy any worker with the matching KV binding.
# RECFLARE_KV='{"RECFLARE_MATCH_PRESENCE":"9f53f04b7dd244658d59f515a14748b6","RECFLARE_PLAYER_SETTINGS":"d33a90014e904b0eac720bddcbe0b036"}'
# KV namespace ids, as a compact JSON object keyed by binding name. No worker binds a KV
# namespace any more (player settings moved into the D1 `player_settings` table), so a
# fresh deployment leaves this unset. A deployment that predates the move keeps its old
# RECFLARE_PLAYER_SETTINGS id here until `just settings-import-kv --remote` has copied the
# namespace into D1 (see CLI.md); then delete the namespace and this line.
# RECFLARE_KV='{"RECFLARE_PLAYER_SETTINGS":"d33a90014e904b0eac720bddcbe0b036"}'
# Id of the shared Secrets Store that holds the `JWT_SECRET` signing key (create it
# with `wrangler secrets-store store create recflare --scopes workers`). Every
+25 -1
View File
@@ -157,6 +157,30 @@ script names every item the storefront doesn't list. The
committed `2025-1-cai.json` is already priced. Rarity isn't carried over, since the record
has no field for it.
### `settings-import-kv` — copy the old player-settings KV namespace into D1
```sh
bun runx admin settings-import-kv --dry-run --remote # count what the namespace holds
bun runx admin settings-import-kv --remote
bun runx admin settings-import-kv --remote --namespace-id <id> --overwrite
just settings-import-kv --remote # the same, as a recipe
```
Player settings used to live in a Workers KV namespace (`RECFLARE_PLAYER_SETTINGS`, one
`player:<id>` key per player holding their map as JSON); they now live in the
`player_settings` table on the shared D1, one JSON row per player. This copies the namespace
across for a deployment that predates the move. The namespace id comes from
`RECFLARE_PLAYER_SETTINGS` in `RECFLARE_KV` in `.env` (which the deploys used to read it from)
or from `--namespace-id`.
Upgrade in this order: `just migrate -F playersettings` (creates the table), then this
import, then `just deploy`. The import MERGES: a row that already exists keeps every key it
has and gains the ones only KV knew, so running it after the cut-over — or again — never
undoes something a player has toggled since. `--overwrite` makes the KV value win instead.
Nothing is deleted on either side. Keys that aren't a `player:<id>` holding a JSON object of
strings are reported and skipped. Once it has run, the namespace (and the `RECFLARE_KV` line)
can be deleted.
### `lookup` — print an account
```sh
@@ -171,7 +195,7 @@ the account has a password, the developer role, and the moderator role.
### Selecting an account
Every command except `reload-plus` and `cai-load` targets exactly one account, by **either**:
Every command except `reload-plus`, `cai-load` and `settings-import-kv` targets exactly one account, by **either**:
- `--account <id>` — numeric account id
- `--username <name>` — username (case-insensitive)
+9 -7
View File
@@ -23,7 +23,6 @@ These are the instructions for deploying the RecFlare infrastructure to Cloudfla
well, we'll cross that bridge when we get to it.
- D1 (a SQLite-compatible distributed database)
- R2 (service like S3 for mass file hosting)
- KV (service to distributed offer key/value stores)
- Durable Objects (for a notifications hub)
## Do I have to use Cloudflare?
@@ -34,12 +33,12 @@ AWS, Vercel, Netlify, Fly.io, a plain Node/Bun server, and so on.
Long answer: the catch is everything _around_ the code. RecFlare leans on Cloudflare for the
deployment (Wrangler) and infrastructure layer — custom-domain routing per service, plus the
storage bindings (D1, KV, R2, Durable Objects) the workers use. On another
storage bindings (D1, R2, Durable Objects) the workers use. On another
provider you'll need to provide equivalents (per-service routing, databases,
object storage, a pub/sub or WebSocket layer) and wire up the deployment yourself.
So for example if you wanted to run on Vercel, you'd have to swap out KV for Redis, which are very similar
services but would require small code changes.
So for example if you wanted to run on Vercel, you'd have to swap out D1 for another SQLite-compatible
database (Turso, say) and R2 for S3, which are very similar services but would require small code changes.
## Prerequisites
@@ -107,12 +106,15 @@ nothing in version control needs editing. Authenticate wrangler first
```bash
wrangler d1 create recflare
wrangler kv namespace create RECFLARE_MATCH_PRESENCE
wrangler kv namespace create RECFLARE_PLAYER_SETTINGS
wrangler secrets-store store create recflare --scopes workers
```
Take the IDs output from the commands and put them into `.env`. (or with CI: `RECFLARE_KV='{"RECFLARE_MATCH_PRESENCE":"<id>","RECFLARE_PLAYER_SETTINGS":"<id>"}'`)
Take the IDs output from the commands and put them into `.env` (`RECFLARE_D1` and
`RECFLARE_SECRETS_STORE`; in CI, export the same names as secrets).
> Upgrading a deployment from before player settings moved into D1? They were in a
> `RECFLARE_PLAYER_SETTINGS` KV namespace; copy it across with
> `just settings-import-kv --remote` between `just migrate` and `just deploy` (see CLI.md).
The secrets store holds the shared `JWT_SECRET` HS256 signing key — every worker
binds it so tokens signed by `auth` verify everywhere. Record its id in `.env` as
+9
View File
@@ -143,3 +143,12 @@ cai-load *args:
[no-cd]
catalog-load *args:
bun runx catalog load "$@"
# Copy the old RECFLARE_PLAYER_SETTINGS KV namespace into the player_settings D1 table (one-time
# upgrade for deployments that predate the move). Merges; existing rows keep what they have.
# Defaults to --local; pass --remote for production, --dry-run to only count. See CLI.md.
[group('4. utility')]
[positional-arguments]
[no-cd]
settings-import-kv *args:
bun runx admin settings-import-kv "$@"
+2 -2
View File
@@ -43,11 +43,11 @@ apex/`ns` host and isn't listed within it. Each implemented worker has its own
| Leaderboard | `leaderboard` | `leaderboard` | Per-room stat leaderboards, one board per stat channel (D1) |
| Link | `link` | `link` | Stub — deploys and answers, no link endpoints yet |
| Lists | `lists` | `lists` | Curated & algorithmic discovery lists (canned — nothing ranks yet) |
| Matchmaking | `match` | `match` | Matchmaking & per-player presence (D1, KV) |
| Matchmaking | `match` | `match` | Matchmaking & per-player presence (D1) |
| Moderation | `moderation` | `moderation` | Stub — the reporting routes still live in `api`; see note below |
| Notifications | `notify` | `notify` | Real-time notifications over SignalR/WebSockets (Durable Object) |
| PlatformNotifications | `platformnotifications` | `platformnotifications` | Stub — deploys and answers, no notification endpoints yet |
| PlayerSettings | `playersettings` | `playersettings` | Per-player settings (KV) |
| PlayerSettings | `playersettings` | `playersettings` | Per-player settings (D1) |
| RoomComments | `roomcomments` | `roomcomments` | Notes pinned in a room’s scene — read & create (D1) |
| RoomieIntegrations | `roomieintegrations` | — | Not yet implemented |
| Rooms | `rooms` | `rooms` | Room storage & queries; seeds the Dorm & Orientation rooms (D1) |
+6 -10
View File
@@ -33,8 +33,12 @@ export type Env = SharedHonoEnv & {
* may sign in on it — so the version check never sends a supporter to update.
*/
ROLLOUT_GAME_VERSIONS?: string
// Shared rooms database (schema/migrations owned by the `rooms` worker). Used
// read-only here to resolve room roles for `/api/rooms/v1/verifyRole`.
// Shared `recflare` database. Rooms (owned by the `rooms` worker) are read here to
// resolve room roles for `/api/rooms/v1/verifyRole`; `player_settings` (owned by the
// `playersettings` worker — one JSON map per player) is read AND written by
// `GET|PUT /api/players/v1/playerPhotoTaggingSetting`, whose preference is one key
// (`playerPhotoTaggingSetting`) in that shared bag, so the write MERGES — see
// `writePhotoTaggingSetting`.
DB: D1Database
// Image bucket (shared with the `img` worker, which serves objects back by
// key). Uploaded saved images are written here.
@@ -42,14 +46,6 @@ export type Env = SharedHonoEnv & {
// Shared CDN bucket (owned by the `cdn` worker, written by `storage`). Read
// here only to hash an invention's uploaded data blob under `invention/`.
CDN_ASSETS: R2Bucket
/**
* The per-player settings map the `playersettings` worker owns (`player:<id>` → JSON
* `{ key: value }`). Read and written here by
* `GET|PUT /api/players/v1/playerPhotoTaggingSetting`: the photo-tagging preference is
* one key (`playerPhotoTaggingSetting`) in that shared bag, not a store of its own, so
* the write MERGES — see `writePhotoTaggingSetting`.
*/
RECFLARE_PLAYER_SETTINGS: KVNamespace
// SignalR notifications hub (DO owned by the `notify` worker). Bound here to
// push RelationshipChanged notifications when a player's relationship changes.
RECFLARE_NOTIFICATIONS_HUB: DurableObjectNamespace<NotificationsHub>
+4 -4
View File
@@ -101,12 +101,12 @@ const OWN_VIEW_NOTE =
*/
const PHOTO_TAGGING_DEFAULT = 0
/** The player's settings map, or null when they have none / KV is unreachable. */
/** The player's settings map, or null when they have none / the database is unreachable. */
async function getPlayerSettings(
env: App['Bindings'],
accountId: number
): Promise<Record<string, string> | null> {
return readPlayerSettings(env.RECFLARE_PLAYER_SETTINGS, accountId).catch(() => null)
return readPlayerSettings(env.DB, accountId).catch(() => null)
}
/** The caller's stored photo-tagging preference, or the default when they have none. */
@@ -123,14 +123,14 @@ async function readPhotoTaggingSetting(env: App['Bindings'], accountId: number):
* The write MERGES, as the `playersettings` worker's own PUT does: the map holds every
* setting the player has (OOBE state, tutorial mask, …), so storing this one on its own
* would wipe the rest. Re-posting the value already stored writes nothing — the client
* does that freely, and KV writes are the cost.
* does that freely, and writes are the cost.
*/
async function writePhotoTaggingSetting(
env: App['Bindings'],
accountId: number,
setting: number
): Promise<void> {
await mergePlayerSettings(env.RECFLARE_PLAYER_SETTINGS, accountId, {
await mergePlayerSettings(env.DB, accountId, {
[PHOTO_TAGGING_KEY]: String(setting),
})
}
+33 -12
View File
@@ -17,9 +17,11 @@ import {
MessageType,
NOTIFICATION_SCHEMA_DDL,
OUTFIT_SCHEMA_DDL,
PLAYER_SETTINGS_SCHEMA_DDL,
PRESENCE_SCHEMA_DDL,
PRESENCE_TTL_SECONDS,
PROGRESSION_SCHEMA_DDL,
readPlayerSettings,
RELATIONSHIP_SCHEMA_DDL,
ROOM_INSTANCE_SCHEMA_DDL,
ROOM_SCHEMA_DDL,
@@ -134,6 +136,23 @@ const TEST_ROOMS = [
},
]
/** Seed a player's `player_settings` row with raw JSON text — what the KV value used to be. */
const seedSettings = (playerId: number, data: string) =>
env.DB.prepare(
`INSERT INTO player_settings (account_id, data) VALUES (?1, ?2)
ON CONFLICT (account_id) DO UPDATE SET data = excluded.data`
)
.bind(playerId, data)
.run()
/** The row's `data` exactly as stored — a seeded value surviving a request means no write happened. */
const rawSettings = async (playerId: number) =>
(
await env.DB.prepare('SELECT data FROM player_settings WHERE account_id = ?1')
.bind(playerId)
.first<{ data: string }>()
)?.data ?? null
beforeAll(async () => {
// Seed the shared JWT signing key into the local Secrets Store so .get() resolves.
await adminSecretsStore(env.JWT_SECRET).create('test-signing-key')
@@ -177,6 +196,10 @@ beforeAll(async () => {
// Outfit table (owned by the econ worker) — /outfits/me reads and writes slot 0.
for (const stmt of OUTFIT_SCHEMA_DDL) await env.DB.prepare(stmt).run()
// Player settings (owned by the playersettings worker) — the photo-tagging preference
// is one key in that per-player map.
for (const stmt of PLAYER_SETTINGS_SCHEMA_DDL) await env.DB.prepare(stmt).run()
// Inventions table (owned by the api worker) — invention save/mine use it.
for (const stmt of INVENTIONS_SCHEMA_DDL) await env.DB.prepare(stmt).run()
@@ -7223,32 +7246,30 @@ describe('images', () => {
expect(await (await read('710')).text()).toBe('2')
// It's stored under `playerPhotoTaggingSetting` in the player's settings bag...
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:710',
'json'
)
const stored = await readPlayerSettings(env.DB, 710)
expect(stored?.playerPhotoTaggingSetting).toBe('2')
// ...and the write MERGES: the player's other settings survive it.
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:711',
await seedSettings(
711,
JSON.stringify({ 'Recroom.OOBE': '77', playerPhotoTaggingSetting: '1' })
)
expect(await (await read('711')).text()).toBe('1')
await write('711', { Setting: 0 })
expect(
await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>('player:711', 'json')
).toEqual({ 'Recroom.OOBE': '77', playerPhotoTaggingSetting: '0' })
expect(await readPlayerSettings(env.DB, 711)).toEqual({
'Recroom.OOBE': '77',
playerPhotoTaggingSetting: '0',
})
// The setting is per-player.
expect(await (await read('710')).text()).toBe('2')
// Re-posting the stored value writes nothing to KV: the raw value is seeded with
// Re-posting the stored value writes nothing: the raw value is seeded with
// whitespace JSON.stringify never produces, and it survives the PUT untouched.
const padded = '{ "Recroom.OOBE": "77", "playerPhotoTaggingSetting": "1" }'
await env.RECFLARE_PLAYER_SETTINGS.put('player:712', padded)
await seedSettings(712, padded)
expect(await (await write('712', { Setting: 1 })).text()).toBe('1')
expect(await env.RECFLARE_PLAYER_SETTINGS.get('player:712', 'text')).toBe(padded)
expect(await rawSettings(712)).toBe(padded)
// A body with no readable Setting leaves the stored value alone rather than writing 0
// — and answers what the player still has.
+953 -242
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20260625.1 2025-09-20 nodejs_compat
// Runtime types generated with workerd@1.20260831.1 2026-06-16 nodejs_compat
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
@@ -19,26 +19,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)
@@ -96,61 +96,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)
*/
@@ -168,23 +168,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.
@@ -193,7 +194,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)
*/
@@ -359,7 +360,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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)
*/
@@ -404,6 +405,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,
@@ -420,10 +422,12 @@ interface TestController {
interface ExecutionContext<Props = unknown> {
waitUntil(promise: Promise<any>): void;
passThroughOnException(): void;
readonly exports: Cloudflare.Exports;
readonly props: Props;
cache?: CacheContext;
readonly access?: CloudflareAccessContext;
tracing: Tracing;
abort(reason?: any): void;
}
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
@@ -512,7 +516,7 @@ declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded
getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
}
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -526,6 +530,7 @@ interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = u
}
interface DurableObjectState<Props = unknown> {
waitUntil(promise: Promise<any>): void;
readonly exports: Cloudflare.Exports;
readonly props: Props;
readonly id: DurableObjectId;
readonly storage: DurableObjectStorage;
@@ -540,7 +545,7 @@ interface DurableObjectState<Props = unknown> {
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string): void;
abort(reason?: string, options?: DurableObjectAbortOptions): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
@@ -576,6 +581,9 @@ interface DurableObjectStorage {
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectAbortOptions {
retryAlarm?: boolean;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
@@ -626,26 +634,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)
*/
@@ -682,13 +690,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)
@@ -701,45 +709,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)
*/
@@ -760,7 +768,7 @@ interface EventListenerObject<EventType extends Event = Event> {
}
type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
/**
* 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)
*/
@@ -773,13 +781,13 @@ declare class EventTarget<EventMap extends Record<string, Event> = Record<string
*/
addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, 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 extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, 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)
*/
@@ -811,7 +819,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)
*/
@@ -824,7 +832,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)
*/
@@ -836,13 +844,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)
*/
@@ -858,12 +866,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<void>;
}
@@ -871,20 +884,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<any>): 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)
*/
@@ -923,7 +936,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)
*/
@@ -941,13 +954,13 @@ declare class Blob {
*/
bytes(): Promise<Uint8Array>;
/**
* 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<string>;
/**
* 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)
*/
@@ -964,13 +977,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)
*/
@@ -987,7 +1000,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)
*/
@@ -1020,14 +1033,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)
*/
@@ -1055,7 +1068,7 @@ declare abstract class SubtleCrypto {
*/
encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/**
* 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)
*/
@@ -1073,7 +1086,7 @@ declare abstract class SubtleCrypto {
*/
verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;
/**
* 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)
*/
@@ -1091,7 +1104,7 @@ declare abstract class SubtleCrypto {
*/
deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
/**
* 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)
*/
@@ -1109,13 +1122,13 @@ declare abstract class SubtleCrypto {
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* 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<ArrayBuffer>;
/**
* 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)
*/
@@ -1123,20 +1136,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)
*/
@@ -1253,12 +1266,15 @@ interface CryptoKeyArbitraryKeyAlgorithm {
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
readonly digest: Promise<ArrayBuffer>;
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)
*/
@@ -1275,20 +1291,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)
*/
@@ -1345,6 +1361,9 @@ declare class ErrorEvent extends Event {
get error(): any;
}
interface ErrorEventErrorEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
message?: string;
filename?: string;
lineno?: number;
@@ -1357,135 +1376,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<any>;
/**
* 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<string>;
/* Returns a list of values in the list. */
values(): IterableIterator<(File | string)>;
forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;
[Symbol.iterator](): IterableIterator<[
@@ -1564,19 +1587,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)
*/
@@ -1585,65 +1608,62 @@ declare abstract class FetchEvent extends ExtendableEvent {
}
type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;
/**
* 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<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;
/* Returns an iterator allowing to go through all key/value pairs contained in this object. */
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<string>;
/* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
values(): IterableIterator<string>;
[Symbol.iterator](): IterableIterator<[
key: string,
value: string
]>;
}
type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;
type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;
declare abstract class Body {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
get body(): ReadableStream | null;
@@ -1699,7 +1719,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)
*/
@@ -1717,7 +1737,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)
*/
@@ -1725,7 +1745,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)
*/
@@ -1756,13 +1776,13 @@ declare var Request: {
*/
interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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<CfHostMetadata, Cf>;
/**
* 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)
*/
@@ -1774,7 +1794,7 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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)
*/
@@ -1800,13 +1820,13 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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)
*/
@@ -2195,7 +2215,7 @@ type ReadableStreamReadResult<R = any> = {
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)
*/
@@ -2213,13 +2233,13 @@ interface ReadableStream<R = any> {
*/
cancel(reason?: any): Promise<void>;
/**
* 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<R>;
/**
* 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)
*/
@@ -2231,13 +2251,13 @@ interface ReadableStream<R = any> {
*/
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
/**
* 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<R>, options?: StreamPipeOptions): Promise<void>;
/**
* 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)
*/
@@ -2249,7 +2269,7 @@ interface ReadableStream<R = any> {
[Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
}
/**
* 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)
*/
@@ -2281,7 +2301,7 @@ declare class ReadableStreamDefaultReader<R = any> {
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)
*/
@@ -2290,13 +2310,13 @@ declare class ReadableStreamBYOBReader {
get closed(): Promise<void>;
cancel(reason?: any): Promise<void>;
/**
* 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<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* 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)
*/
@@ -2315,7 +2335,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)
*/
@@ -2341,13 +2361,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<R = any> {
/**
* 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)
*/
@@ -2359,32 +2379,32 @@ declare abstract class ReadableStreamDefaultController<R = any> {
*/
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)
*/
@@ -2396,7 +2416,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)
*/
@@ -2409,7 +2429,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)
*/
@@ -2421,7 +2441,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)
*/
@@ -2446,7 +2466,7 @@ declare abstract class TransformStreamDefaultController<O = any> {
*/
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)
*/
@@ -2468,14 +2488,14 @@ interface ReadableWritablePair<R = any, W = any> {
writable: WritableStream<W>;
}
/**
* 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<W = any> {
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)
*/
@@ -2487,83 +2507,83 @@ declare class WritableStream<W = any> {
*/
abort(reason?: any): Promise<void>;
/**
* 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<void>;
/**
* 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<W>;
}
/**
* 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<W = any> {
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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<I = any, O = any> {
constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
/**
* 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<O>;
/**
* 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)
*/
@@ -2582,7 +2602,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)
*/
@@ -2590,7 +2610,7 @@ declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
* The **`DecompressionStream`** interface of the Compression Streams API decompresses 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/DecompressionStream)
*/
@@ -2598,7 +2618,7 @@ declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBuf
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. It is the streaming equivalent of TextEncoder. 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/TextEncoderStream)
*/
@@ -2607,7 +2627,7 @@ declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
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)
*/
@@ -2756,6 +2776,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;
@@ -2776,7 +2802,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)
*/
@@ -2801,121 +2827,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)
*/
@@ -2935,13 +2961,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)
*/
@@ -2991,25 +3017,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<string>;
/* Returns a list of values in the search params. */
values(): IterableIterator<string>;
forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;
/*function toString() { [native code] }*/
@@ -3019,18 +3042,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 {
@@ -3063,7 +3146,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)
*/
@@ -3082,13 +3165,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;
@@ -3100,7 +3186,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)
*/
@@ -3117,20 +3203,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<WebSocketEventMap> {
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)
*/
@@ -3150,13 +3236,13 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
*/
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)
*/
@@ -3243,25 +3329,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)
*/
@@ -3296,18 +3382,26 @@ interface ContainerExecOptions {
cwd?: string;
env?: Record<string, string>;
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<number>;
output(): Promise<ExecOutput>;
kill(signal?: number): void;
resize(cols: number, rows: number): void;
}
interface Container {
get running(): boolean;
@@ -3334,25 +3428,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<string, string>;
instance?: "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | ContainerStartResources;
labels?: Record<string, string>;
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.
@@ -3361,19 +3472,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)
*/
@@ -3389,13 +3500,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)
*/
@@ -3455,7 +3566,7 @@ interface WorkerLoaderModule {
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer;
wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
@@ -3463,7 +3574,7 @@ interface WorkerLoaderWorkerCode {
allowExperimental?: boolean;
limits?: workerdResourceLimits;
mainModule: string;
modules: Record<string, WorkerLoaderModule | string>;
modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
@@ -3485,7 +3596,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)
*/
@@ -3494,11 +3605,13 @@ declare abstract class Performance {
interface Tracing {
enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
startActiveSpan<T, A extends unknown[]>(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<string, boolean | number | string | undefined>): this;
end(): void;
}
/**
@@ -4138,6 +4251,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[];
@@ -10035,6 +10155,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;
@@ -10127,6 +10404,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 = {
/**
@@ -10793,6 +11077,15 @@ interface BrowserRunBaseOptions {
*/
cacheTTL?: number;
}
/**
* Backend selection, mixed into the options of the quick actions that support it.
* Deliberately not part of `BrowserRunBaseOptions`: `scrape`, `links` and `snapshot`
* reject an alternate backend, so they must not accept the field.
*/
interface BrowserRunAlternateBackendOptions {
/** Render with an alternate browser backend instead of the default one. */
browser?: 'kitesurf';
}
/** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/
type BrowserRunCommonOptions = (BrowserRunBaseOptions & {
/** URL to navigate to, e.g. `"https://example.com"`. */
@@ -10827,7 +11120,7 @@ type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
scrollPage?: boolean;
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
};
} & BrowserRunAlternateBackendOptions;
type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @see https://pptr.dev/api/puppeteer.pdfoptions */
pdfOptions?: {
@@ -10863,7 +11156,7 @@ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @default 30000 */
timeout?: number;
};
};
} & BrowserRunAlternateBackendOptions;
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
/** CSS selectors to scrape. At least one element is required. */
elements: Array<{
@@ -10876,10 +11169,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<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;
};
/** 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;
} & BrowserRunAlternateBackendOptions;
interface BrowserRunJsonBaseOptions {
/** Custom AI models to try in order. Max 3. Falls back to next on error. */
custom_ai?: Array<{
@@ -10893,7 +11205,7 @@ interface BrowserRunJsonBaseOptions {
* Options for the `json` quick action.
* At least one of `prompt` or `response_format` must be provided.
*/
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions & ({
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
/** Natural-language prompt describing what data to extract. */
prompt: string;
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
@@ -10904,14 +11216,80 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
response_format: AiTextGenerationResponseFormat;
});
type BrowserRunContentOptions = BrowserRunCommonOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
type BrowserRunContentOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
type BrowserRunRedirectHop = {
/** URL that returned the redirect. */
url: string;
/** HTTP status of the redirect. */
status: number;
/** Redirect response headers, including `location`. */
headers: Record<string, string>;
};
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<string, string>;
/** 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 `<h2>`. */
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;
@@ -10924,6 +11302,7 @@ type BrowserRunLinksSuccessResponse = {
success: true;
/** Extracted links */
result: string[];
meta: BrowserRunResponseMeta;
};
/** Success response for `scrape` action. */
type BrowserRunScrapeSuccessResponse = {
@@ -10954,15 +11333,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;
};
@@ -10971,12 +11368,14 @@ type BrowserRunJsonSuccessResponse = {
success: true;
/** JSON data extracted from the page using an AI model */
result: Record<string, unknown>;
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 = {
@@ -11086,9 +11485,10 @@ declare abstract class BrowserRun {
*/
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
/**
* 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):**
@@ -11136,6 +11536,26 @@ declare abstract class BrowserRun {
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
*/
quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;
/**
* 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<Response>;
}
/**
* In addition to the properties you can set in the RequestInit dict
@@ -12206,6 +12626,13 @@ interface ForwardableEmailMessage extends EmailMessage {
* @returns A promise that resolves when the email message is replied.
*/
reply(message: EmailMessage): Promise<EmailSendResult>;
/**
* Reply to the sender of this email message with a message built from the given
* fields. Threading headers (In-Reply-To/References) are set automatically.
* @param builder The reply message contents.
* @returns A promise that resolves when the email message is replied.
*/
reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;
}
/** A file attachment for an email message */
type EmailAttachment = {
@@ -12226,23 +12653,46 @@ interface EmailAddress {
name: string;
email: string;
}
/**
* Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or
* `bcc` must be provided.
*/
type EmailDestinations = {
to?: string | EmailAddress | (string | EmailAddress)[];
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
} & ({
to: string | EmailAddress | (string | EmailAddress)[];
} | {
cc: string | EmailAddress | (string | EmailAddress)[];
} | {
bcc: string | EmailAddress | (string | EmailAddress)[];
});
/**
* Fields shared by all composed emails (no recipients). Used directly by
* `ForwardableEmailMessage.reply()`, which always replies to the original
* sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.
*/
interface EmailReplyMessageBuilder {
from: string | EmailAddress;
subject: string;
replyTo?: string | EmailAddress;
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}
/**
* Fields for composing an email without constructing raw MIME, for
* `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.
*/
type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;
/**
* A binding that allows a Worker to send email messages.
*/
interface SendEmail {
send(message: EmailMessage): Promise<EmailSendResult>;
send(builder: {
from: string | EmailAddress;
to: string | EmailAddress | (string | EmailAddress)[];
subject: string;
replyTo?: string | EmailAddress;
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}): Promise<EmailSendResult>;
send(builder: EmailMessageBuilder): Promise<EmailSendResult>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
@@ -12396,6 +12846,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.
*/
@@ -12417,6 +12876,78 @@ interface Hyperdrive {
*/
readonly database: string;
}
/**
* A handle to a dynamically-provisioned Hyperdrive connection, returned by
* `HyperdriveApi.get()`.
*/
interface HyperdriveDynamic extends Disposable {
/**
* The database name to use when connecting through this Hyperdrive.
*/
readonly database: Promise<string>;
/*
* The randomly generated user to use when authenticating to your
* database via Hyperdrive.
*/
readonly user: Promise<string>;
/*
* The randomly generated password to use when authenticating to your
* database via Hyperdrive.
*/
readonly password: Promise<string>;
/**
* Open a TCP socket to the target database through this Hyperdrive.
*
*/
connect(): Promise<Socket>;
}
/**
* Binding that provisions Hyperdrive connections at request time, rather than
* from static configuration.
*/
interface HyperdriveDynamicApi {
/**
* Provision a connection for the database described by `args`.
*
*/
get(args: HyperdriveDynamicConfig): Promise<HyperdriveDynamic>;
/**
* Get a pre-generated connection string used for connecting to dynamic Hyperdrive.
*/
getHyperdriveConnectionString(connectionString: string): Promise<string>;
}
/**
* Parameters identifying the database that a dynamically-provisioned
* Hyperdrive connection should target.
*/
interface HyperdriveDynamicConfig {
/**
* Generated connection string to pass into the dynamic worker.
*
*/
dynamicHyperdriveConnectionString: string;
/**
* Connection string for the origin database Hyperdrive should connect to.
* Contains credentials, so treat it as a secret.
*
* The scheme selects the database engine. PostgreSQL origins are supported.
*/
connectionString: string;
/**
* Region in which to place the connection pool. See the Hyperdrive
* documentation for the set of supported regions.
*/
targetRegion: string;
/**
* Whether Hyperdrive should cache query results for this connection.
*/
cachingEnabled?: boolean;
/**
* Maximum number of connections the pool may open to the origin database.
* Defaults to 60.
*/
maxConnections?: number;
}
// Copyright (c) 2024 Cloudflare, Inc.
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0
@@ -12428,6 +12959,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<Uint8Array> | TextRasterize;
type ImageTransform = {
width?: number;
height?: number;
@@ -12517,6 +13069,9 @@ interface ImageUploadOptions {
requireSignedURLs?: boolean;
metadata?: Record<string, unknown>;
creator?: string;
/**
* If 'base64', the input data will be decoded from base64 before processing
*/
encoding?: 'base64';
}
interface ImageUpdateOptions {
@@ -12524,11 +13079,40 @@ interface ImageUpdateOptions {
metadata?: Record<string, unknown>;
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<string, ImageMetadataFilterValue>;
}
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<string, unknown>;
creator?: string;
expiresIn?: number;
}
interface ImageDirectUploadResult {
id: string;
uploadURL: string;
}
interface ImageList {
images: ImageMetadata[];
@@ -12546,6 +13130,13 @@ interface ImageHandle {
* @returns ReadableStream of image bytes, or null if not found
*/
bytes(): Promise<ReadableStream<Uint8Array> | 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<string>;
/**
* Update hosted image metadata
* @param options Properties to update
@@ -12581,6 +13172,14 @@ interface HostedImagesBinding {
* @throws {@link ImagesError} if list fails
*/
list(options?: ImageListOptions): Promise<ImageList>;
/**
* 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<ImageDirectUploadResult>;
}
interface ImagesBinding {
/**
@@ -12595,6 +13194,13 @@ interface ImagesBinding {
* @returns A transform handle
*/
input(stream: ReadableStream<Uint8Array>, 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
*/
@@ -12624,11 +13230,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
*/
@@ -13064,6 +13674,11 @@ declare namespace CloudflareWorkersModule {
export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
export type WorkflowDelayDuration = WorkflowSleepDuration;
export type WorkflowDynamicDelayContext = {
ctx: WorkflowStepContext<WorkflowDelayFunction>;
error: Error;
};
export type WorkflowDelayFunction = (input: WorkflowDynamicDelayContext) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;
export type WorkflowTimeoutDuration = WorkflowSleepDuration;
export type WorkflowRetentionDuration = WorkflowSleepDuration;
export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
@@ -13071,12 +13686,32 @@ declare namespace CloudflareWorkersModule {
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
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<WorkflowStepConfig, 'retries'> & {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
backoff?: WorkflowBackoff;
};
};
type WorkflowStepConfigWithDelayFunction = Omit<WorkflowStepConfig, 'retries'> & {
retries: {
limit: number;
delay: WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
};
export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;
export type WorkflowCronSchedule = {
/** Cron expression that triggered this event. */
@@ -13097,28 +13732,51 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext = {
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
step: {
name: string;
count: number;
};
attempt: number;
config: WorkflowStepConfig;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
};
export type WorkflowRollbackContext<T = unknown> = {
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<T = unknown, Delay = WorkflowDelayDuration | number> = {
ctx: WorkflowStepContext<Delay>;
error: Error;
output: T | undefined;
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
stepName: string;
};
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown> = {
rollback: WorkflowRollbackHandler<T>;
export type WorkflowRollbackHandler<T = unknown, Delay = WorkflowDelayDuration | number> = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown, Delay = WorkflowDelayDuration | number> = {
rollback: WorkflowRollbackHandler<T, Delay>;
rollbackConfig?: WorkflowStepRollbackConfig;
};
export abstract class WorkflowStep {
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
// 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<T>(...)`) 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<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext<WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayDuration | number>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
@@ -13894,11 +14552,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;
} | {
@@ -13915,7 +14574,11 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOutputOptions = {
format?: OutputFormat;
};
type ConversionOptions = {
output?: ConversionOutputOptions;
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
@@ -14010,7 +14673,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;
@@ -14029,6 +14692,7 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
@@ -14063,11 +14727,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;
@@ -14545,10 +15220,31 @@ declare abstract class Workflow<PARAMS = unknown> {
* @returns A promise that resolves with a list of handles for the created instances.
*/
public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;
/**
* 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<WorkflowBatchDeleteResult>;
}
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<PARAMS = unknown> {
/**
* An id for your Workflow instance. Must be unique within the Workflow.
@@ -14566,6 +15262,9 @@ interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
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)
@@ -14583,6 +15282,13 @@ interface WorkflowError {
code?: number;
message: string;
}
interface WorkflowInstanceTerminateOptions {
/**
* If true, run registered rollback handlers before terminating the instance.
* Only steps that registered rollback handlers are rolled back.
*/
rollback?: boolean;
}
interface WorkflowInstanceRestartOptions {
/**
* Restart from a specific step. If omitted, the instance restarts from the beginning.
@@ -14616,14 +15322,19 @@ declare abstract class WorkflowInstance {
public resume(): Promise<void>;
/**
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
* @param options Options for termination, including whether registered rollback handlers should run.
*/
public terminate(): Promise<void>;
public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;
/**
* Restart the instance. Optionally restart from a specific step, preserving
* cached results for all steps before it.
* @param options Options for the restart, including an optional step to restart from.
*/
public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
/**
* Delete the instance and its stored state.
*/
public delete(): Promise<void>;
/**
* Returns the current status of the instance.
*/
-10
View File
@@ -35,16 +35,6 @@
"bucket_name": "recflare-cdn"
}
],
// Per-player settings KV, owned by the `playersettings` worker. Read AND written here,
// for the photo-tagging preference (`/api/players/v1/playerPhotoTaggingSetting`), which
// is one key in that same bag rather than storage of its own. The "local" id placeholder
// is replaced with the real id from RECFLARE_KV at deploy time.
"kv_namespaces": [
{
"binding": "RECFLARE_PLAYER_SETTINGS",
"id": "local"
}
],
// Cross-worker binding to the SignalR notifications hub DO (owned/migrated by
// the `notify` worker). We only invoke its RPC methods; no migration here.
"durable_objects": {
+3 -3
View File
@@ -198,12 +198,12 @@ function parseChatPrivacy(value: string | undefined): ChatPrivacyValue | undefin
: undefined
}
/** The player's settings map from the KV the `playersettings` worker owns. */
/** The player's settings map from the `player_settings` table the `playersettings` worker owns. */
async function getPlayerSettings(
env: Env,
accountId: number
): Promise<Record<string, string> | null> {
return readPlayerSettings(env.RECFLARE_PLAYER_SETTINGS, accountId).catch(() => null)
return readPlayerSettings(env.DB, accountId).catch(() => null)
}
/**
@@ -258,7 +258,7 @@ async function mergePlayerSettings(
accountId: number,
patch: Record<string, string>
): Promise<void> {
await mergeStoredPlayerSettings(env.RECFLARE_PLAYER_SETTINGS, accountId, patch)
await mergeStoredPlayerSettings(env.DB, accountId, patch)
}
/**
+5 -5
View File
@@ -9,13 +9,13 @@ export type Env = SharedHonoEnv & {
// with `await env.JWT_SECRET.get()`; all workers bind the same store so tokens
// signed by `auth` verify here.
JWT_SECRET: SecretsStoreSecret
/** Shared `recflare` D1 — this worker owns the `message` and thread tables. */
DB: D1Database
/**
* Per-player settings KV, owned by the `playersettings` worker. Holds the caller's
* chat privacy settings (`/thread/chatPrivacySetting`) alongside their other toggles.
* Shared `recflare` D1 — this worker owns the `message` and thread tables. The
* caller's chat privacy settings (`/thread/chatPrivacySetting`) and `LatestPartyChat`
* live in `player_settings` (owned by the `playersettings` worker), alongside their
* other toggles.
*/
RECFLARE_PLAYER_SETTINGS: KVNamespace
DB: D1Database
/** The `notify` worker's NotificationsHub DO — pushes ChatMessageReceived to members. */
RECFLARE_NOTIFICATIONS_HUB: DurableObjectNamespace<NotificationsHub>
}
+47 -61
View File
@@ -3,6 +3,8 @@ import { beforeAll, beforeEach, describe, expect, it } from 'vitest'
import '../../chat.app'
import { deletePlayerSettings, PLAYER_SETTINGS_SCHEMA_DDL, readPlayerSettings } from '@repo/domain'
import { NotificationType } from '../../../../notify/src/notification-types'
import {
ChatModerationState,
@@ -15,11 +17,11 @@ import {
addThreadMember,
ChatThreadType,
createThread,
joinedChatContents,
findThreadWithMembers,
getThreadForPlayer,
getThreadsForPlayer,
isThreadMember,
joinedChatContents,
leftChatContents,
markThreadRead,
postMessage,
@@ -66,11 +68,31 @@ async function bearer(sub: number, version?: string): Promise<Record<string, str
return { Authorization: `Bearer ${signingInput}.${b64url(sig)}` }
}
/** Seed a player's `player_settings` row with raw JSON text — what the KV value used to be. */
const seedSettings = (playerId: number, data: string) =>
env.DB.prepare(
`INSERT INTO player_settings (account_id, data) VALUES (?1, ?2)
ON CONFLICT (account_id) DO UPDATE SET data = excluded.data`
)
.bind(playerId, data)
.run()
/** The row's `data` exactly as stored — a seeded value surviving a request means no write happened. */
const rawSettings = async (playerId: number) =>
(
await env.DB.prepare('SELECT data FROM player_settings WHERE account_id = ?1')
.bind(playerId)
.first<{ data: string }>()
)?.data ?? null
beforeAll(async () => {
// Seed the shared JWT signing key into the local Secrets Store so .get() resolves.
await adminSecretsStore(env.JWT_SECRET).create(TEST_SECRET)
for (const stmt of SCHEMA_DDL) await env.DB.prepare(stmt).run()
for (const stmt of THREAD_SCHEMA_DDL) await env.DB.prepare(stmt).run()
// Player settings (owned by the playersettings worker) — chat privacy and LatestPartyChat
// are keys in that per-player map.
for (const stmt of PLAYER_SETTINGS_SCHEMA_DDL) await env.DB.prepare(stmt).run()
})
describe('chat endpoints', () => {
@@ -413,12 +435,7 @@ describe('GET /settings/partyinvite', () => {
// player setting — as the BARE thread, where the POST wraps the same projection.
describe('GET /thread/party', () => {
async function settings(playerId: number): Promise<Record<string, string>> {
return (
(await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
`player:${playerId}`,
'json'
)) ?? {}
)
return (await readPlayerSettings(env.DB, playerId)) ?? {}
}
it('answers the party named by LatestPartyChat, bare — no ChatResult wrapper', async () => {
@@ -450,10 +467,7 @@ describe('GET /thread/party', () => {
it('POST records the thread id in the caller’s LatestPartyChat setting', async () => {
const caller = 883202
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${caller}`,
JSON.stringify({ OobeState: 'Complete' })
)
await seedSettings(caller, JSON.stringify({ OobeState: 'Complete' }))
const created = await SELF.fetch(`${ORIGIN}/thread/party`, {
method: 'POST',
headers: await bearer(caller),
@@ -527,10 +541,7 @@ describe('GET /thread/party', () => {
headers: await bearer(host),
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${guest}`,
JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) })
)
await seedSettings(guest, JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) }))
expect(await isThreadMember(env.DB, ChatThread.ChatThreadId, guest)).toBe(false)
const res = await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(guest) })
@@ -585,7 +596,7 @@ describe('GET /thread/party', () => {
headers: await bearer(caller),
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await env.RECFLARE_PLAYER_SETTINGS.delete(`player:${caller}`)
await deletePlayerSettings(env.DB, caller)
const res = await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(caller) })
expect(((await res.json()) as { ChatThreadId: number }).ChatThreadId).toBe(
@@ -626,8 +637,8 @@ describe('GET /thread/party', () => {
})
const own = (await mine.json()) as { ChatThread: { ChatThreadId: number } }
const theirs = (await other.json()) as { ChatThread: { ChatThreadId: number } }
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${caller}`,
await seedSettings(
caller,
JSON.stringify({ LatestPartyChat: String(theirs.ChatThread.ChatThreadId) })
)
@@ -654,8 +665,8 @@ describe('GET /thread/party', () => {
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await openedMinutesAgo(ChatThread.ChatThreadId, 61)
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${latecomer}`,
await seedSettings(
latecomer,
JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) })
)
@@ -674,10 +685,7 @@ describe('GET /thread/party', () => {
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await openedMinutesAgo(ChatThread.ChatThreadId, 59)
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${guest}`,
JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) })
)
await seedSettings(guest, JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) }))
const res = await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(guest) })
expect(((await res.json()) as { PlayerIds: number[] }).PlayerIds).toEqual([host, guest])
@@ -711,8 +719,8 @@ describe('GET /thread/party', () => {
await env.DB.prepare('UPDATE message_thread SET created_at = ?2 WHERE chat_thread_id = ?1')
.bind(ChatThread.ChatThreadId, 'not-a-timestamp')
.run()
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${stranger}`,
await seedSettings(
stranger,
JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) })
)
@@ -726,10 +734,7 @@ describe('GET /thread/party', () => {
// put the caller in it.
const caller = 883207
const dm = await createThread(env.DB, [883208, 883213])
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${caller}`,
JSON.stringify({ LatestPartyChat: String(dm) })
)
await seedSettings(caller, JSON.stringify({ LatestPartyChat: String(dm) }))
const res = await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(caller) })
expect(await res.json()).toEqual({})
expect(await isThreadMember(env.DB, dm, caller)).toBe(false)
@@ -737,10 +742,7 @@ describe('GET /thread/party', () => {
it('answers {} when the setting names a thread that doesn’t exist', async () => {
const caller = 883214
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${caller}`,
JSON.stringify({ LatestPartyChat: '99999' })
)
await seedSettings(caller, JSON.stringify({ LatestPartyChat: '99999' }))
const res = await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(caller) })
expect(await res.json()).toEqual({})
expect(await isThreadMember(env.DB, 99999, caller)).toBe(false)
@@ -748,10 +750,7 @@ describe('GET /thread/party', () => {
it('answers {} for an unparseable stored id', async () => {
const caller = 883209
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${caller}`,
JSON.stringify({ LatestPartyChat: 'not-an-id' })
)
await seedSettings(caller, JSON.stringify({ LatestPartyChat: 'not-an-id' }))
const res = await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(caller) })
expect(await res.json()).toEqual({})
})
@@ -866,8 +865,8 @@ describe('GET /thread/chatPrivacySetting', () => {
})
it('reads the stored settings out of the player settings map', async () => {
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:886003',
await seedSettings(
886003,
JSON.stringify({
directMessagePrivacySetting: 'Favorites',
groupChatPrivacySetting: 'NoOne',
@@ -884,10 +883,7 @@ describe('GET /thread/chatPrivacySetting', () => {
})
it('falls back to Friends for a stored value it can’t parse', async () => {
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:886004',
JSON.stringify({ directMessagePrivacySetting: 'Nobody at all' })
)
await seedSettings(886004, JSON.stringify({ directMessagePrivacySetting: 'Nobody at all' }))
const res = await SELF.fetch(`${ORIGIN}/thread/chatPrivacySetting`, {
headers: await bearer(886004),
})
@@ -921,8 +917,7 @@ describe('PUT /thread/chatPrivacySetting', () => {
})
}
const settings = async (playerId: number) =>
env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(`player:${playerId}`, 'json')
const settings = async (playerId: number) => readPlayerSettings(env.DB, playerId)
it('stores the DM setting and answers the resulting settings', async () => {
const res = await put(887001, { directMessagePrivacySetting: 'Favorites' })
@@ -957,10 +952,7 @@ describe('PUT /thread/chatPrivacySetting', () => {
})
it('merges, leaving the player’s other settings untouched', async () => {
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:887004',
JSON.stringify({ 'Recroom.OOBE': '77' })
)
await seedSettings(887004, JSON.stringify({ 'Recroom.OOBE': '77' }))
await put(887004, { directMessagePrivacySetting: 'Favorites' })
expect(await settings(887004)).toEqual({
'Recroom.OOBE': '77',
@@ -971,12 +963,12 @@ describe('PUT /thread/chatPrivacySetting', () => {
// Re-posting the stored value writes nothing to KV — writes are the cost, and the client
// posts these freely. The raw value is seeded with whitespace JSON.stringify never
// produces; surviving the PUT untouched means no write happened.
it('does not write KV when the value is already stored', async () => {
it('does not write when the value is already stored', async () => {
const padded = '{ "Recroom.OOBE": "77", "directMessagePrivacySetting": "Favorites" }'
await env.RECFLARE_PLAYER_SETTINGS.put('player:887010', padded)
await seedSettings(887010, padded)
const res = await put(887010, { directMessagePrivacySetting: 'Favorites' })
expect(await res.json()).toMatchObject({ directMessagePrivacySetting: 1 })
expect(await env.RECFLARE_PLAYER_SETTINGS.get('player:887010', 'text')).toBe(padded)
expect(await rawSettings(887010)).toBe(padded)
})
it('accepts the enum by ordinal too, and is case-insensitive about the name', async () => {
@@ -1577,10 +1569,7 @@ describe('ChatMessageReceived push', () => {
headers: await bearer(host),
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${guest}`,
JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) })
)
await seedSettings(guest, JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) }))
await hub.getByName('global').takeSent()
await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(guest) })
@@ -1604,10 +1593,7 @@ describe('ChatMessageReceived push', () => {
headers: await bearer(host),
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${guest}`,
JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) })
)
await seedSettings(guest, JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) }))
await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(guest) })
await hub.getByName('global').takeSent()
+953 -242
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20260625.1 2025-09-20 nodejs_compat
// Runtime types generated with workerd@1.20260831.1 2026-06-16 nodejs_compat
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
@@ -19,26 +19,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)
@@ -96,61 +96,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)
*/
@@ -168,23 +168,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.
@@ -193,7 +194,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)
*/
@@ -359,7 +360,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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)
*/
@@ -404,6 +405,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,
@@ -420,10 +422,12 @@ interface TestController {
interface ExecutionContext<Props = unknown> {
waitUntil(promise: Promise<any>): void;
passThroughOnException(): void;
readonly exports: Cloudflare.Exports;
readonly props: Props;
cache?: CacheContext;
readonly access?: CloudflareAccessContext;
tracing: Tracing;
abort(reason?: any): void;
}
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
@@ -512,7 +516,7 @@ declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded
getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
}
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -526,6 +530,7 @@ interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = u
}
interface DurableObjectState<Props = unknown> {
waitUntil(promise: Promise<any>): void;
readonly exports: Cloudflare.Exports;
readonly props: Props;
readonly id: DurableObjectId;
readonly storage: DurableObjectStorage;
@@ -540,7 +545,7 @@ interface DurableObjectState<Props = unknown> {
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string): void;
abort(reason?: string, options?: DurableObjectAbortOptions): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
@@ -576,6 +581,9 @@ interface DurableObjectStorage {
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectAbortOptions {
retryAlarm?: boolean;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
@@ -626,26 +634,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)
*/
@@ -682,13 +690,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)
@@ -701,45 +709,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)
*/
@@ -760,7 +768,7 @@ interface EventListenerObject<EventType extends Event = Event> {
}
type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
/**
* 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)
*/
@@ -773,13 +781,13 @@ declare class EventTarget<EventMap extends Record<string, Event> = Record<string
*/
addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, 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 extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, 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)
*/
@@ -811,7 +819,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)
*/
@@ -824,7 +832,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)
*/
@@ -836,13 +844,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)
*/
@@ -858,12 +866,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<void>;
}
@@ -871,20 +884,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<any>): 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)
*/
@@ -923,7 +936,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)
*/
@@ -941,13 +954,13 @@ declare class Blob {
*/
bytes(): Promise<Uint8Array>;
/**
* 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<string>;
/**
* 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)
*/
@@ -964,13 +977,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)
*/
@@ -987,7 +1000,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)
*/
@@ -1020,14 +1033,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)
*/
@@ -1055,7 +1068,7 @@ declare abstract class SubtleCrypto {
*/
encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/**
* 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)
*/
@@ -1073,7 +1086,7 @@ declare abstract class SubtleCrypto {
*/
verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;
/**
* 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)
*/
@@ -1091,7 +1104,7 @@ declare abstract class SubtleCrypto {
*/
deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
/**
* 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)
*/
@@ -1109,13 +1122,13 @@ declare abstract class SubtleCrypto {
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* 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<ArrayBuffer>;
/**
* 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)
*/
@@ -1123,20 +1136,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)
*/
@@ -1253,12 +1266,15 @@ interface CryptoKeyArbitraryKeyAlgorithm {
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
readonly digest: Promise<ArrayBuffer>;
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)
*/
@@ -1275,20 +1291,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)
*/
@@ -1345,6 +1361,9 @@ declare class ErrorEvent extends Event {
get error(): any;
}
interface ErrorEventErrorEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
message?: string;
filename?: string;
lineno?: number;
@@ -1357,135 +1376,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<any>;
/**
* 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<string>;
/* Returns a list of values in the list. */
values(): IterableIterator<(File | string)>;
forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;
[Symbol.iterator](): IterableIterator<[
@@ -1564,19 +1587,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)
*/
@@ -1585,65 +1608,62 @@ declare abstract class FetchEvent extends ExtendableEvent {
}
type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;
/**
* 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<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;
/* Returns an iterator allowing to go through all key/value pairs contained in this object. */
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<string>;
/* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
values(): IterableIterator<string>;
[Symbol.iterator](): IterableIterator<[
key: string,
value: string
]>;
}
type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;
type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;
declare abstract class Body {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
get body(): ReadableStream | null;
@@ -1699,7 +1719,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)
*/
@@ -1717,7 +1737,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)
*/
@@ -1725,7 +1745,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)
*/
@@ -1756,13 +1776,13 @@ declare var Request: {
*/
interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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<CfHostMetadata, Cf>;
/**
* 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)
*/
@@ -1774,7 +1794,7 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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)
*/
@@ -1800,13 +1820,13 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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)
*/
@@ -2195,7 +2215,7 @@ type ReadableStreamReadResult<R = any> = {
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)
*/
@@ -2213,13 +2233,13 @@ interface ReadableStream<R = any> {
*/
cancel(reason?: any): Promise<void>;
/**
* 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<R>;
/**
* 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)
*/
@@ -2231,13 +2251,13 @@ interface ReadableStream<R = any> {
*/
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
/**
* 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<R>, options?: StreamPipeOptions): Promise<void>;
/**
* 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)
*/
@@ -2249,7 +2269,7 @@ interface ReadableStream<R = any> {
[Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
}
/**
* 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)
*/
@@ -2281,7 +2301,7 @@ declare class ReadableStreamDefaultReader<R = any> {
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)
*/
@@ -2290,13 +2310,13 @@ declare class ReadableStreamBYOBReader {
get closed(): Promise<void>;
cancel(reason?: any): Promise<void>;
/**
* 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<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* 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)
*/
@@ -2315,7 +2335,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)
*/
@@ -2341,13 +2361,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<R = any> {
/**
* 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)
*/
@@ -2359,32 +2379,32 @@ declare abstract class ReadableStreamDefaultController<R = any> {
*/
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)
*/
@@ -2396,7 +2416,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)
*/
@@ -2409,7 +2429,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)
*/
@@ -2421,7 +2441,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)
*/
@@ -2446,7 +2466,7 @@ declare abstract class TransformStreamDefaultController<O = any> {
*/
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)
*/
@@ -2468,14 +2488,14 @@ interface ReadableWritablePair<R = any, W = any> {
writable: WritableStream<W>;
}
/**
* 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<W = any> {
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)
*/
@@ -2487,83 +2507,83 @@ declare class WritableStream<W = any> {
*/
abort(reason?: any): Promise<void>;
/**
* 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<void>;
/**
* 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<W>;
}
/**
* 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<W = any> {
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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<I = any, O = any> {
constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
/**
* 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<O>;
/**
* 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)
*/
@@ -2582,7 +2602,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)
*/
@@ -2590,7 +2610,7 @@ declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
* The **`DecompressionStream`** interface of the Compression Streams API decompresses 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/DecompressionStream)
*/
@@ -2598,7 +2618,7 @@ declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBuf
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. It is the streaming equivalent of TextEncoder. 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/TextEncoderStream)
*/
@@ -2607,7 +2627,7 @@ declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
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)
*/
@@ -2756,6 +2776,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;
@@ -2776,7 +2802,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)
*/
@@ -2801,121 +2827,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)
*/
@@ -2935,13 +2961,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)
*/
@@ -2991,25 +3017,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<string>;
/* Returns a list of values in the search params. */
values(): IterableIterator<string>;
forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;
/*function toString() { [native code] }*/
@@ -3019,18 +3042,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 {
@@ -3063,7 +3146,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)
*/
@@ -3082,13 +3165,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;
@@ -3100,7 +3186,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)
*/
@@ -3117,20 +3203,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<WebSocketEventMap> {
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)
*/
@@ -3150,13 +3236,13 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
*/
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)
*/
@@ -3243,25 +3329,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)
*/
@@ -3296,18 +3382,26 @@ interface ContainerExecOptions {
cwd?: string;
env?: Record<string, string>;
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<number>;
output(): Promise<ExecOutput>;
kill(signal?: number): void;
resize(cols: number, rows: number): void;
}
interface Container {
get running(): boolean;
@@ -3334,25 +3428,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<string, string>;
instance?: "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | ContainerStartResources;
labels?: Record<string, string>;
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.
@@ -3361,19 +3472,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)
*/
@@ -3389,13 +3500,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)
*/
@@ -3455,7 +3566,7 @@ interface WorkerLoaderModule {
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer;
wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
@@ -3463,7 +3574,7 @@ interface WorkerLoaderWorkerCode {
allowExperimental?: boolean;
limits?: workerdResourceLimits;
mainModule: string;
modules: Record<string, WorkerLoaderModule | string>;
modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
@@ -3485,7 +3596,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)
*/
@@ -3494,11 +3605,13 @@ declare abstract class Performance {
interface Tracing {
enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
startActiveSpan<T, A extends unknown[]>(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<string, boolean | number | string | undefined>): this;
end(): void;
}
/**
@@ -4138,6 +4251,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[];
@@ -10035,6 +10155,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;
@@ -10127,6 +10404,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 = {
/**
@@ -10793,6 +11077,15 @@ interface BrowserRunBaseOptions {
*/
cacheTTL?: number;
}
/**
* Backend selection, mixed into the options of the quick actions that support it.
* Deliberately not part of `BrowserRunBaseOptions`: `scrape`, `links` and `snapshot`
* reject an alternate backend, so they must not accept the field.
*/
interface BrowserRunAlternateBackendOptions {
/** Render with an alternate browser backend instead of the default one. */
browser?: 'kitesurf';
}
/** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/
type BrowserRunCommonOptions = (BrowserRunBaseOptions & {
/** URL to navigate to, e.g. `"https://example.com"`. */
@@ -10827,7 +11120,7 @@ type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
scrollPage?: boolean;
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
};
} & BrowserRunAlternateBackendOptions;
type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @see https://pptr.dev/api/puppeteer.pdfoptions */
pdfOptions?: {
@@ -10863,7 +11156,7 @@ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @default 30000 */
timeout?: number;
};
};
} & BrowserRunAlternateBackendOptions;
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
/** CSS selectors to scrape. At least one element is required. */
elements: Array<{
@@ -10876,10 +11169,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<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;
};
/** 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;
} & BrowserRunAlternateBackendOptions;
interface BrowserRunJsonBaseOptions {
/** Custom AI models to try in order. Max 3. Falls back to next on error. */
custom_ai?: Array<{
@@ -10893,7 +11205,7 @@ interface BrowserRunJsonBaseOptions {
* Options for the `json` quick action.
* At least one of `prompt` or `response_format` must be provided.
*/
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions & ({
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
/** Natural-language prompt describing what data to extract. */
prompt: string;
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
@@ -10904,14 +11216,80 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
response_format: AiTextGenerationResponseFormat;
});
type BrowserRunContentOptions = BrowserRunCommonOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
type BrowserRunContentOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
type BrowserRunRedirectHop = {
/** URL that returned the redirect. */
url: string;
/** HTTP status of the redirect. */
status: number;
/** Redirect response headers, including `location`. */
headers: Record<string, string>;
};
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<string, string>;
/** 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 `<h2>`. */
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;
@@ -10924,6 +11302,7 @@ type BrowserRunLinksSuccessResponse = {
success: true;
/** Extracted links */
result: string[];
meta: BrowserRunResponseMeta;
};
/** Success response for `scrape` action. */
type BrowserRunScrapeSuccessResponse = {
@@ -10954,15 +11333,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;
};
@@ -10971,12 +11368,14 @@ type BrowserRunJsonSuccessResponse = {
success: true;
/** JSON data extracted from the page using an AI model */
result: Record<string, unknown>;
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 = {
@@ -11086,9 +11485,10 @@ declare abstract class BrowserRun {
*/
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
/**
* 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):**
@@ -11136,6 +11536,26 @@ declare abstract class BrowserRun {
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
*/
quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;
/**
* 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<Response>;
}
/**
* In addition to the properties you can set in the RequestInit dict
@@ -12206,6 +12626,13 @@ interface ForwardableEmailMessage extends EmailMessage {
* @returns A promise that resolves when the email message is replied.
*/
reply(message: EmailMessage): Promise<EmailSendResult>;
/**
* Reply to the sender of this email message with a message built from the given
* fields. Threading headers (In-Reply-To/References) are set automatically.
* @param builder The reply message contents.
* @returns A promise that resolves when the email message is replied.
*/
reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;
}
/** A file attachment for an email message */
type EmailAttachment = {
@@ -12226,23 +12653,46 @@ interface EmailAddress {
name: string;
email: string;
}
/**
* Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or
* `bcc` must be provided.
*/
type EmailDestinations = {
to?: string | EmailAddress | (string | EmailAddress)[];
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
} & ({
to: string | EmailAddress | (string | EmailAddress)[];
} | {
cc: string | EmailAddress | (string | EmailAddress)[];
} | {
bcc: string | EmailAddress | (string | EmailAddress)[];
});
/**
* Fields shared by all composed emails (no recipients). Used directly by
* `ForwardableEmailMessage.reply()`, which always replies to the original
* sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.
*/
interface EmailReplyMessageBuilder {
from: string | EmailAddress;
subject: string;
replyTo?: string | EmailAddress;
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}
/**
* Fields for composing an email without constructing raw MIME, for
* `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.
*/
type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;
/**
* A binding that allows a Worker to send email messages.
*/
interface SendEmail {
send(message: EmailMessage): Promise<EmailSendResult>;
send(builder: {
from: string | EmailAddress;
to: string | EmailAddress | (string | EmailAddress)[];
subject: string;
replyTo?: string | EmailAddress;
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}): Promise<EmailSendResult>;
send(builder: EmailMessageBuilder): Promise<EmailSendResult>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
@@ -12396,6 +12846,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.
*/
@@ -12417,6 +12876,78 @@ interface Hyperdrive {
*/
readonly database: string;
}
/**
* A handle to a dynamically-provisioned Hyperdrive connection, returned by
* `HyperdriveApi.get()`.
*/
interface HyperdriveDynamic extends Disposable {
/**
* The database name to use when connecting through this Hyperdrive.
*/
readonly database: Promise<string>;
/*
* The randomly generated user to use when authenticating to your
* database via Hyperdrive.
*/
readonly user: Promise<string>;
/*
* The randomly generated password to use when authenticating to your
* database via Hyperdrive.
*/
readonly password: Promise<string>;
/**
* Open a TCP socket to the target database through this Hyperdrive.
*
*/
connect(): Promise<Socket>;
}
/**
* Binding that provisions Hyperdrive connections at request time, rather than
* from static configuration.
*/
interface HyperdriveDynamicApi {
/**
* Provision a connection for the database described by `args`.
*
*/
get(args: HyperdriveDynamicConfig): Promise<HyperdriveDynamic>;
/**
* Get a pre-generated connection string used for connecting to dynamic Hyperdrive.
*/
getHyperdriveConnectionString(connectionString: string): Promise<string>;
}
/**
* Parameters identifying the database that a dynamically-provisioned
* Hyperdrive connection should target.
*/
interface HyperdriveDynamicConfig {
/**
* Generated connection string to pass into the dynamic worker.
*
*/
dynamicHyperdriveConnectionString: string;
/**
* Connection string for the origin database Hyperdrive should connect to.
* Contains credentials, so treat it as a secret.
*
* The scheme selects the database engine. PostgreSQL origins are supported.
*/
connectionString: string;
/**
* Region in which to place the connection pool. See the Hyperdrive
* documentation for the set of supported regions.
*/
targetRegion: string;
/**
* Whether Hyperdrive should cache query results for this connection.
*/
cachingEnabled?: boolean;
/**
* Maximum number of connections the pool may open to the origin database.
* Defaults to 60.
*/
maxConnections?: number;
}
// Copyright (c) 2024 Cloudflare, Inc.
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0
@@ -12428,6 +12959,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<Uint8Array> | TextRasterize;
type ImageTransform = {
width?: number;
height?: number;
@@ -12517,6 +13069,9 @@ interface ImageUploadOptions {
requireSignedURLs?: boolean;
metadata?: Record<string, unknown>;
creator?: string;
/**
* If 'base64', the input data will be decoded from base64 before processing
*/
encoding?: 'base64';
}
interface ImageUpdateOptions {
@@ -12524,11 +13079,40 @@ interface ImageUpdateOptions {
metadata?: Record<string, unknown>;
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<string, ImageMetadataFilterValue>;
}
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<string, unknown>;
creator?: string;
expiresIn?: number;
}
interface ImageDirectUploadResult {
id: string;
uploadURL: string;
}
interface ImageList {
images: ImageMetadata[];
@@ -12546,6 +13130,13 @@ interface ImageHandle {
* @returns ReadableStream of image bytes, or null if not found
*/
bytes(): Promise<ReadableStream<Uint8Array> | 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<string>;
/**
* Update hosted image metadata
* @param options Properties to update
@@ -12581,6 +13172,14 @@ interface HostedImagesBinding {
* @throws {@link ImagesError} if list fails
*/
list(options?: ImageListOptions): Promise<ImageList>;
/**
* 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<ImageDirectUploadResult>;
}
interface ImagesBinding {
/**
@@ -12595,6 +13194,13 @@ interface ImagesBinding {
* @returns A transform handle
*/
input(stream: ReadableStream<Uint8Array>, 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
*/
@@ -12624,11 +13230,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
*/
@@ -13064,6 +13674,11 @@ declare namespace CloudflareWorkersModule {
export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
export type WorkflowDelayDuration = WorkflowSleepDuration;
export type WorkflowDynamicDelayContext = {
ctx: WorkflowStepContext<WorkflowDelayFunction>;
error: Error;
};
export type WorkflowDelayFunction = (input: WorkflowDynamicDelayContext) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;
export type WorkflowTimeoutDuration = WorkflowSleepDuration;
export type WorkflowRetentionDuration = WorkflowSleepDuration;
export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
@@ -13071,12 +13686,32 @@ declare namespace CloudflareWorkersModule {
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
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<WorkflowStepConfig, 'retries'> & {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
backoff?: WorkflowBackoff;
};
};
type WorkflowStepConfigWithDelayFunction = Omit<WorkflowStepConfig, 'retries'> & {
retries: {
limit: number;
delay: WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
};
export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;
export type WorkflowCronSchedule = {
/** Cron expression that triggered this event. */
@@ -13097,28 +13732,51 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext = {
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
step: {
name: string;
count: number;
};
attempt: number;
config: WorkflowStepConfig;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
};
export type WorkflowRollbackContext<T = unknown> = {
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<T = unknown, Delay = WorkflowDelayDuration | number> = {
ctx: WorkflowStepContext<Delay>;
error: Error;
output: T | undefined;
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
stepName: string;
};
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown> = {
rollback: WorkflowRollbackHandler<T>;
export type WorkflowRollbackHandler<T = unknown, Delay = WorkflowDelayDuration | number> = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown, Delay = WorkflowDelayDuration | number> = {
rollback: WorkflowRollbackHandler<T, Delay>;
rollbackConfig?: WorkflowStepRollbackConfig;
};
export abstract class WorkflowStep {
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
// 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<T>(...)`) 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<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext<WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayDuration | number>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
@@ -13894,11 +14552,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;
} | {
@@ -13915,7 +14574,11 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOutputOptions = {
format?: OutputFormat;
};
type ConversionOptions = {
output?: ConversionOutputOptions;
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
@@ -14010,7 +14673,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;
@@ -14029,6 +14692,7 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
@@ -14063,11 +14727,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;
@@ -14545,10 +15220,31 @@ declare abstract class Workflow<PARAMS = unknown> {
* @returns A promise that resolves with a list of handles for the created instances.
*/
public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;
/**
* 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<WorkflowBatchDeleteResult>;
}
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<PARAMS = unknown> {
/**
* An id for your Workflow instance. Must be unique within the Workflow.
@@ -14566,6 +15262,9 @@ interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
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)
@@ -14583,6 +15282,13 @@ interface WorkflowError {
code?: number;
message: string;
}
interface WorkflowInstanceTerminateOptions {
/**
* If true, run registered rollback handlers before terminating the instance.
* Only steps that registered rollback handlers are rolled back.
*/
rollback?: boolean;
}
interface WorkflowInstanceRestartOptions {
/**
* Restart from a specific step. If omitted, the instance restarts from the beginning.
@@ -14616,14 +15322,19 @@ declare abstract class WorkflowInstance {
public resume(): Promise<void>;
/**
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
* @param options Options for termination, including whether registered rollback handlers should run.
*/
public terminate(): Promise<void>;
public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;
/**
* Restart the instance. Optionally restart from a specific step, preserving
* cached results for all steps before it.
* @param options Options for the restart, including an optional step to restart from.
*/
public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
/**
* Delete the instance and its stored state.
*/
public delete(): Promise<void>;
/**
* Returns the current status of the instance.
*/
+3 -11
View File
@@ -7,7 +7,9 @@
// Shared `recflare` DB (created manually with `wrangler d1 create recflare`; the
// "local" placeholder is spliced out at deploy time). The `chat` worker owns the
// `message` table (schema/migration here); its own migrations_table keeps history
// separate from the other workers' migrations on the shared database.
// separate from the other workers' migrations on the shared database. Chat keeps its
// two chat-privacy settings in `player_settings` (owned by the `playersettings` worker)
// rather than in a table of its own, so they sit with the player's other toggles.
"d1_databases": [
{
"binding": "DB",
@@ -17,16 +19,6 @@
"migrations_table": "d1_migrations_chat"
}
],
// Per-player settings KV, owned by the `playersettings` worker. Chat keeps the two
// chat-privacy settings in it rather than in a table of its own, so they sit with the
// player's other toggles. The "local" id placeholder is replaced with the real id from
// RECFLARE_KV at deploy time.
"kv_namespaces": [
{
"binding": "RECFLARE_PLAYER_SETTINGS",
"id": "local"
}
],
"logpush": false,
// Shared Secrets Store holding the HS256 JWT signing key. Every worker binds the
// same store as JWT_SECRET so tokens signed by `auth` verify here. The "local"
+8 -8
View File
@@ -120,11 +120,10 @@ substitutes the same as asking by id.
## Bindings
| Binding | Type | Notes |
| -------------------------- | ------------- | ------------------------------------------------------------ |
| `DB` | D1 | Shared `recflare` database — rooms, room instances, presence |
| `JWT_SECRET` | Secrets Store | Shared HS256 signing key (see the `auth` README) |
| `RECFLARE_PLAYER_SETTINGS` | KV | The `playersettings` map — `/player/avoidjuniors` |
| Binding | Type | Notes |
| ------------ | ------------- | ----------------------------------------------------------------------------- |
| `DB` | D1 | Shared `recflare` database — rooms, room instances, presence, player settings |
| `JWT_SECRET` | Secrets Store | Shared HS256 signing key (see the `auth` README) |
The `presence` and `room_instance` tables are owned/migrated by the `rooms` worker. This
worker owns one table of its own, `room_invite` (`migrations/0001_room_invite.sql`, applied
@@ -134,9 +133,10 @@ invite the `RoomInviteId` the response carries. Its `created_at` is epoch second
`rooms` worker's cron deletes rows older than `ROOM_INVITE_TTL_SECONDS` (5 minutes), and a
redeem that misses the row answers `RoomInviteExpired`.
The settings KV is owned by the `playersettings` worker; this worker touches exactly one
key in it, the "avoid juniors" preference, and its write merges (as that worker's own PUT
does) so the rest of the player's settings survive.
The `player_settings` table (one JSON map per player) is owned by the `playersettings`
worker; this worker touches exactly one key in it, the "avoid juniors" preference
(`/player/avoidjuniors`), and its write merges (as that worker's own PUT does) so the rest
of the player's settings survive.
## Known gaps
+5 -8
View File
@@ -13,20 +13,17 @@ export type Env = SharedHonoEnv & {
// player's personal dorm room on first entry, and holds player presence — the
// room instance each player is currently in (written by matchmake/heartbeat,
// read by the heartbeat and the batch `/player` lookup). See @repo/domain's
// presence-db (table owned/migrated by the `rooms` worker).
// presence-db (table owned/migrated by the `rooms` worker). Also holds the
// per-player settings map (`player_settings`, owned by the `playersettings`
// worker), touched only by `GET|PUT /player/avoidjuniors`: the "avoid juniors"
// preference is a matchmaking question the client asks this worker, but it is
// stored with the rest of the player's settings, not in presence.
DB: D1Database
/**
* The `notify` worker's NotificationsHub DO — pushes websocket notifications to a
* player. Used by `POST /invite` to deliver the game-invite message to the invitee.
*/
RECFLARE_NOTIFICATIONS_HUB: DurableObjectNamespace<NotificationsHub>
/**
* The per-player settings map the `playersettings` worker owns (`player:<id>` → JSON
* `{ key: value }`). Read-only here, and only by `GET /player/avoidjuniors`: the
* "avoid juniors" preference is a matchmaking question the client asks this worker,
* but it is stored with the rest of the player's settings, not in presence.
*/
RECFLARE_PLAYER_SETTINGS: KVNamespace
/**
* Room substitutions applied at matchmake time, as comma-separated `<fromRoomId>=<to>`
* pairs — e.g. `2=100` or `2=MyHub,3=100` — where `from` is the room id the client
+5 -5
View File
@@ -468,12 +468,12 @@ function parseSettingBool(value: unknown): boolean | undefined {
}
}
/** The player's settings map from the KV the `playersettings` worker owns. */
/** The player's settings map from the `player_settings` table the `playersettings` worker owns. */
async function getPlayerSettings(
env: Env,
accountId: number
): Promise<Record<string, string> | null> {
return readPlayerSettings(env.RECFLARE_PLAYER_SETTINGS, accountId).catch(() => null)
return readPlayerSettings(env.DB, accountId).catch(() => null)
}
/**
@@ -496,14 +496,14 @@ async function readAvoidJuniors(env: Env, accountId: number): Promise<boolean> {
* every setting the player has (OOBE state, tutorial mask, …), so storing this one on its
* own would wipe the rest. The key is whichever spelling the map already carries, which is
* why this doesn't go through `mergePlayerSettings` — but like it, re-posting the stored
* value writes nothing. A KV read failure throws (a 500) rather than reading as an empty
* value writes nothing. A read failure throws (a 500) rather than reading as an empty
* map, which would store this one key over everything the player had.
*/
async function writeAvoidJuniors(env: Env, accountId: number, value: boolean): Promise<void> {
const stored = await readPlayerSettings(env.RECFLARE_PLAYER_SETTINGS, accountId)
const stored = await readPlayerSettings(env.DB, accountId)
const merged: Record<string, string> = { ...stored }
merged[findAvoidJuniorsKey(merged) ?? AVOID_JUNIORS_KEY] = value ? 'True' : 'False'
await putPlayerSettingsIfChanged(env.RECFLARE_PLAYER_SETTINGS, accountId, stored, merged)
await putPlayerSettingsIfChanged(env.DB, accountId, stored, merged)
}
/**
+31 -14
View File
@@ -15,7 +15,9 @@ import {
GAME_VERSION,
getRoomInstance,
modifySubRoom,
PLAYER_SETTINGS_SCHEMA_DDL,
PRESENCE_SCHEMA_DDL,
readPlayerSettings,
recordRoomVisit,
ROOM_INSTANCE_SCHEMA_DDL,
ROOM_INVITE_SCHEMA_DDL,
@@ -137,6 +139,23 @@ const TEST_ROOMS = [
},
]
/** Seed a player's `player_settings` row with raw JSON text — what the KV value used to be. */
const seedSettings = (playerId: number, data: string) =>
env.DB.prepare(
`INSERT INTO player_settings (account_id, data) VALUES (?1, ?2)
ON CONFLICT (account_id) DO UPDATE SET data = excluded.data`
)
.bind(playerId, data)
.run()
/** The row's `data` exactly as stored — a seeded value surviving a request means no write happened. */
const rawSettings = async (playerId: number) =>
(
await env.DB.prepare('SELECT data FROM player_settings WHERE account_id = ?1')
.bind(playerId)
.first<{ data: string }>()
)?.data ?? null
beforeAll(async () => {
// Seed the shared JWT signing key into the local Secrets Store so .get() resolves.
await adminSecretsStore(env.JWT_SECRET).create('test-signing-key')
@@ -154,6 +173,8 @@ beforeAll(async () => {
for (const stmt of ROOM_INVITE_SCHEMA_DDL) await env.DB.prepare(stmt).run()
// Stats (owned by this worker) — the presence cron samples the online count into it.
for (const stmt of STAT_SCHEMA_DDL) await env.DB.prepare(stmt).run()
// Player settings (owned by the playersettings worker) — /player/avoidjuniors is one key.
for (const stmt of PLAYER_SETTINGS_SCHEMA_DDL) await env.DB.prepare(stmt).run()
// Accounts table (owned by the auth worker) — dorm creation reads the username
// to name the room. Seed the players the dorm tests authenticate as.
@@ -544,11 +565,11 @@ describe('public endpoints', () => {
expect(players[0]).toMatchObject({ playerId: 1, isOnline: true, appVersion: GAME_VERSION })
})
// The "avoid juniors" preference lives in the playersettings KV map, not in presence.
// The "avoid juniors" preference lives in the playersettings map, not in presence.
// The body is a BARE boolean — the client reads the whole body as the value.
describe('GET /player/avoidjuniors', () => {
const settings = async (playerId: number, map: Record<string, string>) =>
env.RECFLARE_PLAYER_SETTINGS.put(`player:${playerId}`, JSON.stringify(map))
seedSettings(playerId, JSON.stringify(map))
const read = async (playerId: number) => {
const res = await exports.default.fetch(`${ORIGIN}/player/avoidjuniors`, {
@@ -593,8 +614,7 @@ describe('public endpoints', () => {
})
describe('PUT /player/avoidjuniors', () => {
const stored = async (playerId: number) =>
env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(`player:${playerId}`, 'json')
const stored = async (playerId: number) => readPlayerSettings(env.DB, playerId)
const write = async (playerId: number, body: string) => {
const res = await exports.default.fetch(`${ORIGIN}/player/avoidjuniors`, {
@@ -627,8 +647,8 @@ describe('public endpoints', () => {
// The map holds every setting the player has, so the write must not replace it.
test('merges into the player’s other settings', async () => {
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:3201',
await seedSettings(
3201,
JSON.stringify({ 'Recroom.OOBE': '77', TUTORIAL_COMPLETE_MASK: '11' })
)
await write(3201, 'avoidJuniors=True')
@@ -642,24 +662,21 @@ describe('public endpoints', () => {
// Whichever spelling the player's map already carries is the one overwritten —
// two keys for one preference would make the read depend on their order.
test('overwrites an existing key rather than adding a second one', async () => {
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:3202',
JSON.stringify({ AVOID_JUNIORS: 'True' })
)
await seedSettings(3202, JSON.stringify({ AVOID_JUNIORS: 'True' }))
expect(await write(3202, 'avoidJuniors=False')).toBe(false)
expect(await stored(3202)).toEqual({ AVOID_JUNIORS: 'False' })
})
// Re-posting the stored value writes nothing to KV — writes are the cost, and the
// Re-posting the stored value writes nothing — writes are the cost, and the
// client posts this freely. The raw value is seeded with whitespace JSON.stringify
// never produces; surviving the PUT untouched means no write happened. Holds across
// the loose key match too: `AVOID_JUNIORS: 'True'` already says what `avoidJuniors=True`
// asks for.
test('does not write KV when the value is already stored', async () => {
test('does not write when the value is already stored', async () => {
const padded = '{ "Recroom.OOBE": "77", "AVOID_JUNIORS": "True" }'
await env.RECFLARE_PLAYER_SETTINGS.put('player:3205', padded)
await seedSettings(3205, padded)
expect(await write(3205, 'avoidJuniors=True')).toBe(true)
expect(await env.RECFLARE_PLAYER_SETTINGS.get('player:3205', 'text')).toBe(padded)
expect(await rawSettings(3205)).toBe(padded)
expect(await write(3205, 'avoidJuniors=False')).toBe(false)
expect(await stored(3205)).toEqual({ 'Recroom.OOBE': '77', AVOID_JUNIORS: 'False' })
+950 -241
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20260625.1 2026-06-16 nodejs_compat
// Runtime types generated with workerd@1.20260831.1 2026-06-16 nodejs_compat
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
@@ -19,26 +19,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)
@@ -96,61 +96,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)
*/
@@ -168,23 +168,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.
@@ -193,7 +194,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)
*/
@@ -359,7 +360,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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)
*/
@@ -404,6 +405,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,
@@ -425,6 +427,7 @@ interface ExecutionContext<Props = unknown> {
cache?: CacheContext;
readonly access?: CloudflareAccessContext;
tracing: Tracing;
abort(reason?: any): void;
}
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
@@ -513,7 +516,7 @@ declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded
getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
}
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -542,7 +545,7 @@ interface DurableObjectState<Props = unknown> {
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string): void;
abort(reason?: string, options?: DurableObjectAbortOptions): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
@@ -578,6 +581,9 @@ interface DurableObjectStorage {
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectAbortOptions {
retryAlarm?: boolean;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
@@ -628,26 +634,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)
*/
@@ -684,13 +690,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)
@@ -703,45 +709,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)
*/
@@ -762,7 +768,7 @@ interface EventListenerObject<EventType extends Event = Event> {
}
type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
/**
* 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)
*/
@@ -775,13 +781,13 @@ declare class EventTarget<EventMap extends Record<string, Event> = Record<string
*/
addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, 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 extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, 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)
*/
@@ -813,7 +819,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)
*/
@@ -826,7 +832,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)
*/
@@ -838,13 +844,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)
*/
@@ -860,12 +866,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<void>;
}
@@ -873,20 +884,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<any>): 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)
*/
@@ -925,7 +936,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)
*/
@@ -943,13 +954,13 @@ declare class Blob {
*/
bytes(): Promise<Uint8Array>;
/**
* 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<string>;
/**
* 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)
*/
@@ -966,13 +977,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)
*/
@@ -989,7 +1000,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)
*/
@@ -1022,14 +1033,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)
*/
@@ -1057,7 +1068,7 @@ declare abstract class SubtleCrypto {
*/
encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/**
* 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)
*/
@@ -1075,7 +1086,7 @@ declare abstract class SubtleCrypto {
*/
verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;
/**
* 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)
*/
@@ -1093,7 +1104,7 @@ declare abstract class SubtleCrypto {
*/
deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
/**
* 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)
*/
@@ -1111,13 +1122,13 @@ declare abstract class SubtleCrypto {
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* 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<ArrayBuffer>;
/**
* 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)
*/
@@ -1125,20 +1136,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)
*/
@@ -1255,12 +1266,15 @@ interface CryptoKeyArbitraryKeyAlgorithm {
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
readonly digest: Promise<ArrayBuffer>;
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)
*/
@@ -1277,20 +1291,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)
*/
@@ -1347,6 +1361,9 @@ declare class ErrorEvent extends Event {
get error(): any;
}
interface ErrorEventErrorEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
message?: string;
filename?: string;
lineno?: number;
@@ -1359,135 +1376,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<any>;
/**
* 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<string>;
/* Returns a list of values in the list. */
values(): IterableIterator<(File | string)>;
forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;
[Symbol.iterator](): IterableIterator<[
@@ -1566,19 +1587,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)
*/
@@ -1587,58 +1608,55 @@ declare abstract class FetchEvent extends ExtendableEvent {
}
type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;
/**
* 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<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;
/* Returns an iterator allowing to go through all key/value pairs contained in this object. */
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<string>;
/* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
values(): IterableIterator<string>;
[Symbol.iterator](): IterableIterator<[
key: string,
@@ -1701,7 +1719,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)
*/
@@ -1719,7 +1737,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)
*/
@@ -1727,7 +1745,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)
*/
@@ -1758,13 +1776,13 @@ declare var Request: {
*/
interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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<CfHostMetadata, Cf>;
/**
* 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)
*/
@@ -1776,7 +1794,7 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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)
*/
@@ -1802,13 +1820,13 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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)
*/
@@ -2197,7 +2215,7 @@ type ReadableStreamReadResult<R = any> = {
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)
*/
@@ -2215,13 +2233,13 @@ interface ReadableStream<R = any> {
*/
cancel(reason?: any): Promise<void>;
/**
* 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<R>;
/**
* 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)
*/
@@ -2233,13 +2251,13 @@ interface ReadableStream<R = any> {
*/
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
/**
* 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<R>, options?: StreamPipeOptions): Promise<void>;
/**
* 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)
*/
@@ -2251,7 +2269,7 @@ interface ReadableStream<R = any> {
[Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
}
/**
* 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)
*/
@@ -2283,7 +2301,7 @@ declare class ReadableStreamDefaultReader<R = any> {
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)
*/
@@ -2292,13 +2310,13 @@ declare class ReadableStreamBYOBReader {
get closed(): Promise<void>;
cancel(reason?: any): Promise<void>;
/**
* 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<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* 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)
*/
@@ -2317,7 +2335,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)
*/
@@ -2343,13 +2361,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<R = any> {
/**
* 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)
*/
@@ -2361,32 +2379,32 @@ declare abstract class ReadableStreamDefaultController<R = any> {
*/
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)
*/
@@ -2398,7 +2416,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)
*/
@@ -2411,7 +2429,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)
*/
@@ -2423,7 +2441,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)
*/
@@ -2448,7 +2466,7 @@ declare abstract class TransformStreamDefaultController<O = any> {
*/
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)
*/
@@ -2470,14 +2488,14 @@ interface ReadableWritablePair<R = any, W = any> {
writable: WritableStream<W>;
}
/**
* 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<W = any> {
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)
*/
@@ -2489,83 +2507,83 @@ declare class WritableStream<W = any> {
*/
abort(reason?: any): Promise<void>;
/**
* 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<void>;
/**
* 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<W>;
}
/**
* 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<W = any> {
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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<I = any, O = any> {
constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
/**
* 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<O>;
/**
* 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)
*/
@@ -2584,7 +2602,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)
*/
@@ -2592,7 +2610,7 @@ declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
* The **`DecompressionStream`** interface of the Compression Streams API decompresses 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/DecompressionStream)
*/
@@ -2600,7 +2618,7 @@ declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBuf
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. It is the streaming equivalent of TextEncoder. 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/TextEncoderStream)
*/
@@ -2609,7 +2627,7 @@ declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
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)
*/
@@ -2758,6 +2776,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;
@@ -2778,7 +2802,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)
*/
@@ -2803,121 +2827,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)
*/
@@ -2937,13 +2961,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)
*/
@@ -2993,25 +3017,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<string>;
/* Returns a list of values in the search params. */
values(): IterableIterator<string>;
forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;
/*function toString() { [native code] }*/
@@ -3021,18 +3042,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 {
@@ -3065,7 +3146,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)
*/
@@ -3084,13 +3165,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;
@@ -3102,7 +3186,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)
*/
@@ -3119,20 +3203,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<WebSocketEventMap> {
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)
*/
@@ -3152,13 +3236,13 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
*/
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)
*/
@@ -3245,25 +3329,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)
*/
@@ -3298,18 +3382,26 @@ interface ContainerExecOptions {
cwd?: string;
env?: Record<string, string>;
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<number>;
output(): Promise<ExecOutput>;
kill(signal?: number): void;
resize(cols: number, rows: number): void;
}
interface Container {
get running(): boolean;
@@ -3336,25 +3428,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<string, string>;
instance?: "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | ContainerStartResources;
labels?: Record<string, string>;
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.
@@ -3363,19 +3472,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)
*/
@@ -3391,13 +3500,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)
*/
@@ -3457,7 +3566,7 @@ interface WorkerLoaderModule {
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer;
wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
@@ -3465,7 +3574,7 @@ interface WorkerLoaderWorkerCode {
allowExperimental?: boolean;
limits?: workerdResourceLimits;
mainModule: string;
modules: Record<string, WorkerLoaderModule | string>;
modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
@@ -3487,7 +3596,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)
*/
@@ -3496,11 +3605,13 @@ declare abstract class Performance {
interface Tracing {
enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
startActiveSpan<T, A extends unknown[]>(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<string, boolean | number | string | undefined>): this;
end(): void;
}
/**
@@ -4140,6 +4251,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[];
@@ -10037,6 +10155,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;
@@ -10129,6 +10404,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 = {
/**
@@ -10795,6 +11077,15 @@ interface BrowserRunBaseOptions {
*/
cacheTTL?: number;
}
/**
* Backend selection, mixed into the options of the quick actions that support it.
* Deliberately not part of `BrowserRunBaseOptions`: `scrape`, `links` and `snapshot`
* reject an alternate backend, so they must not accept the field.
*/
interface BrowserRunAlternateBackendOptions {
/** Render with an alternate browser backend instead of the default one. */
browser?: 'kitesurf';
}
/** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/
type BrowserRunCommonOptions = (BrowserRunBaseOptions & {
/** URL to navigate to, e.g. `"https://example.com"`. */
@@ -10829,7 +11120,7 @@ type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
scrollPage?: boolean;
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
};
} & BrowserRunAlternateBackendOptions;
type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @see https://pptr.dev/api/puppeteer.pdfoptions */
pdfOptions?: {
@@ -10865,7 +11156,7 @@ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @default 30000 */
timeout?: number;
};
};
} & BrowserRunAlternateBackendOptions;
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
/** CSS selectors to scrape. At least one element is required. */
elements: Array<{
@@ -10878,10 +11169,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<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;
};
/** 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;
} & BrowserRunAlternateBackendOptions;
interface BrowserRunJsonBaseOptions {
/** Custom AI models to try in order. Max 3. Falls back to next on error. */
custom_ai?: Array<{
@@ -10895,7 +11205,7 @@ interface BrowserRunJsonBaseOptions {
* Options for the `json` quick action.
* At least one of `prompt` or `response_format` must be provided.
*/
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions & ({
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
/** Natural-language prompt describing what data to extract. */
prompt: string;
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
@@ -10906,14 +11216,80 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
response_format: AiTextGenerationResponseFormat;
});
type BrowserRunContentOptions = BrowserRunCommonOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
type BrowserRunContentOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
type BrowserRunRedirectHop = {
/** URL that returned the redirect. */
url: string;
/** HTTP status of the redirect. */
status: number;
/** Redirect response headers, including `location`. */
headers: Record<string, string>;
};
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<string, string>;
/** 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 `<h2>`. */
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;
@@ -10926,6 +11302,7 @@ type BrowserRunLinksSuccessResponse = {
success: true;
/** Extracted links */
result: string[];
meta: BrowserRunResponseMeta;
};
/** Success response for `scrape` action. */
type BrowserRunScrapeSuccessResponse = {
@@ -10956,15 +11333,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;
};
@@ -10973,12 +11368,14 @@ type BrowserRunJsonSuccessResponse = {
success: true;
/** JSON data extracted from the page using an AI model */
result: Record<string, unknown>;
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 = {
@@ -11088,9 +11485,10 @@ declare abstract class BrowserRun {
*/
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
/**
* 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):**
@@ -11138,6 +11536,26 @@ declare abstract class BrowserRun {
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
*/
quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;
/**
* 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<Response>;
}
/**
* In addition to the properties you can set in the RequestInit dict
@@ -12208,6 +12626,13 @@ interface ForwardableEmailMessage extends EmailMessage {
* @returns A promise that resolves when the email message is replied.
*/
reply(message: EmailMessage): Promise<EmailSendResult>;
/**
* Reply to the sender of this email message with a message built from the given
* fields. Threading headers (In-Reply-To/References) are set automatically.
* @param builder The reply message contents.
* @returns A promise that resolves when the email message is replied.
*/
reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;
}
/** A file attachment for an email message */
type EmailAttachment = {
@@ -12228,23 +12653,46 @@ interface EmailAddress {
name: string;
email: string;
}
/**
* Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or
* `bcc` must be provided.
*/
type EmailDestinations = {
to?: string | EmailAddress | (string | EmailAddress)[];
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
} & ({
to: string | EmailAddress | (string | EmailAddress)[];
} | {
cc: string | EmailAddress | (string | EmailAddress)[];
} | {
bcc: string | EmailAddress | (string | EmailAddress)[];
});
/**
* Fields shared by all composed emails (no recipients). Used directly by
* `ForwardableEmailMessage.reply()`, which always replies to the original
* sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.
*/
interface EmailReplyMessageBuilder {
from: string | EmailAddress;
subject: string;
replyTo?: string | EmailAddress;
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}
/**
* Fields for composing an email without constructing raw MIME, for
* `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.
*/
type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;
/**
* A binding that allows a Worker to send email messages.
*/
interface SendEmail {
send(message: EmailMessage): Promise<EmailSendResult>;
send(builder: {
from: string | EmailAddress;
to: string | EmailAddress | (string | EmailAddress)[];
subject: string;
replyTo?: string | EmailAddress;
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}): Promise<EmailSendResult>;
send(builder: EmailMessageBuilder): Promise<EmailSendResult>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
@@ -12398,6 +12846,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.
*/
@@ -12419,6 +12876,78 @@ interface Hyperdrive {
*/
readonly database: string;
}
/**
* A handle to a dynamically-provisioned Hyperdrive connection, returned by
* `HyperdriveApi.get()`.
*/
interface HyperdriveDynamic extends Disposable {
/**
* The database name to use when connecting through this Hyperdrive.
*/
readonly database: Promise<string>;
/*
* The randomly generated user to use when authenticating to your
* database via Hyperdrive.
*/
readonly user: Promise<string>;
/*
* The randomly generated password to use when authenticating to your
* database via Hyperdrive.
*/
readonly password: Promise<string>;
/**
* Open a TCP socket to the target database through this Hyperdrive.
*
*/
connect(): Promise<Socket>;
}
/**
* Binding that provisions Hyperdrive connections at request time, rather than
* from static configuration.
*/
interface HyperdriveDynamicApi {
/**
* Provision a connection for the database described by `args`.
*
*/
get(args: HyperdriveDynamicConfig): Promise<HyperdriveDynamic>;
/**
* Get a pre-generated connection string used for connecting to dynamic Hyperdrive.
*/
getHyperdriveConnectionString(connectionString: string): Promise<string>;
}
/**
* Parameters identifying the database that a dynamically-provisioned
* Hyperdrive connection should target.
*/
interface HyperdriveDynamicConfig {
/**
* Generated connection string to pass into the dynamic worker.
*
*/
dynamicHyperdriveConnectionString: string;
/**
* Connection string for the origin database Hyperdrive should connect to.
* Contains credentials, so treat it as a secret.
*
* The scheme selects the database engine. PostgreSQL origins are supported.
*/
connectionString: string;
/**
* Region in which to place the connection pool. See the Hyperdrive
* documentation for the set of supported regions.
*/
targetRegion: string;
/**
* Whether Hyperdrive should cache query results for this connection.
*/
cachingEnabled?: boolean;
/**
* Maximum number of connections the pool may open to the origin database.
* Defaults to 60.
*/
maxConnections?: number;
}
// Copyright (c) 2024 Cloudflare, Inc.
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0
@@ -12430,6 +12959,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<Uint8Array> | TextRasterize;
type ImageTransform = {
width?: number;
height?: number;
@@ -12519,6 +13069,9 @@ interface ImageUploadOptions {
requireSignedURLs?: boolean;
metadata?: Record<string, unknown>;
creator?: string;
/**
* If 'base64', the input data will be decoded from base64 before processing
*/
encoding?: 'base64';
}
interface ImageUpdateOptions {
@@ -12526,11 +13079,40 @@ interface ImageUpdateOptions {
metadata?: Record<string, unknown>;
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<string, ImageMetadataFilterValue>;
}
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<string, unknown>;
creator?: string;
expiresIn?: number;
}
interface ImageDirectUploadResult {
id: string;
uploadURL: string;
}
interface ImageList {
images: ImageMetadata[];
@@ -12548,6 +13130,13 @@ interface ImageHandle {
* @returns ReadableStream of image bytes, or null if not found
*/
bytes(): Promise<ReadableStream<Uint8Array> | 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<string>;
/**
* Update hosted image metadata
* @param options Properties to update
@@ -12583,6 +13172,14 @@ interface HostedImagesBinding {
* @throws {@link ImagesError} if list fails
*/
list(options?: ImageListOptions): Promise<ImageList>;
/**
* 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<ImageDirectUploadResult>;
}
interface ImagesBinding {
/**
@@ -12597,6 +13194,13 @@ interface ImagesBinding {
* @returns A transform handle
*/
input(stream: ReadableStream<Uint8Array>, 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
*/
@@ -12626,11 +13230,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
*/
@@ -13066,6 +13674,11 @@ declare namespace CloudflareWorkersModule {
export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
export type WorkflowDelayDuration = WorkflowSleepDuration;
export type WorkflowDynamicDelayContext = {
ctx: WorkflowStepContext<WorkflowDelayFunction>;
error: Error;
};
export type WorkflowDelayFunction = (input: WorkflowDynamicDelayContext) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;
export type WorkflowTimeoutDuration = WorkflowSleepDuration;
export type WorkflowRetentionDuration = WorkflowSleepDuration;
export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
@@ -13073,12 +13686,32 @@ declare namespace CloudflareWorkersModule {
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
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<WorkflowStepConfig, 'retries'> & {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
backoff?: WorkflowBackoff;
};
};
type WorkflowStepConfigWithDelayFunction = Omit<WorkflowStepConfig, 'retries'> & {
retries: {
limit: number;
delay: WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
};
export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;
export type WorkflowCronSchedule = {
/** Cron expression that triggered this event. */
@@ -13099,28 +13732,51 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext = {
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
step: {
name: string;
count: number;
};
attempt: number;
config: WorkflowStepConfig;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
};
export type WorkflowRollbackContext<T = unknown> = {
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<T = unknown, Delay = WorkflowDelayDuration | number> = {
ctx: WorkflowStepContext<Delay>;
error: Error;
output: T | undefined;
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
stepName: string;
};
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown> = {
rollback: WorkflowRollbackHandler<T>;
export type WorkflowRollbackHandler<T = unknown, Delay = WorkflowDelayDuration | number> = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown, Delay = WorkflowDelayDuration | number> = {
rollback: WorkflowRollbackHandler<T, Delay>;
rollbackConfig?: WorkflowStepRollbackConfig;
};
export abstract class WorkflowStep {
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
// 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<T>(...)`) 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<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext<WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayDuration | number>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
@@ -13896,11 +14552,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;
} | {
@@ -13917,7 +14574,11 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOutputOptions = {
format?: OutputFormat;
};
type ConversionOptions = {
output?: ConversionOutputOptions;
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
@@ -14012,7 +14673,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;
@@ -14031,6 +14692,7 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
@@ -14065,11 +14727,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;
@@ -14547,10 +15220,31 @@ declare abstract class Workflow<PARAMS = unknown> {
* @returns A promise that resolves with a list of handles for the created instances.
*/
public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;
/**
* 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<WorkflowBatchDeleteResult>;
}
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<PARAMS = unknown> {
/**
* An id for your Workflow instance. Must be unique within the Workflow.
@@ -14568,6 +15262,9 @@ interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
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)
@@ -14585,6 +15282,13 @@ interface WorkflowError {
code?: number;
message: string;
}
interface WorkflowInstanceTerminateOptions {
/**
* If true, run registered rollback handlers before terminating the instance.
* Only steps that registered rollback handlers are rolled back.
*/
rollback?: boolean;
}
interface WorkflowInstanceRestartOptions {
/**
* Restart from a specific step. If omitted, the instance restarts from the beginning.
@@ -14618,14 +15322,19 @@ declare abstract class WorkflowInstance {
public resume(): Promise<void>;
/**
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
* @param options Options for termination, including whether registered rollback handlers should run.
*/
public terminate(): Promise<void>;
public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;
/**
* Restart the instance. Optionally restart from a specific step, preserving
* cached results for all steps before it.
* @param options Options for the restart, including an optional step to restart from.
*/
public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
/**
* Delete the instance and its stored state.
*/
public delete(): Promise<void>;
/**
* Returns the current status of the instance.
*/
+4 -11
View File
@@ -5,8 +5,10 @@
"compatibility_date": "2026-06-16",
"compatibility_flags": ["nodejs_compat"],
// Shared `recflare` DB. Reads room scenes for matchmaking, writes a player's
// personal dorm room on first dorm entry (see getOrCreateDormRoom), and holds
// player presence (the `presence` table — owned/migrated by the `rooms` worker).
// personal dorm room on first dorm entry (see getOrCreateDormRoom), holds
// player presence (the `presence` table — owned/migrated by the `rooms` worker),
// and the per-player settings map (`player_settings`, owned by the `playersettings`
// worker) that GET|PUT /player/avoidjuniors reads one key of.
// This worker owns the `room_invite` table behind POST /invite (schema/migration
// here); its own migrations_table keeps that history separate from the other
// workers' migrations on the shared database.
@@ -20,15 +22,6 @@
"migrations_table": "d1_migrations_match"
}
],
// Per-player settings KV, owned by the `playersettings` worker. Read-only here, for
// GET /player/avoidjuniors. The "local" id placeholder is replaced with the real id
// from RECFLARE_KV at deploy time.
"kv_namespaces": [
{
"binding": "RECFLARE_PLAYER_SETTINGS",
"id": "local"
}
],
// Presence sweep. Rows expire on their own TTL (15m) and reads already ignore
// expired ones, so this is housekeeping: it purges them, deletes the room
// instances left with nobody in them, and recomputes the fullness of the
+3 -5
View File
@@ -9,8 +9,8 @@ import type { NotificationsHub } from '../../notify/src/notifications-hub'
* Union of every mounted worker's bindings.
*
* Because the split workers already share the same underlying resources — one
* `recflare` D1, one Secrets Store, the shared R2 buckets, the single KV namespace and
* the Notifications Durable Object — this is a de-duplicated union, not a migration.
* `recflare` D1, one Secrets Store, the shared R2 buckets and the Notifications Durable
* Object — this is a de-duplicated union, not a migration.
* Each mounted app reads only the subset it needs; a superset `Env` is assignable to
* each app's narrower `Env`, so the sub-apps type-check unchanged.
*/
@@ -20,14 +20,12 @@ export type Env = SharedHonoEnv & {
// Meta (Oculus) app secret, from the same store. Read only by `auth`, to validate a
// headset login's nonce with Meta (see apps/auth/src/meta-nonce.ts).
META_APP_SECRET: SecretsStoreSecret
// Shared `recflare` database (accounts, auth, api, clubs, match, rooms, …).
// Shared `recflare` database (accounts, auth, api, clubs, match, playersettings, rooms, …).
DB: D1Database
// Image storage bucket (api, img).
IMAGES: R2Bucket
// Binary room-data CDN bucket (cdn, rooms, storage).
CDN_ASSETS: R2Bucket
// Per-player settings (playersettings).
RECFLARE_PLAYER_SETTINGS: KVNamespace
// Real-time notifications hub. The class is defined in `notify` and re-exported by
// this worker's entry so the binding resolves in-process (no `script_name`).
RECFLARE_NOTIFICATIONS_HUB: DurableObjectNamespace<NotificationsHub>
+950 -241
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20260625.1 2026-06-16 nodejs_compat
// Runtime types generated with workerd@1.20260831.1 2026-06-16 nodejs_compat
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
@@ -19,26 +19,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)
@@ -96,61 +96,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)
*/
@@ -168,23 +168,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.
@@ -193,7 +194,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)
*/
@@ -359,7 +360,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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)
*/
@@ -404,6 +405,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,
@@ -425,6 +427,7 @@ interface ExecutionContext<Props = unknown> {
cache?: CacheContext;
readonly access?: CloudflareAccessContext;
tracing: Tracing;
abort(reason?: any): void;
}
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
@@ -513,7 +516,7 @@ declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded
getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
}
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -542,7 +545,7 @@ interface DurableObjectState<Props = unknown> {
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string): void;
abort(reason?: string, options?: DurableObjectAbortOptions): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
@@ -578,6 +581,9 @@ interface DurableObjectStorage {
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectAbortOptions {
retryAlarm?: boolean;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
@@ -628,26 +634,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)
*/
@@ -684,13 +690,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)
@@ -703,45 +709,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)
*/
@@ -762,7 +768,7 @@ interface EventListenerObject<EventType extends Event = Event> {
}
type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
/**
* 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)
*/
@@ -775,13 +781,13 @@ declare class EventTarget<EventMap extends Record<string, Event> = Record<string
*/
addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, 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 extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, 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)
*/
@@ -813,7 +819,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)
*/
@@ -826,7 +832,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)
*/
@@ -838,13 +844,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)
*/
@@ -860,12 +866,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<void>;
}
@@ -873,20 +884,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<any>): 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)
*/
@@ -925,7 +936,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)
*/
@@ -943,13 +954,13 @@ declare class Blob {
*/
bytes(): Promise<Uint8Array>;
/**
* 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<string>;
/**
* 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)
*/
@@ -966,13 +977,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)
*/
@@ -989,7 +1000,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)
*/
@@ -1022,14 +1033,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)
*/
@@ -1057,7 +1068,7 @@ declare abstract class SubtleCrypto {
*/
encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/**
* 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)
*/
@@ -1075,7 +1086,7 @@ declare abstract class SubtleCrypto {
*/
verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;
/**
* 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)
*/
@@ -1093,7 +1104,7 @@ declare abstract class SubtleCrypto {
*/
deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
/**
* 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)
*/
@@ -1111,13 +1122,13 @@ declare abstract class SubtleCrypto {
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* 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<ArrayBuffer>;
/**
* 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)
*/
@@ -1125,20 +1136,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)
*/
@@ -1255,12 +1266,15 @@ interface CryptoKeyArbitraryKeyAlgorithm {
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
readonly digest: Promise<ArrayBuffer>;
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)
*/
@@ -1277,20 +1291,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)
*/
@@ -1347,6 +1361,9 @@ declare class ErrorEvent extends Event {
get error(): any;
}
interface ErrorEventErrorEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
message?: string;
filename?: string;
lineno?: number;
@@ -1359,135 +1376,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<any>;
/**
* 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<string>;
/* Returns a list of values in the list. */
values(): IterableIterator<(File | string)>;
forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;
[Symbol.iterator](): IterableIterator<[
@@ -1566,19 +1587,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)
*/
@@ -1587,58 +1608,55 @@ declare abstract class FetchEvent extends ExtendableEvent {
}
type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;
/**
* 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<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;
/* Returns an iterator allowing to go through all key/value pairs contained in this object. */
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<string>;
/* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
values(): IterableIterator<string>;
[Symbol.iterator](): IterableIterator<[
key: string,
@@ -1701,7 +1719,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)
*/
@@ -1719,7 +1737,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)
*/
@@ -1727,7 +1745,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)
*/
@@ -1758,13 +1776,13 @@ declare var Request: {
*/
interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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<CfHostMetadata, Cf>;
/**
* 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)
*/
@@ -1776,7 +1794,7 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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)
*/
@@ -1802,13 +1820,13 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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)
*/
@@ -2197,7 +2215,7 @@ type ReadableStreamReadResult<R = any> = {
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)
*/
@@ -2215,13 +2233,13 @@ interface ReadableStream<R = any> {
*/
cancel(reason?: any): Promise<void>;
/**
* 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<R>;
/**
* 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)
*/
@@ -2233,13 +2251,13 @@ interface ReadableStream<R = any> {
*/
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
/**
* 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<R>, options?: StreamPipeOptions): Promise<void>;
/**
* 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)
*/
@@ -2251,7 +2269,7 @@ interface ReadableStream<R = any> {
[Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
}
/**
* 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)
*/
@@ -2283,7 +2301,7 @@ declare class ReadableStreamDefaultReader<R = any> {
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)
*/
@@ -2292,13 +2310,13 @@ declare class ReadableStreamBYOBReader {
get closed(): Promise<void>;
cancel(reason?: any): Promise<void>;
/**
* 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<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* 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)
*/
@@ -2317,7 +2335,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)
*/
@@ -2343,13 +2361,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<R = any> {
/**
* 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)
*/
@@ -2361,32 +2379,32 @@ declare abstract class ReadableStreamDefaultController<R = any> {
*/
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)
*/
@@ -2398,7 +2416,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)
*/
@@ -2411,7 +2429,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)
*/
@@ -2423,7 +2441,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)
*/
@@ -2448,7 +2466,7 @@ declare abstract class TransformStreamDefaultController<O = any> {
*/
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)
*/
@@ -2470,14 +2488,14 @@ interface ReadableWritablePair<R = any, W = any> {
writable: WritableStream<W>;
}
/**
* 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<W = any> {
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)
*/
@@ -2489,83 +2507,83 @@ declare class WritableStream<W = any> {
*/
abort(reason?: any): Promise<void>;
/**
* 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<void>;
/**
* 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<W>;
}
/**
* 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<W = any> {
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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<I = any, O = any> {
constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
/**
* 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<O>;
/**
* 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)
*/
@@ -2584,7 +2602,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)
*/
@@ -2592,7 +2610,7 @@ declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
* The **`DecompressionStream`** interface of the Compression Streams API decompresses 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/DecompressionStream)
*/
@@ -2600,7 +2618,7 @@ declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBuf
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. It is the streaming equivalent of TextEncoder. 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/TextEncoderStream)
*/
@@ -2609,7 +2627,7 @@ declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
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)
*/
@@ -2758,6 +2776,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;
@@ -2778,7 +2802,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)
*/
@@ -2803,121 +2827,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)
*/
@@ -2937,13 +2961,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)
*/
@@ -2993,25 +3017,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<string>;
/* Returns a list of values in the search params. */
values(): IterableIterator<string>;
forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;
/*function toString() { [native code] }*/
@@ -3021,18 +3042,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 {
@@ -3065,7 +3146,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)
*/
@@ -3084,13 +3165,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;
@@ -3102,7 +3186,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)
*/
@@ -3119,20 +3203,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<WebSocketEventMap> {
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)
*/
@@ -3152,13 +3236,13 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
*/
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)
*/
@@ -3245,25 +3329,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)
*/
@@ -3298,18 +3382,26 @@ interface ContainerExecOptions {
cwd?: string;
env?: Record<string, string>;
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<number>;
output(): Promise<ExecOutput>;
kill(signal?: number): void;
resize(cols: number, rows: number): void;
}
interface Container {
get running(): boolean;
@@ -3336,25 +3428,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<string, string>;
instance?: "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | ContainerStartResources;
labels?: Record<string, string>;
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.
@@ -3363,19 +3472,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)
*/
@@ -3391,13 +3500,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)
*/
@@ -3457,7 +3566,7 @@ interface WorkerLoaderModule {
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer;
wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
@@ -3465,7 +3574,7 @@ interface WorkerLoaderWorkerCode {
allowExperimental?: boolean;
limits?: workerdResourceLimits;
mainModule: string;
modules: Record<string, WorkerLoaderModule | string>;
modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
@@ -3487,7 +3596,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)
*/
@@ -3496,11 +3605,13 @@ declare abstract class Performance {
interface Tracing {
enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
startActiveSpan<T, A extends unknown[]>(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<string, boolean | number | string | undefined>): this;
end(): void;
}
/**
@@ -4140,6 +4251,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[];
@@ -10037,6 +10155,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;
@@ -10129,6 +10404,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 = {
/**
@@ -10795,6 +11077,15 @@ interface BrowserRunBaseOptions {
*/
cacheTTL?: number;
}
/**
* Backend selection, mixed into the options of the quick actions that support it.
* Deliberately not part of `BrowserRunBaseOptions`: `scrape`, `links` and `snapshot`
* reject an alternate backend, so they must not accept the field.
*/
interface BrowserRunAlternateBackendOptions {
/** Render with an alternate browser backend instead of the default one. */
browser?: 'kitesurf';
}
/** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/
type BrowserRunCommonOptions = (BrowserRunBaseOptions & {
/** URL to navigate to, e.g. `"https://example.com"`. */
@@ -10829,7 +11120,7 @@ type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
scrollPage?: boolean;
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
};
} & BrowserRunAlternateBackendOptions;
type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @see https://pptr.dev/api/puppeteer.pdfoptions */
pdfOptions?: {
@@ -10865,7 +11156,7 @@ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @default 30000 */
timeout?: number;
};
};
} & BrowserRunAlternateBackendOptions;
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
/** CSS selectors to scrape. At least one element is required. */
elements: Array<{
@@ -10878,10 +11169,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<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;
};
/** 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;
} & BrowserRunAlternateBackendOptions;
interface BrowserRunJsonBaseOptions {
/** Custom AI models to try in order. Max 3. Falls back to next on error. */
custom_ai?: Array<{
@@ -10895,7 +11205,7 @@ interface BrowserRunJsonBaseOptions {
* Options for the `json` quick action.
* At least one of `prompt` or `response_format` must be provided.
*/
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions & ({
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
/** Natural-language prompt describing what data to extract. */
prompt: string;
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
@@ -10906,14 +11216,80 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
response_format: AiTextGenerationResponseFormat;
});
type BrowserRunContentOptions = BrowserRunCommonOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
type BrowserRunContentOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
type BrowserRunRedirectHop = {
/** URL that returned the redirect. */
url: string;
/** HTTP status of the redirect. */
status: number;
/** Redirect response headers, including `location`. */
headers: Record<string, string>;
};
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<string, string>;
/** 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 `<h2>`. */
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;
@@ -10926,6 +11302,7 @@ type BrowserRunLinksSuccessResponse = {
success: true;
/** Extracted links */
result: string[];
meta: BrowserRunResponseMeta;
};
/** Success response for `scrape` action. */
type BrowserRunScrapeSuccessResponse = {
@@ -10956,15 +11333,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;
};
@@ -10973,12 +11368,14 @@ type BrowserRunJsonSuccessResponse = {
success: true;
/** JSON data extracted from the page using an AI model */
result: Record<string, unknown>;
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 = {
@@ -11088,9 +11485,10 @@ declare abstract class BrowserRun {
*/
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
/**
* 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):**
@@ -11138,6 +11536,26 @@ declare abstract class BrowserRun {
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
*/
quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;
/**
* 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<Response>;
}
/**
* In addition to the properties you can set in the RequestInit dict
@@ -12208,6 +12626,13 @@ interface ForwardableEmailMessage extends EmailMessage {
* @returns A promise that resolves when the email message is replied.
*/
reply(message: EmailMessage): Promise<EmailSendResult>;
/**
* Reply to the sender of this email message with a message built from the given
* fields. Threading headers (In-Reply-To/References) are set automatically.
* @param builder The reply message contents.
* @returns A promise that resolves when the email message is replied.
*/
reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;
}
/** A file attachment for an email message */
type EmailAttachment = {
@@ -12228,23 +12653,46 @@ interface EmailAddress {
name: string;
email: string;
}
/**
* Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or
* `bcc` must be provided.
*/
type EmailDestinations = {
to?: string | EmailAddress | (string | EmailAddress)[];
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
} & ({
to: string | EmailAddress | (string | EmailAddress)[];
} | {
cc: string | EmailAddress | (string | EmailAddress)[];
} | {
bcc: string | EmailAddress | (string | EmailAddress)[];
});
/**
* Fields shared by all composed emails (no recipients). Used directly by
* `ForwardableEmailMessage.reply()`, which always replies to the original
* sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.
*/
interface EmailReplyMessageBuilder {
from: string | EmailAddress;
subject: string;
replyTo?: string | EmailAddress;
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}
/**
* Fields for composing an email without constructing raw MIME, for
* `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.
*/
type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;
/**
* A binding that allows a Worker to send email messages.
*/
interface SendEmail {
send(message: EmailMessage): Promise<EmailSendResult>;
send(builder: {
from: string | EmailAddress;
to: string | EmailAddress | (string | EmailAddress)[];
subject: string;
replyTo?: string | EmailAddress;
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}): Promise<EmailSendResult>;
send(builder: EmailMessageBuilder): Promise<EmailSendResult>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
@@ -12398,6 +12846,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.
*/
@@ -12419,6 +12876,78 @@ interface Hyperdrive {
*/
readonly database: string;
}
/**
* A handle to a dynamically-provisioned Hyperdrive connection, returned by
* `HyperdriveApi.get()`.
*/
interface HyperdriveDynamic extends Disposable {
/**
* The database name to use when connecting through this Hyperdrive.
*/
readonly database: Promise<string>;
/*
* The randomly generated user to use when authenticating to your
* database via Hyperdrive.
*/
readonly user: Promise<string>;
/*
* The randomly generated password to use when authenticating to your
* database via Hyperdrive.
*/
readonly password: Promise<string>;
/**
* Open a TCP socket to the target database through this Hyperdrive.
*
*/
connect(): Promise<Socket>;
}
/**
* Binding that provisions Hyperdrive connections at request time, rather than
* from static configuration.
*/
interface HyperdriveDynamicApi {
/**
* Provision a connection for the database described by `args`.
*
*/
get(args: HyperdriveDynamicConfig): Promise<HyperdriveDynamic>;
/**
* Get a pre-generated connection string used for connecting to dynamic Hyperdrive.
*/
getHyperdriveConnectionString(connectionString: string): Promise<string>;
}
/**
* Parameters identifying the database that a dynamically-provisioned
* Hyperdrive connection should target.
*/
interface HyperdriveDynamicConfig {
/**
* Generated connection string to pass into the dynamic worker.
*
*/
dynamicHyperdriveConnectionString: string;
/**
* Connection string for the origin database Hyperdrive should connect to.
* Contains credentials, so treat it as a secret.
*
* The scheme selects the database engine. PostgreSQL origins are supported.
*/
connectionString: string;
/**
* Region in which to place the connection pool. See the Hyperdrive
* documentation for the set of supported regions.
*/
targetRegion: string;
/**
* Whether Hyperdrive should cache query results for this connection.
*/
cachingEnabled?: boolean;
/**
* Maximum number of connections the pool may open to the origin database.
* Defaults to 60.
*/
maxConnections?: number;
}
// Copyright (c) 2024 Cloudflare, Inc.
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0
@@ -12430,6 +12959,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<Uint8Array> | TextRasterize;
type ImageTransform = {
width?: number;
height?: number;
@@ -12519,6 +13069,9 @@ interface ImageUploadOptions {
requireSignedURLs?: boolean;
metadata?: Record<string, unknown>;
creator?: string;
/**
* If 'base64', the input data will be decoded from base64 before processing
*/
encoding?: 'base64';
}
interface ImageUpdateOptions {
@@ -12526,11 +13079,40 @@ interface ImageUpdateOptions {
metadata?: Record<string, unknown>;
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<string, ImageMetadataFilterValue>;
}
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<string, unknown>;
creator?: string;
expiresIn?: number;
}
interface ImageDirectUploadResult {
id: string;
uploadURL: string;
}
interface ImageList {
images: ImageMetadata[];
@@ -12548,6 +13130,13 @@ interface ImageHandle {
* @returns ReadableStream of image bytes, or null if not found
*/
bytes(): Promise<ReadableStream<Uint8Array> | 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<string>;
/**
* Update hosted image metadata
* @param options Properties to update
@@ -12583,6 +13172,14 @@ interface HostedImagesBinding {
* @throws {@link ImagesError} if list fails
*/
list(options?: ImageListOptions): Promise<ImageList>;
/**
* 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<ImageDirectUploadResult>;
}
interface ImagesBinding {
/**
@@ -12597,6 +13194,13 @@ interface ImagesBinding {
* @returns A transform handle
*/
input(stream: ReadableStream<Uint8Array>, 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
*/
@@ -12626,11 +13230,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
*/
@@ -13066,6 +13674,11 @@ declare namespace CloudflareWorkersModule {
export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
export type WorkflowDelayDuration = WorkflowSleepDuration;
export type WorkflowDynamicDelayContext = {
ctx: WorkflowStepContext<WorkflowDelayFunction>;
error: Error;
};
export type WorkflowDelayFunction = (input: WorkflowDynamicDelayContext) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;
export type WorkflowTimeoutDuration = WorkflowSleepDuration;
export type WorkflowRetentionDuration = WorkflowSleepDuration;
export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
@@ -13073,12 +13686,32 @@ declare namespace CloudflareWorkersModule {
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
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<WorkflowStepConfig, 'retries'> & {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
backoff?: WorkflowBackoff;
};
};
type WorkflowStepConfigWithDelayFunction = Omit<WorkflowStepConfig, 'retries'> & {
retries: {
limit: number;
delay: WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
};
export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;
export type WorkflowCronSchedule = {
/** Cron expression that triggered this event. */
@@ -13099,28 +13732,51 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext = {
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
step: {
name: string;
count: number;
};
attempt: number;
config: WorkflowStepConfig;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
};
export type WorkflowRollbackContext<T = unknown> = {
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<T = unknown, Delay = WorkflowDelayDuration | number> = {
ctx: WorkflowStepContext<Delay>;
error: Error;
output: T | undefined;
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
stepName: string;
};
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown> = {
rollback: WorkflowRollbackHandler<T>;
export type WorkflowRollbackHandler<T = unknown, Delay = WorkflowDelayDuration | number> = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown, Delay = WorkflowDelayDuration | number> = {
rollback: WorkflowRollbackHandler<T, Delay>;
rollbackConfig?: WorkflowStepRollbackConfig;
};
export abstract class WorkflowStep {
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
// 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<T>(...)`) 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<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext<WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayDuration | number>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
@@ -13896,11 +14552,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;
} | {
@@ -13917,7 +14574,11 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOutputOptions = {
format?: OutputFormat;
};
type ConversionOptions = {
output?: ConversionOutputOptions;
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
@@ -14012,7 +14673,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;
@@ -14031,6 +14692,7 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
@@ -14065,11 +14727,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;
@@ -14547,10 +15220,31 @@ declare abstract class Workflow<PARAMS = unknown> {
* @returns A promise that resolves with a list of handles for the created instances.
*/
public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;
/**
* 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<WorkflowBatchDeleteResult>;
}
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<PARAMS = unknown> {
/**
* An id for your Workflow instance. Must be unique within the Workflow.
@@ -14568,6 +15262,9 @@ interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
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)
@@ -14585,6 +15282,13 @@ interface WorkflowError {
code?: number;
message: string;
}
interface WorkflowInstanceTerminateOptions {
/**
* If true, run registered rollback handlers before terminating the instance.
* Only steps that registered rollback handlers are rolled back.
*/
rollback?: boolean;
}
interface WorkflowInstanceRestartOptions {
/**
* Restart from a specific step. If omitted, the instance restarts from the beginning.
@@ -14618,14 +15322,19 @@ declare abstract class WorkflowInstance {
public resume(): Promise<void>;
/**
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
* @param options Options for termination, including whether registered rollback handlers should run.
*/
public terminate(): Promise<void>;
public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;
/**
* Restart the instance. Optionally restart from a specific step, preserving
* cached results for all steps before it.
* @param options Options for the restart, including an optional step to restart from.
*/
public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
/**
* Delete the instance and its stored state.
*/
public delete(): Promise<void>;
/**
* Returns the current status of the instance.
*/
-7
View File
@@ -32,13 +32,6 @@
"bucket_name": "recflare-cdn"
}
],
// Per-player settings KV (playersettings). "local" id replaced at deploy.
"kv_namespaces": [
{
"binding": "RECFLARE_PLAYER_SETTINGS",
"id": "local"
}
],
// Notifications hub. The class ships IN this worker (re-exported from notify), so it
// is bound locally (no script_name) and migrated here.
"durable_objects": {
+16 -4
View File
@@ -4,12 +4,12 @@ Player-settings worker served on the `playersettings` subdomain.
- `GET /` — service status `{ "service": "playersettings", "status": "ok" }`.
- `GET /playersettings` — `[Authorize]`. The player's settings as
`{ PlayerId, Key, Value }`, read from the per-player KV map. On a player's
`{ PlayerId, Key, Value }`, read from the player's stored map. On a player's
first read it seeds (and persists) the default settings.
- `PUT /playersettings` — `[Authorize]`. Accepts a form-urlencoded
`key=…&value=…` (or a JSON `{key,value}` / array) and **upserts** it into the
player's settings, keyed by the `sub` claim of the Bearer JWT. Returns `200`.
Persisted in Workers KV (`RECFLARE_PLAYER_SETTINGS`, key `player:<id>`).
Persisted in the `player_settings` D1 table (one JSON row per player).
- `DELETE /playersettings` — `[Authorize]`. Removes a setting from the player's
map. The client sends a bare form-urlencoded `key=PlayerShoppingBagId` (no
`value`); a JSON body and a `?key=` query param are also read. Deleting a key
@@ -22,12 +22,24 @@ Player-settings worker served on the `playersettings` subdomain.
> Emptying the map with DELETE puts the player back to a first read: the next
> `GET` re-seeds the defaults.
## KV namespace
## Storage
Settings live in the `player_settings` table on the shared `recflare` D1: one row per
player, `account_id` plus `data`, the whole map as a JSON object of strings
(`{"Recroom.OOBE":"77","TUTORIAL_COMPLETE_MASK":"11"}`). This worker owns the table
(`migrations/0001_player_settings.sql`, applied under its own `d1_migrations_playersettings`
ledger); the `api`, `match` and `chat` workers each keep a key of their own in the same map
through `@repo/domain`'s `player-settings-db`, which is why every writer merges rather than
replaces. A write that changes nothing is skipped.
```sh
wrangler kv namespace create RECFLARE_PLAYER_SETTINGS # then put the id in .env under RECFLARE_KV (see .env.example)
just migrate -F playersettings # create the table (add -- --local for the dev db)
```
They used to live in a Workers KV namespace (`RECFLARE_PLAYER_SETTINGS`, key `player:<id>`).
A deployment from then copies it across once with `just settings-import-kv --remote` —
see CLI.md — after which the namespace can be deleted.
## Development
### Run in dev mode
@@ -0,0 +1,13 @@
-- Per-player settings: the key/value bag the game client reads on load and writes back
-- as the player toggles options. Generated from packages/domain/src/player-settings-db.ts
-- (PLAYER_SETTINGS_SCHEMA_DDL) — keep in sync.
--
-- One row per player. `data` is the whole map as a JSON object of strings
-- (`{"Recroom.OOBE":"77","TUTORIAL_COMPLETE_MASK":"11"}`) — the same value the
-- RECFLARE_PLAYER_SETTINGS KV namespace used to hold under `player:<id>`, which is what
-- `runx admin settings-import-kv` copies across. Every writer (this worker, api, match,
-- chat) merges into the object rather than replacing it.
CREATE TABLE IF NOT EXISTS player_settings (
account_id INTEGER PRIMARY KEY,
data TEXT NOT NULL
);
+1
View File
@@ -12,6 +12,7 @@
"deploy": "run-wrangler-deploy",
"dev": "run-wrangler-dev",
"fix:workers-types": "run-wrangler-types",
"migrate": "run-wrangler-migrate",
"test": "run-vitest"
},
"dependencies": {
+6 -2
View File
@@ -6,8 +6,12 @@ export type Env = SharedHonoEnv & {
// with `await env.JWT_SECRET.get()`; all workers bind the same store so tokens
// signed by `auth` verify here.
JWT_SECRET: SecretsStoreSecret
/** Per-player settings store. Key `player:<id>` → JSON map of `{ key: value }`. */
RECFLARE_PLAYER_SETTINGS: KVNamespace
/**
* Shared `recflare` D1. This worker owns the `player_settings` table — one row per
* player holding their whole settings map as a JSON `{ key: value }` object (see
* `@repo/domain`'s player-settings-db).
*/
DB: D1Database
}
/** Variables can be extended */
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* Default player settings seeded on a player's first read, ported verbatim from
* the reference's `PlayerSettingsController.GetPlayerSettings`. Ordered; written to KV the
* the reference's `PlayerSettingsController.GetPlayerSettings`. Ordered; written to the player’s row the
* first time a player has no stored settings.
*/
export const DEFAULT_SETTINGS: Array<{ Key: string; Value: string }> = [
+27 -30
View File
@@ -2,7 +2,12 @@ import { Hono } from 'hono'
import { describeRoute, openAPIRouteHandler } from 'hono-openapi'
import { useWorkersLogger } from 'workers-tagged-logger'
import { mergePlayerSettings } from '@repo/domain'
import {
mergePlayerSettings,
putPlayerSettingsIfChanged,
readPlayerSettings,
writePlayerSettings,
} from '@repo/domain'
import { withCleanSpec, withNotFound, withOnError } from '@repo/hono-helpers'
import { validateAndGetAccountId } from '@repo/jwt'
@@ -25,9 +30,11 @@ import type { App } from './context'
/**
* Player Settings Worker. Serves the small key/value settings bag the game client reads
* on load and writes back as the player toggles options. Backed by a per-player KV map
* (`player:{id}`); a player with nothing stored is seeded with the reference defaults on
* their first read.
* on load and writes back as the player toggles options. Backed by one row per player in
* the `player_settings` table on the shared D1 — the whole map as a JSON object, read and
* written through `@repo/domain`'s player-settings-db, which `api`, `match` and `chat` also
* merge their own keys into. A player with nothing stored is seeded with the reference
* defaults on their first read.
*
* Every `/playersettings` route is auth-gated on the Bearer JWT issued by the `auth` worker.
*/
@@ -147,7 +154,7 @@ const app = new Hono<App>()
)
// The authenticated player's settings as `{ PlayerId, Key, Value }`. Reads
// the per-player KV map; seeds (and persists) the defaults on first read.
// the player's row; seeds (and persists) the defaults on first read.
.get(
'/playersettings',
describeRoute({
@@ -155,7 +162,7 @@ const app = new Hono<App>()
summary: 'The player’s settings',
description: [
'The authenticated player’s settings as `{ PlayerId, Key, Value }` entries, read from',
'their KV map. A player with nothing stored is seeded with the reference defaults',
'their stored map. A player with nothing stored is seeded with the reference defaults',
'(Recroom.OOBE, TUTORIAL_COMPLETE_MASK, FIRST_TIME_IN_FLAGS), which are persisted on',
'that first read.',
].join(' '),
@@ -169,34 +176,33 @@ const app = new Hono<App>()
const id = await authedId(c)
if (id === null) return unauthorized(c)
const kvKey = `player:${id}`
let stored = await c.env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(kvKey, 'json')
let stored = await readPlayerSettings(c.env.DB, id)
if (!stored || Object.keys(stored).length === 0) {
stored = Object.fromEntries(DEFAULT_SETTINGS.map((s) => [s.Key, s.Value]))
await c.env.RECFLARE_PLAYER_SETTINGS.put(kvKey, JSON.stringify(stored))
await writePlayerSettings(c.env.DB, id, stored)
}
return c.json(Object.entries(stored).map(([Key, Value]) => ({ PlayerId: id, Key, Value })))
}
)
// Upsert player settings into KV, keyed by the authenticated player id.
// Upsert player settings into the player's row, keyed by the authenticated player id.
// A full replace would overwrite the player's entire set; we merge so individual key PUTs
// (e.g. `key=PlayerSessionCount&value=1`) don't wipe the rest. The client re-posts values
// it already has at every login and menu change, so a PUT that changes nothing is a
// read only — KV writes are what cost money here.
// read only — the row is written only when a value changed.
.put(
'/playersettings',
describeRoute({
tags: ['Player Settings'],
summary: 'Write the player’s settings',
description: [
'Upserts the posted setting(s) into the caller’s KV map. The write MERGES: a single',
'Upserts the posted setting(s) into the caller’s settings map. The write MERGES: a single',
'key PUT (`key=PlayerSessionCount&value=1`, which is what the client sends) leaves the',
'player’s other settings alone. A JSON body is also accepted, as one object or an',
'array, in either `key`/`value` or `Key`/`Value` casing; entries with an empty key are',
'dropped. An unparseable or empty body is a no-op 200, not a 400, and so is a PUT whose',
'values are already stored — nothing is written to KV. Empty body on success.',
'values are already stored — nothing is written. Empty body on success.',
].join(' '),
security: AUTHED,
requestBody: formOrJson(SettingFormWrite, SettingJsonWrite, 'The setting(s) to write'),
@@ -215,7 +221,7 @@ const app = new Hono<App>()
const patch: Record<string, string> = {}
for (const { key, value } of incoming) patch[key] = value
await mergePlayerSettings(c.env.RECFLARE_PLAYER_SETTINGS, id, patch)
await mergePlayerSettings(c.env.DB, id, patch)
return c.body(null, 200)
}
)
@@ -229,7 +235,7 @@ const app = new Hono<App>()
tags: ['Player Settings'],
summary: 'Delete a player setting',
description: [
'Removes the named setting(s) from the caller’s KV map. The client sends a bare',
'Removes the named setting(s) from the caller’s settings map. The client sends a bare',
'form-urlencoded `key=PlayerShoppingBagId` (no `value`); a JSON body — a string, a',
'`{ key }` object, or an array of either — and a `?key=` query param are also read.',
'Deleting a key that isn’t stored, or sending nothing to delete, is a no-op 200, not a',
@@ -252,22 +258,13 @@ const app = new Hono<App>()
const keys = await parseDeleteKeys(c)
if (keys.length === 0) return c.body(null, 200)
const kvKey = `player:${id}`
const existing = await c.env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
kvKey,
'json'
)
const existing = await readPlayerSettings(c.env.DB, id)
if (!existing) return c.body(null, 200)
const remaining = { ...existing }
let removed = false
for (const key of keys) {
if (key in remaining) {
delete remaining[key]
removed = true
}
}
if (removed) await c.env.RECFLARE_PLAYER_SETTINGS.put(kvKey, JSON.stringify(remaining))
for (const key of keys) delete remaining[key]
// Nothing stored was named: no write.
await putPlayerSettingsIfChanged(c.env.DB, id, existing, remaining)
return c.body(null, 200)
}
@@ -287,8 +284,8 @@ app.get(
description: [
'The player key/value settings bag for recflare, a private-server reimplementation of',
'the Rec Room backend. The client reads these on load and writes them back as the',
'player toggles options; they are stored in a per-player KV map, seeded with the',
'reference defaults on a player’s first read.',
'player toggles options; they are stored as one JSON row per player on the shared',
'D1, seeded with the reference defaults on a player’s first read.',
].join('\n'),
},
servers: [{ url: 'https://playersettings.recflare.net', description: 'Production' }],
@@ -3,6 +3,8 @@ import { beforeAll, describe, expect, it } from 'vitest'
import '../../playersettings.app'
import { PLAYER_SETTINGS_SCHEMA_DDL, readPlayerSettings } from '@repo/domain'
import type { Env } from '../../context'
declare module 'cloudflare:test' {
@@ -14,8 +16,33 @@ const ORIGIN = 'https://example.com'
beforeAll(async () => {
// Seed the shared JWT signing key into the local Secrets Store so .get() resolves.
await adminSecretsStore(env.JWT_SECRET).create('test-signing-key')
// The player_settings table this worker owns (mirror of migrations/0001).
for (const stmt of PLAYER_SETTINGS_SCHEMA_DDL) await env.DB.prepare(stmt).run()
})
/** The player's stored map, as the worker reads it. */
const stored = (playerId: number) => readPlayerSettings(env.DB, playerId)
/**
* The row's `data` exactly as stored. The "nothing was written" tests seed it with whitespace
* the worker's own JSON.stringify never produces: if that survives a request, no write happened.
*/
async function rawData(playerId: number): Promise<string | null> {
const row = await env.DB.prepare('SELECT data FROM player_settings WHERE account_id = ?1')
.bind(playerId)
.first<{ data: string }>()
return row?.data ?? null
}
async function seedRaw(playerId: number, data: string): Promise<void> {
await env.DB.prepare(
`INSERT INTO player_settings (account_id, data) VALUES (?1, ?2)
ON CONFLICT (account_id) DO UPDATE SET data = excluded.data`
)
.bind(playerId, data)
.run()
}
// Mint a token the way the `auth` worker does, signing with the shared test key seeded into the JWT_SECRET store.
const TEST_SECRET = 'test-signing-key'
@@ -85,12 +112,9 @@ describe('playersettings endpoints', () => {
expect(settings.find((s) => s.Key === 'Recroom.OOBE')?.Value).toBe('77')
expect(settings.find((s) => s.Key === 'TUTORIAL_COMPLETE_MASK')?.Value).toBe('11')
// Defaults were persisted to KV.
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:100',
'json'
)
expect(stored?.['Recroom.OOBE']).toBe('77')
// Defaults were persisted.
const map = await stored(100)
expect(map?.['Recroom.OOBE']).toBe('77')
})
it('GET /playersettings reflects a value written by PUT', async () => {
@@ -109,18 +133,15 @@ describe('playersettings endpoints', () => {
expect(res.status).toBe(401)
})
it('PUT /playersettings persists the form key/value into KV', async () => {
it('PUT /playersettings persists the form key/value', async () => {
const res = await SELF.fetch(
`${ORIGIN}/playersettings`,
putForm({ key: 'PlayerSessionCount', value: '1' }, await bearer('7'))
)
expect(res.status).toBe(200)
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:7',
'json'
)
expect(stored).toEqual({ PlayerSessionCount: '1' })
const map = await stored(7)
expect(map).toEqual({ PlayerSessionCount: '1' })
})
it('PUT /playersettings merges instead of replacing', async () => {
@@ -133,33 +154,30 @@ describe('playersettings endpoints', () => {
putForm({ key: 'B', value: '2' }, await bearer('8'))
)
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:8',
'json'
)
expect(stored).toEqual({ A: '1', B: '2' })
const map = await stored(8)
expect(map).toEqual({ A: '1', B: '2' })
})
// KV writes are the cost here, and the client re-posts settings it already has at every
// login. The raw value is seeded with whitespace the worker's own JSON.stringify would
// never produce: if it survives the PUT, nothing was written.
it('PUT /playersettings does not write KV when the value is already stored', async () => {
// The client re-posts settings it already has at every login, and a write costs more
// than a read. The raw value is seeded with whitespace the worker's own JSON.stringify
// would never produce: if it survives the PUT, nothing was written.
it('PUT /playersettings does not write when the value is already stored', async () => {
const padded = '{ "PlayerSessionCount": "5", "Recroom.OOBE": "77" }'
await env.RECFLARE_PLAYER_SETTINGS.put('player:10', padded)
await seedRaw(10, padded)
const same = await SELF.fetch(
`${ORIGIN}/playersettings`,
putForm({ key: 'PlayerSessionCount', value: '5' }, await bearer('10'))
)
expect(same.status).toBe(200)
expect(await env.RECFLARE_PLAYER_SETTINGS.get('player:10', 'text')).toBe(padded)
expect(await rawData(10)).toBe(padded)
// A real change is still written — and compacted, which is how we know.
await SELF.fetch(
`${ORIGIN}/playersettings`,
putForm({ key: 'PlayerSessionCount', value: '6' }, await bearer('10'))
)
expect(await env.RECFLARE_PLAYER_SETTINGS.get('player:10', 'text')).toBe(
expect(await rawData(10)).toBe(
JSON.stringify({ PlayerSessionCount: '6', 'Recroom.OOBE': '77' })
)
})
@@ -193,11 +211,8 @@ describe('playersettings endpoints', () => {
)
expect(res.status).toBe(200)
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:20',
'json'
)
expect(stored).toEqual({ PlayerSessionCount: '3' })
const map = await stored(20)
expect(map).toEqual({ PlayerSessionCount: '3' })
})
it('DELETE /playersettings reads a body with no content-type', async () => {
@@ -213,11 +228,8 @@ describe('playersettings endpoints', () => {
})
expect(res.status).toBe(200)
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:21',
'json'
)
expect(stored).toEqual({})
const map = await stored(21)
expect(map).toEqual({})
})
it('DELETE /playersettings 200s for an unknown key and an empty body', async () => {
@@ -236,11 +248,8 @@ describe('playersettings endpoints', () => {
expect(empty.status).toBe(200)
// Neither call touched the stored map.
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:22',
'json'
)
expect(stored).toEqual({ A: '1' })
const map = await stored(22)
expect(map).toEqual({ A: '1' })
})
it('GET /openapi.json documents every route', async () => {
+953 -242
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20260625.1 2025-09-20 nodejs_compat
// Runtime types generated with workerd@1.20260831.1 2026-06-16 nodejs_compat
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
@@ -19,26 +19,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)
@@ -96,61 +96,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)
*/
@@ -168,23 +168,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.
@@ -193,7 +194,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)
*/
@@ -359,7 +360,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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)
*/
@@ -404,6 +405,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,
@@ -420,10 +422,12 @@ interface TestController {
interface ExecutionContext<Props = unknown> {
waitUntil(promise: Promise<any>): void;
passThroughOnException(): void;
readonly exports: Cloudflare.Exports;
readonly props: Props;
cache?: CacheContext;
readonly access?: CloudflareAccessContext;
tracing: Tracing;
abort(reason?: any): void;
}
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
@@ -512,7 +516,7 @@ declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded
getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
}
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -526,6 +530,7 @@ interface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = u
}
interface DurableObjectState<Props = unknown> {
waitUntil(promise: Promise<any>): void;
readonly exports: Cloudflare.Exports;
readonly props: Props;
readonly id: DurableObjectId;
readonly storage: DurableObjectStorage;
@@ -540,7 +545,7 @@ interface DurableObjectState<Props = unknown> {
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string): void;
abort(reason?: string, options?: DurableObjectAbortOptions): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
@@ -576,6 +581,9 @@ interface DurableObjectStorage {
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectAbortOptions {
retryAlarm?: boolean;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
@@ -626,26 +634,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)
*/
@@ -682,13 +690,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)
@@ -701,45 +709,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)
*/
@@ -760,7 +768,7 @@ interface EventListenerObject<EventType extends Event = Event> {
}
type EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;
/**
* 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)
*/
@@ -773,13 +781,13 @@ declare class EventTarget<EventMap extends Record<string, Event> = Record<string
*/
addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, 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 extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, 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)
*/
@@ -811,7 +819,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)
*/
@@ -824,7 +832,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)
*/
@@ -836,13 +844,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)
*/
@@ -858,12 +866,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<void>;
}
@@ -871,20 +884,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<any>): 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)
*/
@@ -923,7 +936,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)
*/
@@ -941,13 +954,13 @@ declare class Blob {
*/
bytes(): Promise<Uint8Array>;
/**
* 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<string>;
/**
* 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)
*/
@@ -964,13 +977,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)
*/
@@ -987,7 +1000,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)
*/
@@ -1020,14 +1033,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)
*/
@@ -1055,7 +1068,7 @@ declare abstract class SubtleCrypto {
*/
encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
/**
* 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)
*/
@@ -1073,7 +1086,7 @@ declare abstract class SubtleCrypto {
*/
verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;
/**
* 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)
*/
@@ -1091,7 +1104,7 @@ declare abstract class SubtleCrypto {
*/
deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
/**
* 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)
*/
@@ -1109,13 +1122,13 @@ declare abstract class SubtleCrypto {
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* 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<ArrayBuffer>;
/**
* 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)
*/
@@ -1123,20 +1136,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)
*/
@@ -1253,12 +1266,15 @@ interface CryptoKeyArbitraryKeyAlgorithm {
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
readonly digest: Promise<ArrayBuffer>;
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)
*/
@@ -1275,20 +1291,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)
*/
@@ -1345,6 +1361,9 @@ declare class ErrorEvent extends Event {
get error(): any;
}
interface ErrorEventErrorEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
message?: string;
filename?: string;
lineno?: number;
@@ -1357,135 +1376,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<any>;
/**
* 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<string>;
/* Returns a list of values in the list. */
values(): IterableIterator<(File | string)>;
forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;
[Symbol.iterator](): IterableIterator<[
@@ -1564,19 +1587,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)
*/
@@ -1585,65 +1608,62 @@ declare abstract class FetchEvent extends ExtendableEvent {
}
type HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;
/**
* 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<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;
/* Returns an iterator allowing to go through all key/value pairs contained in this object. */
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<string>;
/* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */
values(): IterableIterator<string>;
[Symbol.iterator](): IterableIterator<[
key: string,
value: string
]>;
}
type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;
type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;
declare abstract class Body {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
get body(): ReadableStream | null;
@@ -1699,7 +1719,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)
*/
@@ -1717,7 +1737,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)
*/
@@ -1725,7 +1745,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)
*/
@@ -1756,13 +1776,13 @@ declare var Request: {
*/
interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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<CfHostMetadata, Cf>;
/**
* 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)
*/
@@ -1774,7 +1794,7 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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)
*/
@@ -1800,13 +1820,13 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> 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)
*/
@@ -2195,7 +2215,7 @@ type ReadableStreamReadResult<R = any> = {
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)
*/
@@ -2213,13 +2233,13 @@ interface ReadableStream<R = any> {
*/
cancel(reason?: any): Promise<void>;
/**
* 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<R>;
/**
* 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)
*/
@@ -2231,13 +2251,13 @@ interface ReadableStream<R = any> {
*/
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
/**
* 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<R>, options?: StreamPipeOptions): Promise<void>;
/**
* 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)
*/
@@ -2249,7 +2269,7 @@ interface ReadableStream<R = any> {
[Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;
}
/**
* 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)
*/
@@ -2281,7 +2301,7 @@ declare class ReadableStreamDefaultReader<R = any> {
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)
*/
@@ -2290,13 +2310,13 @@ declare class ReadableStreamBYOBReader {
get closed(): Promise<void>;
cancel(reason?: any): Promise<void>;
/**
* 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<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* 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)
*/
@@ -2315,7 +2335,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)
*/
@@ -2341,13 +2361,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<R = any> {
/**
* 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)
*/
@@ -2359,32 +2379,32 @@ declare abstract class ReadableStreamDefaultController<R = any> {
*/
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)
*/
@@ -2396,7 +2416,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)
*/
@@ -2409,7 +2429,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)
*/
@@ -2421,7 +2441,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)
*/
@@ -2446,7 +2466,7 @@ declare abstract class TransformStreamDefaultController<O = any> {
*/
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)
*/
@@ -2468,14 +2488,14 @@ interface ReadableWritablePair<R = any, W = any> {
writable: WritableStream<W>;
}
/**
* 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<W = any> {
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)
*/
@@ -2487,83 +2507,83 @@ declare class WritableStream<W = any> {
*/
abort(reason?: any): Promise<void>;
/**
* 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<void>;
/**
* 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<W>;
}
/**
* 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<W = any> {
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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<void>;
/**
* 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<I = any, O = any> {
constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);
/**
* 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<O>;
/**
* 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)
*/
@@ -2582,7 +2602,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)
*/
@@ -2590,7 +2610,7 @@ declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
* The **`DecompressionStream`** interface of the Compression Streams API decompresses 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/DecompressionStream)
*/
@@ -2598,7 +2618,7 @@ declare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBuf
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. It is the streaming equivalent of TextEncoder. 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/TextEncoderStream)
*/
@@ -2607,7 +2627,7 @@ declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
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)
*/
@@ -2756,6 +2776,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;
@@ -2776,7 +2802,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)
*/
@@ -2801,121 +2827,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)
*/
@@ -2935,13 +2961,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)
*/
@@ -2991,25 +3017,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<string>;
/* Returns a list of values in the search params. */
values(): IterableIterator<string>;
forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;
/*function toString() { [native code] }*/
@@ -3019,18 +3042,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 {
@@ -3063,7 +3146,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)
*/
@@ -3082,13 +3165,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;
@@ -3100,7 +3186,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)
*/
@@ -3117,20 +3203,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<WebSocketEventMap> {
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)
*/
@@ -3150,13 +3236,13 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
*/
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)
*/
@@ -3243,25 +3329,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)
*/
@@ -3296,18 +3382,26 @@ interface ContainerExecOptions {
cwd?: string;
env?: Record<string, string>;
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<number>;
output(): Promise<ExecOutput>;
kill(signal?: number): void;
resize(cols: number, rows: number): void;
}
interface Container {
get running(): boolean;
@@ -3334,25 +3428,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<string, string>;
instance?: "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | ContainerStartResources;
labels?: Record<string, string>;
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.
@@ -3361,19 +3472,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)
*/
@@ -3389,13 +3500,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)
*/
@@ -3455,7 +3566,7 @@ interface WorkerLoaderModule {
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer;
wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
@@ -3463,7 +3574,7 @@ interface WorkerLoaderWorkerCode {
allowExperimental?: boolean;
limits?: workerdResourceLimits;
mainModule: string;
modules: Record<string, WorkerLoaderModule | string>;
modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
@@ -3485,7 +3596,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)
*/
@@ -3494,11 +3605,13 @@ declare abstract class Performance {
interface Tracing {
enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
startActiveSpan<T, A extends unknown[]>(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<string, boolean | number | string | undefined>): this;
end(): void;
}
/**
@@ -4138,6 +4251,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[];
@@ -10035,6 +10155,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;
@@ -10127,6 +10404,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 = {
/**
@@ -10793,6 +11077,15 @@ interface BrowserRunBaseOptions {
*/
cacheTTL?: number;
}
/**
* Backend selection, mixed into the options of the quick actions that support it.
* Deliberately not part of `BrowserRunBaseOptions`: `scrape`, `links` and `snapshot`
* reject an alternate backend, so they must not accept the field.
*/
interface BrowserRunAlternateBackendOptions {
/** Render with an alternate browser backend instead of the default one. */
browser?: 'kitesurf';
}
/** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/
type BrowserRunCommonOptions = (BrowserRunBaseOptions & {
/** URL to navigate to, e.g. `"https://example.com"`. */
@@ -10827,7 +11120,7 @@ type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
scrollPage?: boolean;
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
};
} & BrowserRunAlternateBackendOptions;
type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @see https://pptr.dev/api/puppeteer.pdfoptions */
pdfOptions?: {
@@ -10863,7 +11156,7 @@ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @default 30000 */
timeout?: number;
};
};
} & BrowserRunAlternateBackendOptions;
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
/** CSS selectors to scrape. At least one element is required. */
elements: Array<{
@@ -10876,10 +11169,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<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;
};
/** 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;
} & BrowserRunAlternateBackendOptions;
interface BrowserRunJsonBaseOptions {
/** Custom AI models to try in order. Max 3. Falls back to next on error. */
custom_ai?: Array<{
@@ -10893,7 +11205,7 @@ interface BrowserRunJsonBaseOptions {
* Options for the `json` quick action.
* At least one of `prompt` or `response_format` must be provided.
*/
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions & ({
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
/** Natural-language prompt describing what data to extract. */
prompt: string;
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
@@ -10904,14 +11216,80 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
response_format: AiTextGenerationResponseFormat;
});
type BrowserRunContentOptions = BrowserRunCommonOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
type BrowserRunContentOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions;
type BrowserRunRedirectHop = {
/** URL that returned the redirect. */
url: string;
/** HTTP status of the redirect. */
status: number;
/** Redirect response headers, including `location`. */
headers: Record<string, string>;
};
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<string, string>;
/** 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 `<h2>`. */
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;
@@ -10924,6 +11302,7 @@ type BrowserRunLinksSuccessResponse = {
success: true;
/** Extracted links */
result: string[];
meta: BrowserRunResponseMeta;
};
/** Success response for `scrape` action. */
type BrowserRunScrapeSuccessResponse = {
@@ -10954,15 +11333,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;
};
@@ -10971,12 +11368,14 @@ type BrowserRunJsonSuccessResponse = {
success: true;
/** JSON data extracted from the page using an AI model */
result: Record<string, unknown>;
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 = {
@@ -11086,9 +11485,10 @@ declare abstract class BrowserRun {
*/
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
/**
* 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):**
@@ -11136,6 +11536,26 @@ declare abstract class BrowserRun {
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
*/
quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;
/**
* 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<Response>;
}
/**
* In addition to the properties you can set in the RequestInit dict
@@ -12206,6 +12626,13 @@ interface ForwardableEmailMessage extends EmailMessage {
* @returns A promise that resolves when the email message is replied.
*/
reply(message: EmailMessage): Promise<EmailSendResult>;
/**
* Reply to the sender of this email message with a message built from the given
* fields. Threading headers (In-Reply-To/References) are set automatically.
* @param builder The reply message contents.
* @returns A promise that resolves when the email message is replied.
*/
reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;
}
/** A file attachment for an email message */
type EmailAttachment = {
@@ -12226,23 +12653,46 @@ interface EmailAddress {
name: string;
email: string;
}
/**
* Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or
* `bcc` must be provided.
*/
type EmailDestinations = {
to?: string | EmailAddress | (string | EmailAddress)[];
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
} & ({
to: string | EmailAddress | (string | EmailAddress)[];
} | {
cc: string | EmailAddress | (string | EmailAddress)[];
} | {
bcc: string | EmailAddress | (string | EmailAddress)[];
});
/**
* Fields shared by all composed emails (no recipients). Used directly by
* `ForwardableEmailMessage.reply()`, which always replies to the original
* sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.
*/
interface EmailReplyMessageBuilder {
from: string | EmailAddress;
subject: string;
replyTo?: string | EmailAddress;
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}
/**
* Fields for composing an email without constructing raw MIME, for
* `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.
*/
type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;
/**
* A binding that allows a Worker to send email messages.
*/
interface SendEmail {
send(message: EmailMessage): Promise<EmailSendResult>;
send(builder: {
from: string | EmailAddress;
to: string | EmailAddress | (string | EmailAddress)[];
subject: string;
replyTo?: string | EmailAddress;
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}): Promise<EmailSendResult>;
send(builder: EmailMessageBuilder): Promise<EmailSendResult>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
@@ -12396,6 +12846,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.
*/
@@ -12417,6 +12876,78 @@ interface Hyperdrive {
*/
readonly database: string;
}
/**
* A handle to a dynamically-provisioned Hyperdrive connection, returned by
* `HyperdriveApi.get()`.
*/
interface HyperdriveDynamic extends Disposable {
/**
* The database name to use when connecting through this Hyperdrive.
*/
readonly database: Promise<string>;
/*
* The randomly generated user to use when authenticating to your
* database via Hyperdrive.
*/
readonly user: Promise<string>;
/*
* The randomly generated password to use when authenticating to your
* database via Hyperdrive.
*/
readonly password: Promise<string>;
/**
* Open a TCP socket to the target database through this Hyperdrive.
*
*/
connect(): Promise<Socket>;
}
/**
* Binding that provisions Hyperdrive connections at request time, rather than
* from static configuration.
*/
interface HyperdriveDynamicApi {
/**
* Provision a connection for the database described by `args`.
*
*/
get(args: HyperdriveDynamicConfig): Promise<HyperdriveDynamic>;
/**
* Get a pre-generated connection string used for connecting to dynamic Hyperdrive.
*/
getHyperdriveConnectionString(connectionString: string): Promise<string>;
}
/**
* Parameters identifying the database that a dynamically-provisioned
* Hyperdrive connection should target.
*/
interface HyperdriveDynamicConfig {
/**
* Generated connection string to pass into the dynamic worker.
*
*/
dynamicHyperdriveConnectionString: string;
/**
* Connection string for the origin database Hyperdrive should connect to.
* Contains credentials, so treat it as a secret.
*
* The scheme selects the database engine. PostgreSQL origins are supported.
*/
connectionString: string;
/**
* Region in which to place the connection pool. See the Hyperdrive
* documentation for the set of supported regions.
*/
targetRegion: string;
/**
* Whether Hyperdrive should cache query results for this connection.
*/
cachingEnabled?: boolean;
/**
* Maximum number of connections the pool may open to the origin database.
* Defaults to 60.
*/
maxConnections?: number;
}
// Copyright (c) 2024 Cloudflare, Inc.
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0
@@ -12428,6 +12959,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<Uint8Array> | TextRasterize;
type ImageTransform = {
width?: number;
height?: number;
@@ -12517,6 +13069,9 @@ interface ImageUploadOptions {
requireSignedURLs?: boolean;
metadata?: Record<string, unknown>;
creator?: string;
/**
* If 'base64', the input data will be decoded from base64 before processing
*/
encoding?: 'base64';
}
interface ImageUpdateOptions {
@@ -12524,11 +13079,40 @@ interface ImageUpdateOptions {
metadata?: Record<string, unknown>;
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<string, ImageMetadataFilterValue>;
}
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<string, unknown>;
creator?: string;
expiresIn?: number;
}
interface ImageDirectUploadResult {
id: string;
uploadURL: string;
}
interface ImageList {
images: ImageMetadata[];
@@ -12546,6 +13130,13 @@ interface ImageHandle {
* @returns ReadableStream of image bytes, or null if not found
*/
bytes(): Promise<ReadableStream<Uint8Array> | 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<string>;
/**
* Update hosted image metadata
* @param options Properties to update
@@ -12581,6 +13172,14 @@ interface HostedImagesBinding {
* @throws {@link ImagesError} if list fails
*/
list(options?: ImageListOptions): Promise<ImageList>;
/**
* 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<ImageDirectUploadResult>;
}
interface ImagesBinding {
/**
@@ -12595,6 +13194,13 @@ interface ImagesBinding {
* @returns A transform handle
*/
input(stream: ReadableStream<Uint8Array>, 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
*/
@@ -12624,11 +13230,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
*/
@@ -13064,6 +13674,11 @@ declare namespace CloudflareWorkersModule {
export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
export type WorkflowDelayDuration = WorkflowSleepDuration;
export type WorkflowDynamicDelayContext = {
ctx: WorkflowStepContext<WorkflowDelayFunction>;
error: Error;
};
export type WorkflowDelayFunction = (input: WorkflowDynamicDelayContext) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;
export type WorkflowTimeoutDuration = WorkflowSleepDuration;
export type WorkflowRetentionDuration = WorkflowSleepDuration;
export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
@@ -13071,12 +13686,32 @@ declare namespace CloudflareWorkersModule {
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
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<WorkflowStepConfig, 'retries'> & {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
backoff?: WorkflowBackoff;
};
};
type WorkflowStepConfigWithDelayFunction = Omit<WorkflowStepConfig, 'retries'> & {
retries: {
limit: number;
delay: WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
};
export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;
export type WorkflowCronSchedule = {
/** Cron expression that triggered this event. */
@@ -13097,28 +13732,51 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext = {
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
step: {
name: string;
count: number;
};
attempt: number;
config: WorkflowStepConfig;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
};
export type WorkflowRollbackContext<T = unknown> = {
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<T = unknown, Delay = WorkflowDelayDuration | number> = {
ctx: WorkflowStepContext<Delay>;
error: Error;
output: T | undefined;
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
stepName: string;
};
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown> = {
rollback: WorkflowRollbackHandler<T>;
export type WorkflowRollbackHandler<T = unknown, Delay = WorkflowDelayDuration | number> = (ctx: WorkflowRollbackContext<T, Delay>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown, Delay = WorkflowDelayDuration | number> = {
rollback: WorkflowRollbackHandler<T, Delay>;
rollbackConfig?: WorkflowStepRollbackConfig;
};
export abstract class WorkflowStep {
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
// 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<T>(...)`) 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<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithDelayFunction, callback: (ctx: WorkflowStepContext<WorkflowDelayFunction>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayFunction>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfigWithStaticDelay, callback: (ctx: WorkflowStepContext<WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T, WorkflowDelayDuration | number>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
@@ -13894,11 +14552,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;
} | {
@@ -13915,7 +14574,11 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOutputOptions = {
format?: OutputFormat;
};
type ConversionOptions = {
output?: ConversionOutputOptions;
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
@@ -14010,7 +14673,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;
@@ -14029,6 +14692,7 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
@@ -14063,11 +14727,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;
@@ -14545,10 +15220,31 @@ declare abstract class Workflow<PARAMS = unknown> {
* @returns A promise that resolves with a list of handles for the created instances.
*/
public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;
/**
* 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<WorkflowBatchDeleteResult>;
}
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<PARAMS = unknown> {
/**
* An id for your Workflow instance. Must be unique within the Workflow.
@@ -14566,6 +15262,9 @@ interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
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)
@@ -14583,6 +15282,13 @@ interface WorkflowError {
code?: number;
message: string;
}
interface WorkflowInstanceTerminateOptions {
/**
* If true, run registered rollback handlers before terminating the instance.
* Only steps that registered rollback handlers are rolled back.
*/
rollback?: boolean;
}
interface WorkflowInstanceRestartOptions {
/**
* Restart from a specific step. If omitted, the instance restarts from the beginning.
@@ -14616,14 +15322,19 @@ declare abstract class WorkflowInstance {
public resume(): Promise<void>;
/**
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
* @param options Options for termination, including whether registered rollback handlers should run.
*/
public terminate(): Promise<void>;
public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;
/**
* Restart the instance. Optionally restart from a specific step, preserving
* cached results for all steps before it.
* @param options Options for the restart, including an optional step to restart from.
*/
public restart(options?: WorkflowInstanceRestartOptions): Promise<void>;
/**
* Delete the instance and its stored state.
*/
public delete(): Promise<void>;
/**
* Returns the current status of the instance.
*/
+11 -4
View File
@@ -4,11 +4,18 @@
"main": "src/playersettings.app.ts",
"compatibility_date": "2026-06-16",
"compatibility_flags": ["nodejs_compat"],
// Per-player settings persistence.
"kv_namespaces": [
// Shared `recflare` DB (created manually with `wrangler d1 create recflare`; the
// "local" placeholder is spliced out at deploy time). This worker owns the
// `player_settings` table (schema/migration here) — one JSON row per player, which
// `api`, `match` and `chat` also read and merge into. Its own migrations_table keeps
// history separate from the other workers' migrations on the shared database.
"d1_databases": [
{
"binding": "RECFLARE_PLAYER_SETTINGS",
"id": "local"
"binding": "DB",
"database_name": "recflare",
"database_id": "local",
"migrations_dir": "migrations",
"migrations_table": "d1_migrations_playersettings"
}
],
// Shared Secrets Store holding the HS256 JWT signing key. Every worker binds the
+1 -1
View File
@@ -14,7 +14,7 @@ export * from './clubs-db'
export * from './d1-binds'
export * from './images-db'
export * from './password'
export * from './player-settings-kv'
export * from './player-settings-db'
export * from './rooms-db'
export * from './room-instance-db'
export * from './room-comments-db'
+112
View File
@@ -0,0 +1,112 @@
/**
* The player settings map — the `player_settings` table on the shared `recflare` D1.
*
* One row per player, holding every setting they have as a flat `{ [Key]: Value }` JSON
* record of strings in `data` — OOBE state, tutorial mask, chat privacy, the lot. The
* `playersettings` worker owns the table (migration: apps/playersettings/migrations/
* 0001_player_settings.sql) but `api`, `match` and `chat` each keep a setting of their own in
* the same map, so every writer merges into the record rather than replacing it, and all of
* them go through here.
*
* This replaced a Workers KV namespace (`RECFLARE_PLAYER_SETTINGS`, key `player:<id>`): the
* row's `data` is byte-for-byte what the KV value was, which is what lets `runx admin
* settings-import-kv` copy the old namespace across. The client is noisy — it re-posts
* settings it already has at every login and menu change — and every write site has to read
* the map first to merge into it, so comparing the result against what was read is free:
* {@link putPlayerSettingsIfChanged} skips the write when the merged map is the one already
* stored. (D1 reads are strongly consistent, so unlike KV a write here is visible to the next
* read from any PoP.)
*/
export type PlayerSettings = Record<string, string>
/** Schema DDL (mirror of apps/playersettings/migrations/0001_player_settings.sql). */
export const PLAYER_SETTINGS_SCHEMA_DDL: string[] = [
`CREATE TABLE IF NOT EXISTS player_settings (
account_id INTEGER PRIMARY KEY,
data TEXT NOT NULL
)`,
]
/**
* The player's stored settings, or null when they have none. A D1 failure THROWS rather than
* reading as "none": a writer that mistook an outage for an empty map would then store its
* one key over everything the player had. Read-only callers that would rather degrade wrap
* this in their own `.catch`.
*/
export async function readPlayerSettings(
db: D1Database,
accountId: number
): Promise<PlayerSettings | null> {
const row = await db
.prepare('SELECT data FROM player_settings WHERE account_id = ?1')
.bind(accountId)
.first<{ data: string }>()
return row === null ? null : (JSON.parse(row.data) as PlayerSettings)
}
/** Store `settings` as the player's whole map, replacing whatever row they had. */
export async function writePlayerSettings(
db: D1Database,
accountId: number,
settings: PlayerSettings
): Promise<void> {
await db
.prepare(
`INSERT INTO player_settings (account_id, data) VALUES (?1, ?2)
ON CONFLICT (account_id) DO UPDATE SET data = excluded.data`
)
.bind(accountId, JSON.stringify(settings))
.run()
}
/** Drop the player's row entirely — their next read is a first read again. */
export async function deletePlayerSettings(db: D1Database, accountId: number): Promise<void> {
await db.prepare('DELETE FROM player_settings WHERE account_id = ?1').bind(accountId).run()
}
/** Whether two settings maps hold the same keys with the same values. Order is irrelevant. */
export function samePlayerSettings(a: PlayerSettings | null, b: PlayerSettings | null): boolean {
const left = a ?? {}
const right = b ?? {}
const keys = Object.keys(left)
if (keys.length !== Object.keys(right).length) return false
return keys.every((key) => key in right && left[key] === right[key])
}
/**
* Store `next` as the player's settings unless it is what `existing` already says, in which
* case nothing is written. Returns whether a write happened.
*
* `existing` is the map the caller read to build `next` from; passing the map it read (not a
* fresh read) is the point — the comparison costs no database operation.
*/
export async function putPlayerSettingsIfChanged(
db: D1Database,
accountId: number,
existing: PlayerSettings | null,
next: PlayerSettings
): Promise<boolean> {
if (existing !== null && samePlayerSettings(existing, next)) return false
await writePlayerSettings(db, accountId, next)
return true
}
/**
* Merge `patch` into the player's settings, writing only if a value actually changed. The
* result carries the merged map (what the player now has) and whether the row was written.
*
* Read-modify-write here isn't atomic; racing writers means one player toggling two of their
* own options in the same instant, which every caller has accepted since before this helper
* existed.
*/
export async function mergePlayerSettings(
db: D1Database,
accountId: number,
patch: PlayerSettings
): Promise<{ settings: PlayerSettings; written: boolean }> {
const existing = await readPlayerSettings(db, accountId)
const settings: PlayerSettings = { ...existing, ...patch }
const written = await putPlayerSettingsIfChanged(db, accountId, existing, settings)
return { settings, written }
}
-81
View File
@@ -1,81 +0,0 @@
/**
* The player settings map in the `RECFLARE_PLAYER_SETTINGS` KV namespace.
*
* One key per player, `player:<accountId>`, holding every setting they have as a flat
* `{ [Key]: Value }` record of strings — OOBE state, tutorial mask, chat privacy, the lot.
* The `playersettings` worker owns the namespace but `api`, `match` and `chat` each keep a
* setting of their own in the same map, so every writer merges into the record rather than
* replacing it, and all of them go through here.
*
* KV writes cost roughly ten times a read and are capped at one per second per key, and the
* client is noisy: it re-posts settings it already has at every login and menu change. Every
* write site has to read the map first to merge into it, so comparing the result against what
* was read is free — {@link putPlayerSettingsIfChanged} skips the `put` when the merged map
* is the one already stored.
*/
export type PlayerSettings = Record<string, string>
/** The KV key holding a player's settings. */
export function playerSettingsKey(accountId: number): string {
return `player:${accountId}`
}
/**
* The player's stored settings, or null when they have none. A KV failure THROWS rather than
* reading as "none": a writer that mistook an outage for an empty map would then store its
* one key over everything the player had. Read-only callers that would rather degrade wrap
* this in their own `.catch`.
*/
export async function readPlayerSettings(
kv: KVNamespace,
accountId: number
): Promise<PlayerSettings | null> {
return kv.get<PlayerSettings>(playerSettingsKey(accountId), 'json')
}
/** Whether two settings maps hold the same keys with the same values. Order is irrelevant. */
export function samePlayerSettings(a: PlayerSettings | null, b: PlayerSettings | null): boolean {
const left = a ?? {}
const right = b ?? {}
const keys = Object.keys(left)
if (keys.length !== Object.keys(right).length) return false
return keys.every((key) => key in right && left[key] === right[key])
}
/**
* Store `next` as the player's settings unless it is what `existing` already says, in which
* case nothing is written. Returns whether a write happened.
*
* `existing` is the map the caller read to build `next` from; passing the map it read (not a
* fresh read) is the point — the comparison costs no KV operation.
*/
export async function putPlayerSettingsIfChanged(
kv: KVNamespace,
accountId: number,
existing: PlayerSettings | null,
next: PlayerSettings
): Promise<boolean> {
if (existing !== null && samePlayerSettings(existing, next)) return false
await kv.put(playerSettingsKey(accountId), JSON.stringify(next))
return true
}
/**
* Merge `patch` into the player's settings, writing only if a value actually changed. The
* result carries the merged map (what the player now has) and whether KV was written.
*
* Read-modify-write on KV isn't atomic; racing writers here means one player toggling two
* of their own options in the same instant, which every caller has accepted since before
* this helper existed.
*/
export async function mergePlayerSettings(
kv: KVNamespace,
accountId: number,
patch: PlayerSettings
): Promise<{ settings: PlayerSettings; written: boolean }> {
const existing = await readPlayerSettings(kv, accountId)
const settings: PlayerSettings = { ...existing, ...patch }
const written = await putPlayerSettingsIfChanged(kv, accountId, existing, settings)
return { settings, written }
}
+180
View File
@@ -32,6 +32,7 @@ import type { D1ExecResult } from '../d1'
* runx admin grant-plus --username alice [--revoke] [--remote]
* runx admin reload-plus <amount> [--dry-run] [--remote]
* runx admin cai-load [--file <export.json>] [--dry-run] [--remote]
* runx admin settings-import-kv [--namespace-id <id>] [--overwrite] [--dry-run] [--remote]
*/
/**
@@ -404,6 +405,184 @@ const caiLoad = new Command('cai-load')
console.log(chalk.green(`✓ custom avatar items loaded into ${target(remote)}`))
})
/** The KV binding the player settings used to live under — the key `RECFLARE_KV` files its id by. */
const SETTINGS_KV_BINDING = 'RECFLARE_PLAYER_SETTINGS'
/** Every settings key in that namespace was `player:<accountId>`. */
const SETTINGS_KV_PREFIX = 'player:'
/** The KV bulk-get API takes at most this many keys per request. */
const KV_BULK_GET_LIMIT = 100
/**
* Run `wrangler kv …` from the `playersettings` directory — the namespace was that worker's
* binding, so with `--local` the dev-store state wrangler kept for it is under its .wrangler/.
*/
async function runKv(args: string[], remote: boolean): Promise<string> {
cd(path.join(getRepoRoot(), 'apps', 'playersettings'))
const out = await $`pnpm exec wrangler kv ${args} ${remote ? '--remote' : '--local'}`.quiet()
return out.stdout
}
/** The JSON wrangler prints after its banner (which can carry ANSI `[` sequences of its own). */
function parseWranglerJson<T>(stdout: string): T {
const m = /^[[{]/m.exec(stdout)
if (!m) throw new Error(`unexpected wrangler output:\n${stdout}`)
return JSON.parse(stdout.slice(m.index)) as T
}
/** The old namespace's id, from the `RECFLARE_KV` entry the deploys used to splice it from. */
async function settingsNamespaceIdFromEnv(): Promise<string> {
const raw = await readRootEnv('RECFLARE_KV')
const id = raw ? (JSON.parse(raw) as Record<string, string>)[SETTINGS_KV_BINDING] : undefined
if (id) return id
throw new Error(
`no ${SETTINGS_KV_BINDING} id in RECFLARE_KV — pass --namespace-id, or add the old namespace's id to .env`
)
}
/**
* Copy the old `RECFLARE_PLAYER_SETTINGS` KV namespace into the `player_settings` table (owned
* by the `playersettings` worker). A KV value was the player's whole map as a JSON object of
* strings, which is exactly what the row's `data` holds, so each key becomes one row.
*
* Rows that already exist are MERGED, with D1 winning: `json_patch(kv, d1)` keeps every key
* the live row has and adds the ones only KV knew. That makes the import safe to run after
* the workers have cut over (a player who has since toggled something keeps it) and to
* re-run. `--overwrite` makes KV win outright instead. Nothing is deleted on either side.
*/
const settingsImportKv = new Command('settings-import-kv')
.description('Copy the old RECFLARE_PLAYER_SETTINGS KV namespace into player_settings (merges)')
.option(
'--namespace-id <id>',
`The KV namespace to read (default: ${SETTINGS_KV_BINDING} in RECFLARE_KV from .env; "local" with --local)`
)
.option(
'--overwrite',
'Let the KV value replace a row that already exists (the default merges, keeping what D1 has)',
false
)
.option('--dry-run', 'Read the namespace, report what would be written, change nothing', false)
.option('--local', 'Target the local dev database and KV store (the default).', false)
.option('--remote', 'Target the deployed database and namespace instead.', false)
.action(async (opts) => {
const remote = resolveRemote(opts)
const namespaceId = opts.namespaceId ?? (remote ? await settingsNamespaceIdFromEnv() : 'local')
console.log(
`Reading KV namespace ${namespaceId} (${remote ? 'remote' : 'local'}) into ${target(remote)}`
)
const keys = parseWranglerJson<Array<{ name: string }>>(
await runKv(
['key', 'list', '--namespace-id', namespaceId, '--prefix', SETTINGS_KV_PREFIX],
remote
)
).map((k) => k.name)
console.log(`${keys.length} ${SETTINGS_KV_PREFIX}* key(s) in the namespace`)
const rows: Array<{ accountId: number; data: string }> = []
const skipped: string[] = []
let empty = 0
for (let i = 0; i < keys.length; i += KV_BULK_GET_LIMIT) {
const chunk = keys.slice(i, i + KV_BULK_GET_LIMIT)
const file = path.join(os.tmpdir(), `recflare-kv-keys-${Date.now()}-${i}.json`)
await fs.writeFile(file, JSON.stringify(chunk))
let got: Record<string, { value: string | null }>
try {
got = parseWranglerJson(
await runKv(['bulk', 'get', file, '--namespace-id', namespaceId], remote)
)
} finally {
await fs.remove(file)
}
for (const key of chunk) {
const accountId = Number(key.slice(SETTINGS_KV_PREFIX.length))
const value = got[key]?.value
let parsed: unknown = null
try {
parsed = value == null ? null : JSON.parse(value)
} catch {
parsed = null
}
const isMap =
parsed !== null &&
typeof parsed === 'object' &&
!Array.isArray(parsed) &&
Object.values(parsed).every((v) => typeof v === 'string')
if (!Number.isSafeInteger(accountId) || accountId <= 0 || !isMap) {
skipped.push(key)
continue
}
// An empty map is what a player with no row reads as; nothing to import.
if (Object.keys(parsed as object).length === 0) {
empty++
continue
}
rows.push({ accountId, data: JSON.stringify(parsed) })
}
console.log(` fetched ${Math.min(i + chunk.length, keys.length)}/${keys.length}`)
}
for (const key of skipped) console.log(chalk.yellow(` skipping ${key}: not a settings map`))
const onConflict = opts.overwrite
? 'excluded.data'
: 'json_patch(excluded.data, player_settings.data)'
const statements = rows.map(
(r) =>
`INSERT INTO player_settings (account_id, data) VALUES (${r.accountId}, '${sqlStr(r.data)}') ON CONFLICT (account_id) DO UPDATE SET data = ${onConflict};`
)
console.log(
`${rows.length} player(s) to import, ${empty} empty, ${skipped.length} skipped` +
(opts.overwrite ? ' (KV overwrites existing rows)' : ' (existing rows merge, D1 wins)')
)
if (opts.dryRun) {
console.log(
chalk.cyan(`--dry-run: built ${statements.length} statements; nothing was written.`)
)
return
}
if (rows.length === 0) {
console.log(chalk.green('✓ nothing to import'))
return
}
const count = async (): Promise<number> =>
Number(
(await execSql('SELECT COUNT(*) AS n FROM player_settings', remote, 'playersettings'))
.results[0]?.n ?? 0
)
const before = await count()
const sqlFile = path.join(os.tmpdir(), `recflare-settings-${Date.now()}.sql`)
await fs.writeFile(sqlFile, statements.join('\n'))
try {
await execSqlFile(sqlFile, remote, 'playersettings')
} finally {
await fs.remove(sqlFile)
}
// Prove it landed: a merge never deletes, so the table holds at least every imported id.
const after = await count()
const ids = rows.map((r) => r.accountId)
const found = Number(
(
await execSql(
`SELECT COUNT(*) AS n FROM player_settings WHERE account_id IN (${ids.join(', ')})`,
remote,
'playersettings'
)
).results[0]?.n ?? 0
)
if (found !== ids.length) {
throw new Error(
`import did not land: ${ids.length - found} of ${ids.length} rows are missing. Re-run it.`
)
}
const added = after - before
console.log(
`${added} new row(s), ${rows.length - added} merged into existing rows (${after} rows now)`
)
console.log(chalk.green(`✓ player settings imported into ${target(remote)}`))
})
const lookup = new Command('lookup')
.description('Print an account by id or username')
.option('--account <id>', 'Account id to look up')
@@ -467,6 +646,7 @@ export const adminCmd = new Command('admin')
.addCommand(grantStudio)
.addCommand(reloadPlus)
.addCommand(caiLoad)
.addCommand(settingsImportKv)
.addCommand(lookup)
.addHelpText(
'after',