Compare commits

..

4 Commits

Author SHA1 Message Date
Devin Zuczek d819bdbe3d [www] add instance clear button for staff 2026-10-26 18:27:59 -04:00
Devin Zuczek 207138ef97 [rooms] keep invited roles on the roles endpoint for the permissions list 2026-10-26 18:25:06 -04:00
Devin Zuczek f2c16f198a [rooms] only show confirmed role invites 2026-10-26 18:17:13 -04:00
Devin Zuczek d14d96f489 [www] add discord delink 2026-10-26 18:17:13 -04:00
49 changed files with 2338 additions and 5565 deletions
+5 -6
View File
@@ -24,12 +24,11 @@ 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. 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"}'
# 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"}'
# 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
+1 -31
View File
@@ -158,36 +158,6 @@ 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), this import,
`just deploy`, then this import AGAIN. The first run does the bulk while the KV-backed workers
are still live; the second picks up players and keys that appeared in KV in between. The import MERGES:
KV fills in what a row lacks, and the row wins any key it has moved off the seeded default.
A key still AT its default (`Recroom.OOBE` 77, `TUTORIAL_COMPLETE_MASK` 11,
`FIRST_TIME_IN_FLAGS` 0) loses to KV, because `GET /playersettings` seeds exactly those for a
player with no row, so a returning player who signed in before their map was imported keeps
their KV progress. The one thing it can't recover is a KV change made between the first
run and the deploy to a key the first run already imported off-default; keep that window
short. `--overwrite` makes the KV value win outright. Nothing is deleted on either side. A
value that is a number or boolean is imported as its string; a null, object or array value
drops only that key; a key that isn't a `player:<id>` holding a JSON object is reported and
skipped. Once the second run is done, the namespace (and the `RECFLARE_KV` line) can be deleted.
### `lookup` — print an account
```sh
@@ -202,7 +172,7 @@ the account has a password, the developer role, and the moderator role.
### Selecting an account
Every command except `reload-plus`, `cai-load` and `settings-import-kv` targets exactly one account, by **either**:
Every command except `reload-plus` and `cai-load` targets exactly one account, by **either**:
- `--account <id>` — numeric account id
- `--username <name>` — username (case-insensitive)
+7 -10
View File
@@ -23,6 +23,7 @@ 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?
@@ -33,12 +34,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, R2, Durable Objects) the workers use. On another
storage bindings (D1, KV, 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 D1 for another SQLite-compatible
database (Turso, say) and R2 for S3, 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 KV for Redis, which are very similar
services but would require small code changes.
## Prerequisites
@@ -106,16 +107,12 @@ 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` (`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` after `just migrate`, then again right after
> `just deploy` (see CLI.md).
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>"}'`)
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,12 +143,3 @@ 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) |
| Matchmaking | `match` | `match` | Matchmaking & per-player presence (D1, KV) |
| 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 (D1) |
| PlayerSettings | `playersettings` | `playersettings` | Per-player settings (KV) |
| 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) |
+10 -6
View File
@@ -33,12 +33,8 @@ export type Env = SharedHonoEnv & {
* may sign in on it — so the version check never sends a supporter to update.
*/
ROLLOUT_GAME_VERSIONS?: string
// 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`.
// Shared rooms database (schema/migrations owned by the `rooms` worker). Used
// read-only here to resolve room roles for `/api/rooms/v1/verifyRole`.
DB: D1Database
// Image bucket (shared with the `img` worker, which serves objects back by
// key). Uploaded saved images are written here.
@@ -46,6 +42,14 @@ 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 / the database is unreachable. */
/** The player's settings map, or null when they have none / KV is unreachable. */
async function getPlayerSettings(
env: App['Bindings'],
accountId: number
): Promise<Record<string, string> | null> {
return readPlayerSettings(env.DB, accountId).catch(() => null)
return readPlayerSettings(env.RECFLARE_PLAYER_SETTINGS, 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 writes are the cost.
* does that freely, and KV writes are the cost.
*/
async function writePhotoTaggingSetting(
env: App['Bindings'],
accountId: number,
setting: number
): Promise<void> {
await mergePlayerSettings(env.DB, accountId, {
await mergePlayerSettings(env.RECFLARE_PLAYER_SETTINGS, accountId, {
[PHOTO_TAGGING_KEY]: String(setting),
})
}
+12 -33
View File
@@ -17,11 +17,9 @@ 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,
@@ -136,23 +134,6 @@ 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')
@@ -196,10 +177,6 @@ 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()
@@ -7246,30 +7223,32 @@ describe('images', () => {
expect(await (await read('710')).text()).toBe('2')
// It's stored under `playerPhotoTaggingSetting` in the player's settings bag...
const stored = await readPlayerSettings(env.DB, 710)
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:710',
'json'
)
expect(stored?.playerPhotoTaggingSetting).toBe('2')
// ...and the write MERGES: the player's other settings survive it.
await seedSettings(
711,
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:711',
JSON.stringify({ 'Recroom.OOBE': '77', playerPhotoTaggingSetting: '1' })
)
expect(await (await read('711')).text()).toBe('1')
await write('711', { Setting: 0 })
expect(await readPlayerSettings(env.DB, 711)).toEqual({
'Recroom.OOBE': '77',
playerPhotoTaggingSetting: '0',
})
expect(
await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>('player:711', 'json')
).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: the raw value is seeded with
// Re-posting the stored value writes nothing to KV: 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 seedSettings(712, padded)
await env.RECFLARE_PLAYER_SETTINGS.put('player:712', padded)
expect(await (await write('712', { Setting: 1 })).text()).toBe('1')
expect(await rawSettings(712)).toBe(padded)
expect(await env.RECFLARE_PLAYER_SETTINGS.get('player:712', 'text')).toBe(padded)
// A body with no readable Setting leaves the stored value alone rather than writing 0
// — and answers what the player still has.
+242 -953
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20260831.1 2026-06-16 nodejs_compat
// Runtime types generated with workerd@1.20260625.1 2025-09-20 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. This is how error conditions are described in web APIs.
* The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
*/
declare class DOMException extends Error {
constructor(message?: string, name?: string);
/**
* The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
* The **`message`** read-only property of the a message or description associated with the given error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
*/
readonly message: string;
/**
* The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
* The **`name`** read-only property of the one of the strings associated with an error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
*/
readonly name: string;
/**
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
* 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().
* The **`console.countReset()`** static method resets counter used with console/count_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
*/
countReset(label?: string): void;
/**
* 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.
* The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
*/
debug(...data: any[]): void;
/**
* 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.
* The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
*/
dir(item?: any, options?: any): void;
/**
* 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.
* The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
*/
dirxml(...data: any[]): void;
/**
* 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.
* The **`console.error()`** static method outputs a message to the console at the 'error' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
*/
error(...data: any[]): void;
/**
* 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.
* The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
*/
group(...data: any[]): void;
/**
* 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.
* The **`console.groupCollapsed()`** static method creates a new inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
*/
groupCollapsed(...data: any[]): void;
/**
* 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.
* The **`console.groupEnd()`** static method exits the current inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
*/
groupEnd(): void;
/**
* 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.
* The **`console.info()`** static method outputs a message to the console at the 'info' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
*/
@@ -168,24 +168,23 @@ 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. 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.
* The **`console.time()`** static method starts a timer you can use to track how long an operation takes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
*/
time(label?: string): void;
/**
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time().
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
*/
timeEnd(label?: string): void;
/**
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time().
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
*/
timeLog(label?: string, ...data: any[]): void;
/* 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.
@@ -194,7 +193,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 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.
* The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
*/
@@ -360,7 +359,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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().
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -405,7 +404,6 @@ 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,
@@ -422,12 +420,10 @@ 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>;
@@ -516,7 +512,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" | "us";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -530,7 +526,6 @@ 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;
@@ -545,7 +540,7 @@ interface DurableObjectState<Props = unknown> {
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string, options?: DurableObjectAbortOptions): void;
abort(reason?: string): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
@@ -581,9 +576,6 @@ interface DurableObjectStorage {
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectAbortOptions {
retryAlarm?: boolean;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
@@ -634,26 +626,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. 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.
* The **`type`** read-only property of the Event interface returns a string containing the event's type.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
*/
get type(): string;
/**
* The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.
* The **`eventPhase`** read-only property of the being evaluated.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
*/
get eventPhase(): number;
/**
* 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.
* The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
*/
@@ -690,13 +682,13 @@ declare class Event {
*/
get currentTarget(): EventTarget | undefined;
/**
* 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.
* The read-only **`target`** property of the dispatched.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
get target(): EventTarget | undefined;
/**
* The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.
* The deprecated **`Event.srcElement`** is an alias for the Event.target property.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
@@ -709,45 +701,45 @@ declare class Event {
*/
get timeStamp(): number;
/**
* 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.
* The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
*/
get isTrusted(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated. 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.
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
get cancelBubble(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated. 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.
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
set cancelBubble(value: boolean);
/**
* The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.
* The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
*/
stopImmediatePropagation(): void;
/**
* 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.
* The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
*/
preventDefault(): void;
/**
* 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().
* The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
*/
stopPropagation(): void;
/**
* 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.
* The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
*/
@@ -768,7 +760,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. In other words, any target of events implements the three methods associated with this interface.
* The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
*/
@@ -781,13 +773,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 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.
* The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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().
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -819,7 +811,7 @@ declare class AbortController {
*/
get signal(): AbortSignal;
/**
* 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.
* The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
*/
@@ -832,7 +824,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 abort event).
* The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
*/
@@ -844,13 +836,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 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.
* The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
*/
static any(signals: AbortSignal[]): AbortSignal;
/**
* 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)
*/
@@ -866,17 +858,12 @@ 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 reason if the signal has been aborted; otherwise it does nothing.
* The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
*/
throwIfAborted(): void;
}
/**
* 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>;
}
@@ -884,20 +871,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. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
* The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
*/
declare abstract class ExtendableEvent extends Event {
/**
* 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.
* The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
*/
waitUntil(promise: Promise<any>): void;
}
/**
* The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
* The **`CustomEvent`** interface represents events initialized by an application for any purpose.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
*/
@@ -936,7 +923,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)
*/
@@ -954,13 +941,13 @@ declare class Blob {
*/
bytes(): Promise<Uint8Array>;
/**
* 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.
* The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)
*/
text(): Promise<string>;
/**
* 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)
*/
@@ -977,13 +964,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. For security reasons, the path is excluded from this property.
* The **`name`** read-only property of the File interface returns the name of the file represented by a File object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
*/
get name(): string;
/**
* 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.
* The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
*/
@@ -1000,7 +987,7 @@ interface FileOptions {
*/
declare abstract class CacheStorage {
/**
* The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.
* The **`open()`** method of the the Cache object matching the `cacheName`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
*/
@@ -1033,14 +1020,14 @@ interface CacheQueryOptions {
*/
declare abstract class Crypto {
/**
* The **`Crypto.subtle`** read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations.
* The **`Crypto.subtle`** read-only property returns a cryptographic operations.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
*/
get subtle(): SubtleCrypto;
/**
* 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).
* The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)
*/
@@ -1068,7 +1055,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. 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").
* The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)
*/
@@ -1086,7 +1073,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. 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.
* The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)
*/
@@ -1104,7 +1091,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 SubtleCrypto interface can be used to derive an array of bits from a base key.
* The **`deriveBits()`** method of the key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)
*/
@@ -1122,13 +1109,13 @@ declare abstract class SubtleCrypto {
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* 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.
* The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)
*/
wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
/**
* 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.
* The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)
*/
@@ -1136,20 +1123,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 generateKey(), deriveKey(), importKey(), or unwrapKey().
* The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
*/
declare abstract class CryptoKey {
/**
* 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:
* The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)
*/
readonly type: string;
/**
* 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)
*/
@@ -1266,15 +1253,12 @@ interface CryptoKeyArbitraryKeyAlgorithm {
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
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, or GBK. A decoder takes an array of bytes as input and returns a JavaScript string.
* The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
*/
@@ -1291,20 +1275,20 @@ declare class TextDecoder {
get ignoreBOM(): boolean;
}
/**
* The **`TextEncoder`** interface enables you to encode a JavaScript string using UTF-8.
* The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
*/
declare class TextEncoder {
constructor();
/**
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Uint8Array containing the string encoded using UTF-8.
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
*/
encode(input?: string): Uint8Array;
/**
* 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.
* The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
*/
@@ -1361,9 +1345,6 @@ declare class ErrorEvent extends Event {
get error(): any;
}
interface ErrorEventErrorEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
message?: string;
filename?: string;
lineno?: number;
@@ -1376,139 +1357,135 @@ 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 MessageEvent interface represents the data sent by the message emitter.
* The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
*/
readonly data: any;
/**
* The **`origin`** read-only property of the MessageEvent interface is a string representing the origin of the message emitter.
* The **`origin`** read-only property of the origin of the message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
*/
readonly origin: string | null;
/**
* The **`lastEventId`** read-only property of the MessageEvent interface is a string representing a unique ID for the event.
* The **`lastEventId`** read-only property of the unique ID for the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
*/
readonly lastEventId: string;
/**
* The **`source`** read-only property of the MessageEvent interface is a MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter.
* The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
*/
readonly source: MessagePort | null;
/**
* The **`ports`** read-only property of the MessageEvent interface is an array of MessagePort objects containing all MessagePort objects sent with the message, in order.
* The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
*/
readonly ports: MessagePort[];
}
interface MessageEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
data?: any;
origin?: string;
lastEventId?: string;
source?: MessagePort;
ports?: MessagePort[];
data: ArrayBuffer | string;
}
/**
* 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.
* The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)
*/
declare abstract class PromiseRejectionEvent extends Event {
/**
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript Promise which was rejected. You can examine the event's PromiseRejectionEvent.reason property to learn why the promise was rejected.
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)
*/
readonly promise: Promise<any>;
/**
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). This in theory provides information about why the promise was rejected.
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)
*/
readonly reason: any;
}
/**
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the 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".
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
*/
declare class FormData {
constructor();
/**
* The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
* 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. If you expect multiple values and want all of them, use the getAll() method instead.
* The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)
*/
get(name: string): (File | string) | null;
/**
* The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a FormData object.
* 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<[
@@ -1587,19 +1564,19 @@ interface DocumentEnd {
append(content: string, options?: ContentOptions): DocumentEnd;
}
/**
* This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.
* This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
*/
declare abstract class FetchEvent extends ExtendableEvent {
/**
* The **`request`** read-only property of the FetchEvent interface returns the Request that triggered the event handler.
* The **`request`** read-only property of the the event handler.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)
*/
readonly request: Request;
/**
* The **`respondWith()`** method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself.
* The **`respondWith()`** method of allows you to provide a promise for a Response yourself.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)
*/
@@ -1608,62 +1585,65 @@ 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. These actions include retrieving, setting, adding to, and removing headers from the list of the request's headers.
* The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
*/
declare class Headers {
constructor(init?: HeadersInit);
/**
* 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.
* The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)
*/
get(name: string): string | null;
getAll(name: string): string[];
/**
* 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.
* The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
*/
getSetCookie(): string[];
/**
* 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 | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;
type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;
declare abstract class Body {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
get body(): ReadableStream | null;
@@ -1719,7 +1699,7 @@ interface Response extends Body {
*/
statusText: string;
/**
* The **`headers`** read-only property of the Response interface contains the Headers object associated with the response.
* The **`headers`** read-only property of the with the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)
*/
@@ -1737,7 +1717,7 @@ interface Response extends Body {
*/
redirected: boolean;
/**
* 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.
* The **`url`** read-only property of the Response interface contains the URL of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)
*/
@@ -1745,7 +1725,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 determines whether scripts are able to access the response body and headers.
* The **`type`** read-only property of the Response interface contains the type of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)
*/
@@ -1776,13 +1756,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 Request interface contains the request's method (GET, POST, etc.)
* The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
*/
@@ -1794,7 +1774,7 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> e
*/
url: string;
/**
* The **`headers`** read-only property of the Request interface contains the Headers object associated with the request.
* The **`headers`** read-only property of the with the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
*/
@@ -1820,13 +1800,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. It controls how the request will interact with the browser's HTTP cache.
* The **`cache`** read-only property of the Request interface contains the cache mode of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
*/
@@ -2215,7 +2195,7 @@ type ReadableStreamReadResult<R = any> = {
value?: undefined;
};
/**
* 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.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2233,13 +2213,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. While the stream is locked, no other reader can be acquired until this one is released.
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
getReader(): ReadableStreamDefaultReader<R>;
/**
* 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.
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
@@ -2251,13 +2231,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 ReadableStream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances.
* The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)
*/
@@ -2269,7 +2249,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 Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2301,7 +2281,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. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files.
* The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)
*/
@@ -2310,13 +2290,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. 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.
* The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
*/
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* 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.
* The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)
*/
@@ -2335,7 +2315,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)
*/
@@ -2361,13 +2341,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. Default controllers are for streams that are not byte streams.
* The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)
*/
declare abstract class ReadableStreamDefaultController<R = any> {
/**
* The **`desiredSize`** read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue.
* The **`desiredSize`** read-only property of the required to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)
*/
@@ -2379,32 +2359,32 @@ declare abstract class ReadableStreamDefaultController<R = any> {
*/
close(): void;
/**
* The **`enqueue()`** method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream.
* The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)
*/
enqueue(chunk?: R): void;
/**
* The **`error()`** method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error.
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)
*/
error(reason: any): void;
}
/**
* 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.
* The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
*/
declare abstract class ReadableByteStreamController {
/**
* The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests.
* 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)
*/
@@ -2416,7 +2396,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 transferred 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 copied into the stream's internal queues).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)
*/
@@ -2429,7 +2409,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. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
* The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
*/
@@ -2441,7 +2421,7 @@ declare abstract class WritableStreamDefaultController {
*/
get signal(): AbortSignal;
/**
* The **`error()`** method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error.
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)
*/
@@ -2466,7 +2446,7 @@ declare abstract class TransformStreamDefaultController<O = any> {
*/
enqueue(chunk?: O): void;
/**
* 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.
* The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)
*/
@@ -2488,14 +2468,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. This object comes with built-in backpressure and queuing.
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
*/
declare class WritableStream<W = any> {
constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);
/**
* 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)
*/
@@ -2507,83 +2487,83 @@ declare class WritableStream<W = any> {
*/
abort(reason?: any): Promise<void>;
/**
* 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.
* The **`close()`** method of the WritableStream interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)
*/
close(): Promise<void>;
/**
* 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.
* The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)
*/
getWriter(): WritableStreamDefaultWriter<W>;
}
/**
* 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 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.
* The **`closed`** read-only property of the the stream errors or the writer's lock is released.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)
*/
get closed(): Promise<void>;
/**
* 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.
* The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)
*/
get ready(): Promise<void>;
/**
* The **`desiredSize`** read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue.
* The **`desiredSize`** read-only property of the to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)
*/
get desiredSize(): number | null;
/**
* 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.
* The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)
*/
abort(reason?: any): Promise<void>;
/**
* The **`close()`** method of the WritableStreamDefaultWriter interface closes the associated writable stream.
* The **`close()`** method of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)
*/
close(): Promise<void>;
/**
* 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.
* The **`write()`** method of the operation.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)
*/
write(chunk?: W): Promise<void>;
/**
* 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.
* The **`releaseLock()`** method of the corresponding stream.
*
* [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. This stream emits the transformed output data.
* The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)
*/
get readable(): ReadableStream<O>;
/**
* 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.
* The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)
*/
@@ -2602,7 +2582,7 @@ interface ReadableStreamValuesOptions {
preventCancel?: boolean;
}
/**
* 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.
* The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)
*/
@@ -2610,7 +2590,7 @@ declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* 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.
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)
*/
@@ -2618,7 +2598,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. 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.
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)
*/
@@ -2627,7 +2607,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. 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.
* The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)
*/
@@ -2776,12 +2756,6 @@ 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;
@@ -2802,7 +2776,7 @@ interface UnsafeTraceMetrics {
fromTrace(item: TraceItem): TraceMetrics;
}
/**
* 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.
* The **`URL`** interface is used to parse, construct, normalize, and encode URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
*/
@@ -2827,121 +2801,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. If the URL does not have a username, this property contains an empty string, "".
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
get username(): string;
/**
* 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, "".
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
set username(value: string);
/**
* 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, "".
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
get password(): string;
/**
* 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, "".
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
set password(value: string);
/**
* 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, "".
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
get host(): string;
/**
* 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, "".
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
set host(value: string);
/**
* 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.
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
get hostname(): string;
/**
* 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.
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
set hostname(value: string);
/**
* 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, "".
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
get port(): string;
/**
* 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, "".
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
set port(value: string);
/**
* 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.
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
get pathname(): string;
/**
* 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.
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
set pathname(value: string);
/**
* 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, "".
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
get search(): string;
/**
* 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, "".
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
set search(value: string);
/**
* 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, "".
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
get hash(): string;
/**
* 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, "".
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
set hash(value: string);
/**
* 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.
* The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
*/
get searchParams(): URLSearchParams;
/**
* 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().
* The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
*/
@@ -2961,13 +2935,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 blob URL pointing to the object given in the parameter.
* The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
*/
static createObjectURL(object: File | Blob): string;
/**
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL().
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
*/
@@ -3017,22 +2991,25 @@ 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. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it.
* The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
*/
set(name: string, value: string): void;
/**
* 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).
* The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
*/
sort(): void;
/* Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[
key: string,
value: string
]>;
/* 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] }*/
@@ -3042,78 +3019,18 @@ 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 {
@@ -3146,7 +3063,7 @@ interface URLPatternOptions {
ignoreCase?: boolean;
}
/**
* A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
* A `CloseEvent` is sent to clients using WebSockets when the connection is closed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
*/
@@ -3165,16 +3082,13 @@ 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;
@@ -3186,7 +3100,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)
*/
@@ -3203,20 +3117,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. 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.
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
/**
* The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.
* The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
*/
@@ -3236,13 +3150,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. This is currently only the empty string or a list of extensions as negotiated by the connection.
* The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
*/
@@ -3329,25 +3243,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 EventSource.readyState attribute to 2 (closed).
* The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
*/
close(): void;
/**
* The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.
* The **`url`** read-only property of the URL of the source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
*/
get url(): string;
/**
* The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.
* The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
*/
get withCredentials(): boolean;
/**
* The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.
* The **`readyState`** read-only property of the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
*/
@@ -3382,26 +3296,18 @@ 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;
@@ -3428,42 +3334,25 @@ interface ContainerDirectorySnapshotOptions {
dir: string;
name?: string;
}
type ContainerDirectorySnapshotRestoreParams = {
interface 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;
}
type ContainerStartupOptions = {
interface 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[];
} & ({
image: string;
containerSnapshot?: never;
} | {
image?: never;
containerSnapshot?: ContainerSnapshotRestoreParams;
});
interface ContainerStartResources {
vcpu: number;
memoryMib: number;
diskMb: number;
containerSnapshot?: ContainerSnapshot;
}
/**
* 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.
@@ -3472,19 +3361,19 @@ interface ContainerStartResources {
*/
declare abstract class MessagePort extends EventTarget {
/**
* The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
* The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
*/
postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;
/**
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port.
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
*/
close(): void;
/**
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage.
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
*/
@@ -3500,13 +3389,13 @@ declare abstract class MessagePort extends EventTarget {
declare class MessageChannel {
constructor();
/**
* 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.
* The **`port1`** read-only property of the the port attached to the context that originated the channel.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
*/
readonly port1: MessagePort;
/**
* The **`port2`** read-only property of the 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.
* The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
*/
@@ -3566,7 +3455,7 @@ interface WorkerLoaderModule {
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
wasm?: ArrayBuffer;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
@@ -3574,7 +3463,7 @@ interface WorkerLoaderWorkerCode {
allowExperimental?: boolean;
limits?: workerdResourceLimits;
mainModule: string;
modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
modules: Record<string, WorkerLoaderModule | string>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
@@ -3596,7 +3485,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 serializer; it returns a JSON representation of the Performance object.
* The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
*/
@@ -3605,13 +3494,11 @@ 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): this;
setAttributes(attributes: Record<string, boolean | number | string | undefined>): this;
setAttribute(key: string, value?: (boolean | number | string)): void;
end(): void;
}
/**
@@ -4251,13 +4138,6 @@ 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[];
@@ -10155,163 +10035,6 @@ 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;
@@ -10404,13 +10127,6 @@ 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 = {
/**
@@ -11077,15 +10793,6 @@ 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"`. */
@@ -11120,7 +10827,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?: {
@@ -11156,7 +10863,7 @@ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @default 30000 */
timeout?: number;
};
} & BrowserRunAlternateBackendOptions;
};
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
/** CSS selectors to scrape. At least one element is required. */
elements: Array<{
@@ -11169,29 +10876,10 @@ 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<{
@@ -11205,7 +10893,7 @@ interface BrowserRunJsonBaseOptions {
* Options for the `json` quick action.
* At least one of `prompt` or `response_format` must be provided.
*/
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
type BrowserRunJsonOptions = BrowserRunCommonOptions & 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/ */
@@ -11216,80 +10904,14 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBacken
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
response_format: AiTextGenerationResponseFormat;
});
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 BrowserRunContentOptions = BrowserRunCommonOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
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;
@@ -11302,7 +10924,6 @@ type BrowserRunLinksSuccessResponse = {
success: true;
/** Extracted links */
result: string[];
meta: BrowserRunResponseMeta;
};
/** Success response for `scrape` action. */
type BrowserRunScrapeSuccessResponse = {
@@ -11333,33 +10954,15 @@ type BrowserRunScrapeSuccessResponse = {
}>;
}>;
}>;
meta: BrowserRunResponseMeta;
};
/** Success response for `snapshot` action. Each field is present only when the
* corresponding entry was requested in `formats`.
*/
/** Success response for `snapshot` action. */
type BrowserRunSnapshotSuccessResponse = {
success: true;
result: {
/** HTML content of the page. */
content?: string;
content: string;
/** Base64-encoded screenshot image. */
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;
screenshot: string;
};
meta: BrowserRunResponseMeta;
};
@@ -11368,14 +10971,12 @@ 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 = {
@@ -11485,10 +11086,9 @@ declare abstract class BrowserRun {
*/
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
/**
* Get several representations of a web page in one request.
* Get both the HTML content and a base64-encoded screenshot of a web page.
* @param action - Must be `'snapshot'`.
* @param options - Snapshot options including the `formats` to return and
* screenshot settings (encoding is always base64).
* @param options - Snapshot options including screenshot settings (encoding is always base64).
* @returns A `Response` containing one of:
*
* **Success (HTTP 200):**
@@ -11536,26 +11136,6 @@ 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
@@ -12626,13 +12206,6 @@ 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 = {
@@ -12653,46 +12226,23 @@ 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: EmailMessageBuilder): 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>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
@@ -12846,15 +12396,6 @@ 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.
*/
@@ -12876,78 +12417,6 @@ 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
@@ -12959,27 +12428,6 @@ 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;
@@ -13069,9 +12517,6 @@ 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 {
@@ -13079,40 +12524,11 @@ 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[];
@@ -13130,13 +12546,6 @@ 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
@@ -13172,14 +12581,6 @@ 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 {
/**
@@ -13194,13 +12595,6 @@ 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
*/
@@ -13230,15 +12624,11 @@ 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(options?: ImageTransformationResponseOptions): Response;
response(): Response;
/**
* The content type of the returned image
*/
@@ -13674,11 +13064,6 @@ 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';
@@ -13686,32 +13071,12 @@ declare namespace CloudflareWorkersModule {
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
delay: WorkflowDelayDuration | number;
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. */
@@ -13732,51 +13097,28 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
export type WorkflowStepContext = {
step: {
name: string;
count: number;
};
attempt: number;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
config: WorkflowStepConfig;
};
// 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>;
export type WorkflowRollbackContext<T = unknown> = {
ctx: WorkflowStepContext;
error: Error;
output: T | undefined;
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
stepName: string;
};
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>;
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown> = {
rollback: WorkflowRollbackHandler<T>;
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>;
@@ -14552,12 +13894,11 @@ type MarkdownDocument = {
name: string;
blob: Blob;
};
type OutputFormat = 'markdown' | 'text';
type ConversionResponse = {
id: string;
name: string;
mimeType: string;
format: OutputFormat;
format: 'markdown';
tokens: number;
data: string;
} | {
@@ -14574,11 +13915,7 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOutputOptions = {
format?: OutputFormat;
};
type ConversionOptions = {
output?: ConversionOutputOptions;
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
@@ -14673,7 +14010,7 @@ declare namespace TailStream {
interface ConnectEventInfo {
readonly type: "connect";
}
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime" | "aborted";
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime";
interface ScriptVersion {
readonly id: string;
readonly tag?: string;
@@ -14692,7 +14029,6 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
@@ -14727,22 +14063,11 @@ declare namespace TailStream {
readonly message: string;
readonly stack?: string;
}
interface TailStreamErrorInfo {
readonly name: string;
readonly message: string;
readonly stack?: string;
}
type Log = {
interface 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;
@@ -15220,31 +14545,10 @@ 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.
@@ -15262,9 +14566,6 @@ 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)
@@ -15282,13 +14583,6 @@ 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.
@@ -15322,19 +14616,14 @@ 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(options?: WorkflowInstanceTerminateOptions): Promise<void>;
public terminate(): 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,6 +35,16 @@
"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": {
+34
View File
@@ -489,6 +489,40 @@ export async function isPlatformIdentityLinked(
return row !== null
}
/**
* Remove EVERY link an account holds on one platform, and return the links that were
* removed (empty when it held none). The website's Discord unlink is the one caller:
* a player taking their Discord off their account, which gives the identity back —
* "Sign in with Discord" with it afterwards makes a NEW account, and the benefits claim's
* once-only guard lets it claim elsewhere again.
*
* The removed rows are returned rather than a count because the caller needs to know what
* they carried: a link whose `role` was recorded is a CLAIM, and the account must remember
* having made one after the row is gone (see `account.hasClaimedDiscord`), or the
* first-link gift would pay again on every link/unlink cycle. Read-then-delete, not
* `DELETE … RETURNING`, so it runs on every D1 the tests do.
*
* Not for Steam or Meta: those links are what a cached login redeems, and nothing on the
* website removes one. The helper doesn't refuse them — the table has no idea what a
* platform is for — so a caller must only ever name a platform nobody logs in with.
*/
export async function unlinkPlatform(
db: D1Database,
accountId: number,
platform: number
): Promise<PlatformLink[]> {
const { results } = await db
.prepare(`${SELECT_LINK} WHERE account_id = ?1 AND platform = ?2 ORDER BY linked_at`)
.bind(accountId, platform)
.all<LinkRow>()
if (results.length === 0) return []
await db
.prepare(`DELETE FROM platform_account WHERE account_id = ?1 AND platform = ?2`)
.bind(accountId, platform)
.run()
return results.map(toLink)
}
/**
* How many accounts one platform identity already opens — the count both signup caps
* and link caps are enforced against, so an identity can't accumulate accounts by
+3 -3
View File
@@ -198,12 +198,12 @@ function parseChatPrivacy(value: string | undefined): ChatPrivacyValue | undefin
: undefined
}
/** The player's settings map from the `player_settings` table the `playersettings` worker owns. */
/** The player's settings map from the KV the `playersettings` worker owns. */
async function getPlayerSettings(
env: Env,
accountId: number
): Promise<Record<string, string> | null> {
return readPlayerSettings(env.DB, accountId).catch(() => null)
return readPlayerSettings(env.RECFLARE_PLAYER_SETTINGS, accountId).catch(() => null)
}
/**
@@ -258,7 +258,7 @@ async function mergePlayerSettings(
accountId: number,
patch: Record<string, string>
): Promise<void> {
await mergeStoredPlayerSettings(env.DB, accountId, patch)
await mergeStoredPlayerSettings(env.RECFLARE_PLAYER_SETTINGS, accountId, patch)
}
/**
+6 -6
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. The
* caller's chat privacy settings (`/thread/chatPrivacySetting`) and `LatestPartyChat`
* live in `player_settings` (owned by the `playersettings` worker), alongside their
* other toggles.
*/
/** 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.
*/
RECFLARE_PLAYER_SETTINGS: KVNamespace
/** The `notify` worker's NotificationsHub DO — pushes ChatMessageReceived to members. */
RECFLARE_NOTIFICATIONS_HUB: DurableObjectNamespace<NotificationsHub>
}
+61 -47
View File
@@ -3,8 +3,6 @@ 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,
@@ -17,11 +15,11 @@ import {
addThreadMember,
ChatThreadType,
createThread,
joinedChatContents,
findThreadWithMembers,
getThreadForPlayer,
getThreadsForPlayer,
isThreadMember,
joinedChatContents,
leftChatContents,
markThreadRead,
postMessage,
@@ -68,31 +66,11 @@ 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', () => {
@@ -435,7 +413,12 @@ 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 readPlayerSettings(env.DB, playerId)) ?? {}
return (
(await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
`player:${playerId}`,
'json'
)) ?? {}
)
}
it('answers the party named by LatestPartyChat, bare — no ChatResult wrapper', async () => {
@@ -467,7 +450,10 @@ describe('GET /thread/party', () => {
it('POST records the thread id in the caller’s LatestPartyChat setting', async () => {
const caller = 883202
await seedSettings(caller, JSON.stringify({ OobeState: 'Complete' }))
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${caller}`,
JSON.stringify({ OobeState: 'Complete' })
)
const created = await SELF.fetch(`${ORIGIN}/thread/party`, {
method: 'POST',
headers: await bearer(caller),
@@ -541,7 +527,10 @@ describe('GET /thread/party', () => {
headers: await bearer(host),
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await seedSettings(guest, JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) }))
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${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) })
@@ -596,7 +585,7 @@ describe('GET /thread/party', () => {
headers: await bearer(caller),
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await deletePlayerSettings(env.DB, caller)
await env.RECFLARE_PLAYER_SETTINGS.delete(`player:${caller}`)
const res = await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(caller) })
expect(((await res.json()) as { ChatThreadId: number }).ChatThreadId).toBe(
@@ -637,8 +626,8 @@ describe('GET /thread/party', () => {
})
const own = (await mine.json()) as { ChatThread: { ChatThreadId: number } }
const theirs = (await other.json()) as { ChatThread: { ChatThreadId: number } }
await seedSettings(
caller,
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${caller}`,
JSON.stringify({ LatestPartyChat: String(theirs.ChatThread.ChatThreadId) })
)
@@ -665,8 +654,8 @@ describe('GET /thread/party', () => {
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await openedMinutesAgo(ChatThread.ChatThreadId, 61)
await seedSettings(
latecomer,
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${latecomer}`,
JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) })
)
@@ -685,7 +674,10 @@ describe('GET /thread/party', () => {
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await openedMinutesAgo(ChatThread.ChatThreadId, 59)
await seedSettings(guest, JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) }))
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${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])
@@ -719,8 +711,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 seedSettings(
stranger,
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${stranger}`,
JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) })
)
@@ -734,7 +726,10 @@ describe('GET /thread/party', () => {
// put the caller in it.
const caller = 883207
const dm = await createThread(env.DB, [883208, 883213])
await seedSettings(caller, JSON.stringify({ LatestPartyChat: String(dm) }))
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${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)
@@ -742,7 +737,10 @@ describe('GET /thread/party', () => {
it('answers {} when the setting names a thread that doesn’t exist', async () => {
const caller = 883214
await seedSettings(caller, JSON.stringify({ LatestPartyChat: '99999' }))
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${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)
@@ -750,7 +748,10 @@ describe('GET /thread/party', () => {
it('answers {} for an unparseable stored id', async () => {
const caller = 883209
await seedSettings(caller, JSON.stringify({ LatestPartyChat: 'not-an-id' }))
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${caller}`,
JSON.stringify({ LatestPartyChat: 'not-an-id' })
)
const res = await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(caller) })
expect(await res.json()).toEqual({})
})
@@ -865,8 +866,8 @@ describe('GET /thread/chatPrivacySetting', () => {
})
it('reads the stored settings out of the player settings map', async () => {
await seedSettings(
886003,
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:886003',
JSON.stringify({
directMessagePrivacySetting: 'Favorites',
groupChatPrivacySetting: 'NoOne',
@@ -883,7 +884,10 @@ describe('GET /thread/chatPrivacySetting', () => {
})
it('falls back to Friends for a stored value it can’t parse', async () => {
await seedSettings(886004, JSON.stringify({ directMessagePrivacySetting: 'Nobody at all' }))
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:886004',
JSON.stringify({ directMessagePrivacySetting: 'Nobody at all' })
)
const res = await SELF.fetch(`${ORIGIN}/thread/chatPrivacySetting`, {
headers: await bearer(886004),
})
@@ -917,7 +921,8 @@ describe('PUT /thread/chatPrivacySetting', () => {
})
}
const settings = async (playerId: number) => readPlayerSettings(env.DB, playerId)
const settings = async (playerId: number) =>
env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(`player:${playerId}`, 'json')
it('stores the DM setting and answers the resulting settings', async () => {
const res = await put(887001, { directMessagePrivacySetting: 'Favorites' })
@@ -952,7 +957,10 @@ describe('PUT /thread/chatPrivacySetting', () => {
})
it('merges, leaving the player’s other settings untouched', async () => {
await seedSettings(887004, JSON.stringify({ 'Recroom.OOBE': '77' }))
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:887004',
JSON.stringify({ 'Recroom.OOBE': '77' })
)
await put(887004, { directMessagePrivacySetting: 'Favorites' })
expect(await settings(887004)).toEqual({
'Recroom.OOBE': '77',
@@ -963,12 +971,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 when the value is already stored', async () => {
it('does not write KV when the value is already stored', async () => {
const padded = '{ "Recroom.OOBE": "77", "directMessagePrivacySetting": "Favorites" }'
await seedSettings(887010, padded)
await env.RECFLARE_PLAYER_SETTINGS.put('player:887010', padded)
const res = await put(887010, { directMessagePrivacySetting: 'Favorites' })
expect(await res.json()).toMatchObject({ directMessagePrivacySetting: 1 })
expect(await rawSettings(887010)).toBe(padded)
expect(await env.RECFLARE_PLAYER_SETTINGS.get('player:887010', 'text')).toBe(padded)
})
it('accepts the enum by ordinal too, and is case-insensitive about the name', async () => {
@@ -1569,7 +1577,10 @@ describe('ChatMessageReceived push', () => {
headers: await bearer(host),
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await seedSettings(guest, JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) }))
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${guest}`,
JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) })
)
await hub.getByName('global').takeSent()
await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(guest) })
@@ -1593,7 +1604,10 @@ describe('ChatMessageReceived push', () => {
headers: await bearer(host),
})
const { ChatThread } = (await created.json()) as { ChatThread: { ChatThreadId: number } }
await seedSettings(guest, JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) }))
await env.RECFLARE_PLAYER_SETTINGS.put(
`player:${guest}`,
JSON.stringify({ LatestPartyChat: String(ChatThread.ChatThreadId) })
)
await SELF.fetch(`${ORIGIN}/thread/party`, { headers: await bearer(guest) })
await hub.getByName('global').takeSent()
+242 -953
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20260831.1 2026-06-16 nodejs_compat
// Runtime types generated with workerd@1.20260625.1 2025-09-20 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. This is how error conditions are described in web APIs.
* The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
*/
declare class DOMException extends Error {
constructor(message?: string, name?: string);
/**
* The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
* The **`message`** read-only property of the a message or description associated with the given error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
*/
readonly message: string;
/**
* The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
* The **`name`** read-only property of the one of the strings associated with an error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
*/
readonly name: string;
/**
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
* 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().
* The **`console.countReset()`** static method resets counter used with console/count_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
*/
countReset(label?: string): void;
/**
* 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.
* The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
*/
debug(...data: any[]): void;
/**
* 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.
* The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
*/
dir(item?: any, options?: any): void;
/**
* 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.
* The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
*/
dirxml(...data: any[]): void;
/**
* 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.
* The **`console.error()`** static method outputs a message to the console at the 'error' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
*/
error(...data: any[]): void;
/**
* 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.
* The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
*/
group(...data: any[]): void;
/**
* 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.
* The **`console.groupCollapsed()`** static method creates a new inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
*/
groupCollapsed(...data: any[]): void;
/**
* 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.
* The **`console.groupEnd()`** static method exits the current inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
*/
groupEnd(): void;
/**
* 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.
* The **`console.info()`** static method outputs a message to the console at the 'info' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
*/
@@ -168,24 +168,23 @@ 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. 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.
* The **`console.time()`** static method starts a timer you can use to track how long an operation takes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
*/
time(label?: string): void;
/**
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time().
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
*/
timeEnd(label?: string): void;
/**
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time().
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
*/
timeLog(label?: string, ...data: any[]): void;
/* 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.
@@ -194,7 +193,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 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.
* The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
*/
@@ -360,7 +359,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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().
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -405,7 +404,6 @@ 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,
@@ -422,12 +420,10 @@ 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>;
@@ -516,7 +512,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" | "us";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -530,7 +526,6 @@ 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;
@@ -545,7 +540,7 @@ interface DurableObjectState<Props = unknown> {
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string, options?: DurableObjectAbortOptions): void;
abort(reason?: string): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
@@ -581,9 +576,6 @@ interface DurableObjectStorage {
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectAbortOptions {
retryAlarm?: boolean;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
@@ -634,26 +626,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. 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.
* The **`type`** read-only property of the Event interface returns a string containing the event's type.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
*/
get type(): string;
/**
* The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.
* The **`eventPhase`** read-only property of the being evaluated.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
*/
get eventPhase(): number;
/**
* 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.
* The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
*/
@@ -690,13 +682,13 @@ declare class Event {
*/
get currentTarget(): EventTarget | undefined;
/**
* 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.
* The read-only **`target`** property of the dispatched.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
get target(): EventTarget | undefined;
/**
* The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.
* The deprecated **`Event.srcElement`** is an alias for the Event.target property.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
@@ -709,45 +701,45 @@ declare class Event {
*/
get timeStamp(): number;
/**
* 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.
* The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
*/
get isTrusted(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated. 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.
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
get cancelBubble(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated. 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.
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
set cancelBubble(value: boolean);
/**
* The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.
* The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
*/
stopImmediatePropagation(): void;
/**
* 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.
* The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
*/
preventDefault(): void;
/**
* 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().
* The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
*/
stopPropagation(): void;
/**
* 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.
* The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
*/
@@ -768,7 +760,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. In other words, any target of events implements the three methods associated with this interface.
* The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
*/
@@ -781,13 +773,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 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.
* The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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().
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -819,7 +811,7 @@ declare class AbortController {
*/
get signal(): AbortSignal;
/**
* 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.
* The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
*/
@@ -832,7 +824,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 abort event).
* The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
*/
@@ -844,13 +836,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 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.
* The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
*/
static any(signals: AbortSignal[]): AbortSignal;
/**
* 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)
*/
@@ -866,17 +858,12 @@ 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 reason if the signal has been aborted; otherwise it does nothing.
* The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
*/
throwIfAborted(): void;
}
/**
* 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>;
}
@@ -884,20 +871,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. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
* The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
*/
declare abstract class ExtendableEvent extends Event {
/**
* 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.
* The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
*/
waitUntil(promise: Promise<any>): void;
}
/**
* The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
* The **`CustomEvent`** interface represents events initialized by an application for any purpose.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
*/
@@ -936,7 +923,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)
*/
@@ -954,13 +941,13 @@ declare class Blob {
*/
bytes(): Promise<Uint8Array>;
/**
* 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.
* The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)
*/
text(): Promise<string>;
/**
* 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)
*/
@@ -977,13 +964,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. For security reasons, the path is excluded from this property.
* The **`name`** read-only property of the File interface returns the name of the file represented by a File object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
*/
get name(): string;
/**
* 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.
* The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
*/
@@ -1000,7 +987,7 @@ interface FileOptions {
*/
declare abstract class CacheStorage {
/**
* The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.
* The **`open()`** method of the the Cache object matching the `cacheName`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
*/
@@ -1033,14 +1020,14 @@ interface CacheQueryOptions {
*/
declare abstract class Crypto {
/**
* The **`Crypto.subtle`** read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations.
* The **`Crypto.subtle`** read-only property returns a cryptographic operations.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
*/
get subtle(): SubtleCrypto;
/**
* 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).
* The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)
*/
@@ -1068,7 +1055,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. 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").
* The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)
*/
@@ -1086,7 +1073,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. 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.
* The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)
*/
@@ -1104,7 +1091,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 SubtleCrypto interface can be used to derive an array of bits from a base key.
* The **`deriveBits()`** method of the key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)
*/
@@ -1122,13 +1109,13 @@ declare abstract class SubtleCrypto {
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* 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.
* The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)
*/
wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
/**
* 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.
* The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)
*/
@@ -1136,20 +1123,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 generateKey(), deriveKey(), importKey(), or unwrapKey().
* The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
*/
declare abstract class CryptoKey {
/**
* 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:
* The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)
*/
readonly type: string;
/**
* 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)
*/
@@ -1266,15 +1253,12 @@ interface CryptoKeyArbitraryKeyAlgorithm {
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
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, or GBK. A decoder takes an array of bytes as input and returns a JavaScript string.
* The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
*/
@@ -1291,20 +1275,20 @@ declare class TextDecoder {
get ignoreBOM(): boolean;
}
/**
* The **`TextEncoder`** interface enables you to encode a JavaScript string using UTF-8.
* The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
*/
declare class TextEncoder {
constructor();
/**
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Uint8Array containing the string encoded using UTF-8.
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
*/
encode(input?: string): Uint8Array;
/**
* 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.
* The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
*/
@@ -1361,9 +1345,6 @@ declare class ErrorEvent extends Event {
get error(): any;
}
interface ErrorEventErrorEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
message?: string;
filename?: string;
lineno?: number;
@@ -1376,139 +1357,135 @@ 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 MessageEvent interface represents the data sent by the message emitter.
* The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
*/
readonly data: any;
/**
* The **`origin`** read-only property of the MessageEvent interface is a string representing the origin of the message emitter.
* The **`origin`** read-only property of the origin of the message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
*/
readonly origin: string | null;
/**
* The **`lastEventId`** read-only property of the MessageEvent interface is a string representing a unique ID for the event.
* The **`lastEventId`** read-only property of the unique ID for the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
*/
readonly lastEventId: string;
/**
* The **`source`** read-only property of the MessageEvent interface is a MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter.
* The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
*/
readonly source: MessagePort | null;
/**
* The **`ports`** read-only property of the MessageEvent interface is an array of MessagePort objects containing all MessagePort objects sent with the message, in order.
* The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
*/
readonly ports: MessagePort[];
}
interface MessageEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
data?: any;
origin?: string;
lastEventId?: string;
source?: MessagePort;
ports?: MessagePort[];
data: ArrayBuffer | string;
}
/**
* 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.
* The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)
*/
declare abstract class PromiseRejectionEvent extends Event {
/**
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript Promise which was rejected. You can examine the event's PromiseRejectionEvent.reason property to learn why the promise was rejected.
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)
*/
readonly promise: Promise<any>;
/**
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). This in theory provides information about why the promise was rejected.
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)
*/
readonly reason: any;
}
/**
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the 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".
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
*/
declare class FormData {
constructor();
/**
* The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
* 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. If you expect multiple values and want all of them, use the getAll() method instead.
* The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)
*/
get(name: string): (File | string) | null;
/**
* The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a FormData object.
* 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<[
@@ -1587,19 +1564,19 @@ interface DocumentEnd {
append(content: string, options?: ContentOptions): DocumentEnd;
}
/**
* This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.
* This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
*/
declare abstract class FetchEvent extends ExtendableEvent {
/**
* The **`request`** read-only property of the FetchEvent interface returns the Request that triggered the event handler.
* The **`request`** read-only property of the the event handler.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)
*/
readonly request: Request;
/**
* The **`respondWith()`** method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself.
* The **`respondWith()`** method of allows you to provide a promise for a Response yourself.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)
*/
@@ -1608,62 +1585,65 @@ 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. These actions include retrieving, setting, adding to, and removing headers from the list of the request's headers.
* The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
*/
declare class Headers {
constructor(init?: HeadersInit);
/**
* 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.
* The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)
*/
get(name: string): string | null;
getAll(name: string): string[];
/**
* 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.
* The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
*/
getSetCookie(): string[];
/**
* 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 | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;
type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;
declare abstract class Body {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
get body(): ReadableStream | null;
@@ -1719,7 +1699,7 @@ interface Response extends Body {
*/
statusText: string;
/**
* The **`headers`** read-only property of the Response interface contains the Headers object associated with the response.
* The **`headers`** read-only property of the with the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)
*/
@@ -1737,7 +1717,7 @@ interface Response extends Body {
*/
redirected: boolean;
/**
* 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.
* The **`url`** read-only property of the Response interface contains the URL of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)
*/
@@ -1745,7 +1725,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 determines whether scripts are able to access the response body and headers.
* The **`type`** read-only property of the Response interface contains the type of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)
*/
@@ -1776,13 +1756,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 Request interface contains the request's method (GET, POST, etc.)
* The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
*/
@@ -1794,7 +1774,7 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> e
*/
url: string;
/**
* The **`headers`** read-only property of the Request interface contains the Headers object associated with the request.
* The **`headers`** read-only property of the with the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
*/
@@ -1820,13 +1800,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. It controls how the request will interact with the browser's HTTP cache.
* The **`cache`** read-only property of the Request interface contains the cache mode of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
*/
@@ -2215,7 +2195,7 @@ type ReadableStreamReadResult<R = any> = {
value?: undefined;
};
/**
* 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.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2233,13 +2213,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. While the stream is locked, no other reader can be acquired until this one is released.
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
getReader(): ReadableStreamDefaultReader<R>;
/**
* 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.
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
@@ -2251,13 +2231,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 ReadableStream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances.
* The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)
*/
@@ -2269,7 +2249,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 Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2301,7 +2281,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. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files.
* The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)
*/
@@ -2310,13 +2290,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. 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.
* The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
*/
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* 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.
* The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)
*/
@@ -2335,7 +2315,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)
*/
@@ -2361,13 +2341,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. Default controllers are for streams that are not byte streams.
* The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)
*/
declare abstract class ReadableStreamDefaultController<R = any> {
/**
* The **`desiredSize`** read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue.
* The **`desiredSize`** read-only property of the required to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)
*/
@@ -2379,32 +2359,32 @@ declare abstract class ReadableStreamDefaultController<R = any> {
*/
close(): void;
/**
* The **`enqueue()`** method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream.
* The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)
*/
enqueue(chunk?: R): void;
/**
* The **`error()`** method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error.
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)
*/
error(reason: any): void;
}
/**
* 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.
* The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
*/
declare abstract class ReadableByteStreamController {
/**
* The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests.
* 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)
*/
@@ -2416,7 +2396,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 transferred 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 copied into the stream's internal queues).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)
*/
@@ -2429,7 +2409,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. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
* The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
*/
@@ -2441,7 +2421,7 @@ declare abstract class WritableStreamDefaultController {
*/
get signal(): AbortSignal;
/**
* The **`error()`** method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error.
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)
*/
@@ -2466,7 +2446,7 @@ declare abstract class TransformStreamDefaultController<O = any> {
*/
enqueue(chunk?: O): void;
/**
* 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.
* The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)
*/
@@ -2488,14 +2468,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. This object comes with built-in backpressure and queuing.
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
*/
declare class WritableStream<W = any> {
constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);
/**
* 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)
*/
@@ -2507,83 +2487,83 @@ declare class WritableStream<W = any> {
*/
abort(reason?: any): Promise<void>;
/**
* 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.
* The **`close()`** method of the WritableStream interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)
*/
close(): Promise<void>;
/**
* 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.
* The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)
*/
getWriter(): WritableStreamDefaultWriter<W>;
}
/**
* 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 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.
* The **`closed`** read-only property of the the stream errors or the writer's lock is released.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)
*/
get closed(): Promise<void>;
/**
* 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.
* The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)
*/
get ready(): Promise<void>;
/**
* The **`desiredSize`** read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue.
* The **`desiredSize`** read-only property of the to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)
*/
get desiredSize(): number | null;
/**
* 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.
* The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)
*/
abort(reason?: any): Promise<void>;
/**
* The **`close()`** method of the WritableStreamDefaultWriter interface closes the associated writable stream.
* The **`close()`** method of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)
*/
close(): Promise<void>;
/**
* 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.
* The **`write()`** method of the operation.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)
*/
write(chunk?: W): Promise<void>;
/**
* 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.
* The **`releaseLock()`** method of the corresponding stream.
*
* [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. This stream emits the transformed output data.
* The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)
*/
get readable(): ReadableStream<O>;
/**
* 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.
* The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)
*/
@@ -2602,7 +2582,7 @@ interface ReadableStreamValuesOptions {
preventCancel?: boolean;
}
/**
* 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.
* The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)
*/
@@ -2610,7 +2590,7 @@ declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* 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.
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)
*/
@@ -2618,7 +2598,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. 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.
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)
*/
@@ -2627,7 +2607,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. 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.
* The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)
*/
@@ -2776,12 +2756,6 @@ 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;
@@ -2802,7 +2776,7 @@ interface UnsafeTraceMetrics {
fromTrace(item: TraceItem): TraceMetrics;
}
/**
* 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.
* The **`URL`** interface is used to parse, construct, normalize, and encode URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
*/
@@ -2827,121 +2801,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. If the URL does not have a username, this property contains an empty string, "".
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
get username(): string;
/**
* 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, "".
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
set username(value: string);
/**
* 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, "".
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
get password(): string;
/**
* 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, "".
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
set password(value: string);
/**
* 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, "".
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
get host(): string;
/**
* 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, "".
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
set host(value: string);
/**
* 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.
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
get hostname(): string;
/**
* 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.
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
set hostname(value: string);
/**
* 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, "".
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
get port(): string;
/**
* 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, "".
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
set port(value: string);
/**
* 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.
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
get pathname(): string;
/**
* 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.
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
set pathname(value: string);
/**
* 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, "".
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
get search(): string;
/**
* 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, "".
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
set search(value: string);
/**
* 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, "".
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
get hash(): string;
/**
* 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, "".
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
set hash(value: string);
/**
* 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.
* The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
*/
get searchParams(): URLSearchParams;
/**
* 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().
* The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
*/
@@ -2961,13 +2935,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 blob URL pointing to the object given in the parameter.
* The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
*/
static createObjectURL(object: File | Blob): string;
/**
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL().
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
*/
@@ -3017,22 +2991,25 @@ 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. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it.
* The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
*/
set(name: string, value: string): void;
/**
* 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).
* The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
*/
sort(): void;
/* Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[
key: string,
value: string
]>;
/* 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] }*/
@@ -3042,78 +3019,18 @@ 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 {
@@ -3146,7 +3063,7 @@ interface URLPatternOptions {
ignoreCase?: boolean;
}
/**
* A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
* A `CloseEvent` is sent to clients using WebSockets when the connection is closed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
*/
@@ -3165,16 +3082,13 @@ 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;
@@ -3186,7 +3100,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)
*/
@@ -3203,20 +3117,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. 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.
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
/**
* The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.
* The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
*/
@@ -3236,13 +3150,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. This is currently only the empty string or a list of extensions as negotiated by the connection.
* The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
*/
@@ -3329,25 +3243,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 EventSource.readyState attribute to 2 (closed).
* The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
*/
close(): void;
/**
* The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.
* The **`url`** read-only property of the URL of the source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
*/
get url(): string;
/**
* The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.
* The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
*/
get withCredentials(): boolean;
/**
* The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.
* The **`readyState`** read-only property of the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
*/
@@ -3382,26 +3296,18 @@ 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;
@@ -3428,42 +3334,25 @@ interface ContainerDirectorySnapshotOptions {
dir: string;
name?: string;
}
type ContainerDirectorySnapshotRestoreParams = {
interface 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;
}
type ContainerStartupOptions = {
interface 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[];
} & ({
image: string;
containerSnapshot?: never;
} | {
image?: never;
containerSnapshot?: ContainerSnapshotRestoreParams;
});
interface ContainerStartResources {
vcpu: number;
memoryMib: number;
diskMb: number;
containerSnapshot?: ContainerSnapshot;
}
/**
* 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.
@@ -3472,19 +3361,19 @@ interface ContainerStartResources {
*/
declare abstract class MessagePort extends EventTarget {
/**
* The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
* The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
*/
postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;
/**
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port.
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
*/
close(): void;
/**
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage.
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
*/
@@ -3500,13 +3389,13 @@ declare abstract class MessagePort extends EventTarget {
declare class MessageChannel {
constructor();
/**
* 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.
* The **`port1`** read-only property of the the port attached to the context that originated the channel.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
*/
readonly port1: MessagePort;
/**
* The **`port2`** read-only property of the 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.
* The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
*/
@@ -3566,7 +3455,7 @@ interface WorkerLoaderModule {
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
wasm?: ArrayBuffer;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
@@ -3574,7 +3463,7 @@ interface WorkerLoaderWorkerCode {
allowExperimental?: boolean;
limits?: workerdResourceLimits;
mainModule: string;
modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
modules: Record<string, WorkerLoaderModule | string>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
@@ -3596,7 +3485,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 serializer; it returns a JSON representation of the Performance object.
* The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
*/
@@ -3605,13 +3494,11 @@ 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): this;
setAttributes(attributes: Record<string, boolean | number | string | undefined>): this;
setAttribute(key: string, value?: (boolean | number | string)): void;
end(): void;
}
/**
@@ -4251,13 +4138,6 @@ 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[];
@@ -10155,163 +10035,6 @@ 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;
@@ -10404,13 +10127,6 @@ 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 = {
/**
@@ -11077,15 +10793,6 @@ 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"`. */
@@ -11120,7 +10827,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?: {
@@ -11156,7 +10863,7 @@ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @default 30000 */
timeout?: number;
};
} & BrowserRunAlternateBackendOptions;
};
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
/** CSS selectors to scrape. At least one element is required. */
elements: Array<{
@@ -11169,29 +10876,10 @@ 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<{
@@ -11205,7 +10893,7 @@ interface BrowserRunJsonBaseOptions {
* Options for the `json` quick action.
* At least one of `prompt` or `response_format` must be provided.
*/
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
type BrowserRunJsonOptions = BrowserRunCommonOptions & 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/ */
@@ -11216,80 +10904,14 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBacken
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
response_format: AiTextGenerationResponseFormat;
});
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 BrowserRunContentOptions = BrowserRunCommonOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
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;
@@ -11302,7 +10924,6 @@ type BrowserRunLinksSuccessResponse = {
success: true;
/** Extracted links */
result: string[];
meta: BrowserRunResponseMeta;
};
/** Success response for `scrape` action. */
type BrowserRunScrapeSuccessResponse = {
@@ -11333,33 +10954,15 @@ type BrowserRunScrapeSuccessResponse = {
}>;
}>;
}>;
meta: BrowserRunResponseMeta;
};
/** Success response for `snapshot` action. Each field is present only when the
* corresponding entry was requested in `formats`.
*/
/** Success response for `snapshot` action. */
type BrowserRunSnapshotSuccessResponse = {
success: true;
result: {
/** HTML content of the page. */
content?: string;
content: string;
/** Base64-encoded screenshot image. */
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;
screenshot: string;
};
meta: BrowserRunResponseMeta;
};
@@ -11368,14 +10971,12 @@ 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 = {
@@ -11485,10 +11086,9 @@ declare abstract class BrowserRun {
*/
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
/**
* Get several representations of a web page in one request.
* Get both the HTML content and a base64-encoded screenshot of a web page.
* @param action - Must be `'snapshot'`.
* @param options - Snapshot options including the `formats` to return and
* screenshot settings (encoding is always base64).
* @param options - Snapshot options including screenshot settings (encoding is always base64).
* @returns A `Response` containing one of:
*
* **Success (HTTP 200):**
@@ -11536,26 +11136,6 @@ 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
@@ -12626,13 +12206,6 @@ 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 = {
@@ -12653,46 +12226,23 @@ 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: EmailMessageBuilder): 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>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
@@ -12846,15 +12396,6 @@ 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.
*/
@@ -12876,78 +12417,6 @@ 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
@@ -12959,27 +12428,6 @@ 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;
@@ -13069,9 +12517,6 @@ 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 {
@@ -13079,40 +12524,11 @@ 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[];
@@ -13130,13 +12546,6 @@ 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
@@ -13172,14 +12581,6 @@ 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 {
/**
@@ -13194,13 +12595,6 @@ 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
*/
@@ -13230,15 +12624,11 @@ 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(options?: ImageTransformationResponseOptions): Response;
response(): Response;
/**
* The content type of the returned image
*/
@@ -13674,11 +13064,6 @@ 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';
@@ -13686,32 +13071,12 @@ declare namespace CloudflareWorkersModule {
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
delay: WorkflowDelayDuration | number;
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. */
@@ -13732,51 +13097,28 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
export type WorkflowStepContext = {
step: {
name: string;
count: number;
};
attempt: number;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
config: WorkflowStepConfig;
};
// 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>;
export type WorkflowRollbackContext<T = unknown> = {
ctx: WorkflowStepContext;
error: Error;
output: T | undefined;
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
stepName: string;
};
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>;
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown> = {
rollback: WorkflowRollbackHandler<T>;
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>;
@@ -14552,12 +13894,11 @@ type MarkdownDocument = {
name: string;
blob: Blob;
};
type OutputFormat = 'markdown' | 'text';
type ConversionResponse = {
id: string;
name: string;
mimeType: string;
format: OutputFormat;
format: 'markdown';
tokens: number;
data: string;
} | {
@@ -14574,11 +13915,7 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOutputOptions = {
format?: OutputFormat;
};
type ConversionOptions = {
output?: ConversionOutputOptions;
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
@@ -14673,7 +14010,7 @@ declare namespace TailStream {
interface ConnectEventInfo {
readonly type: "connect";
}
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime" | "aborted";
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime";
interface ScriptVersion {
readonly id: string;
readonly tag?: string;
@@ -14692,7 +14029,6 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
@@ -14727,22 +14063,11 @@ declare namespace TailStream {
readonly message: string;
readonly stack?: string;
}
interface TailStreamErrorInfo {
readonly name: string;
readonly message: string;
readonly stack?: string;
}
type Log = {
interface 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;
@@ -15220,31 +14545,10 @@ 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.
@@ -15262,9 +14566,6 @@ 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)
@@ -15282,13 +14583,6 @@ 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.
@@ -15322,19 +14616,14 @@ 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(options?: WorkflowInstanceTerminateOptions): Promise<void>;
public terminate(): 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 -3
View File
@@ -7,9 +7,7 @@
// 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. 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.
// separate from the other workers' migrations on the shared database.
"d1_databases": [
{
"binding": "DB",
@@ -19,6 +17,16 @@
"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,10 +120,11 @@ substitutes the same as asking by id.
## Bindings
| 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) |
| 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` |
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
@@ -133,10 +134,9 @@ 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 `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.
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.
## Known gaps
+8 -5
View File
@@ -13,17 +13,20 @@ 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). 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.
// presence-db (table owned/migrated by the `rooms` worker).
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 `player_settings` table the `playersettings` worker owns. */
/** The player's settings map from the KV the `playersettings` worker owns. */
async function getPlayerSettings(
env: Env,
accountId: number
): Promise<Record<string, string> | null> {
return readPlayerSettings(env.DB, accountId).catch(() => null)
return readPlayerSettings(env.RECFLARE_PLAYER_SETTINGS, 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 read failure throws (a 500) rather than reading as an empty
* value writes nothing. A KV 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.DB, accountId)
const stored = await readPlayerSettings(env.RECFLARE_PLAYER_SETTINGS, accountId)
const merged: Record<string, string> = { ...stored }
merged[findAvoidJuniorsKey(merged) ?? AVOID_JUNIORS_KEY] = value ? 'True' : 'False'
await putPlayerSettingsIfChanged(env.DB, accountId, stored, merged)
await putPlayerSettingsIfChanged(env.RECFLARE_PLAYER_SETTINGS, accountId, stored, merged)
}
/**
+14 -31
View File
@@ -15,9 +15,7 @@ import {
GAME_VERSION,
getRoomInstance,
modifySubRoom,
PLAYER_SETTINGS_SCHEMA_DDL,
PRESENCE_SCHEMA_DDL,
readPlayerSettings,
recordRoomVisit,
ROOM_INSTANCE_SCHEMA_DDL,
ROOM_INVITE_SCHEMA_DDL,
@@ -140,23 +138,6 @@ 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')
@@ -174,8 +155,6 @@ 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.
@@ -569,11 +548,11 @@ describe('public endpoints', () => {
expect(players[0]).toMatchObject({ playerId: 1, isOnline: true, appVersion: GAME_VERSION })
})
// The "avoid juniors" preference lives in the playersettings map, not in presence.
// The "avoid juniors" preference lives in the playersettings KV 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>) =>
seedSettings(playerId, JSON.stringify(map))
env.RECFLARE_PLAYER_SETTINGS.put(`player:${playerId}`, JSON.stringify(map))
const read = async (playerId: number) => {
const res = await exports.default.fetch(`${ORIGIN}/player/avoidjuniors`, {
@@ -618,7 +597,8 @@ describe('public endpoints', () => {
})
describe('PUT /player/avoidjuniors', () => {
const stored = async (playerId: number) => readPlayerSettings(env.DB, playerId)
const stored = async (playerId: number) =>
env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(`player:${playerId}`, 'json')
const write = async (playerId: number, body: string) => {
const res = await exports.default.fetch(`${ORIGIN}/player/avoidjuniors`, {
@@ -651,8 +631,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 seedSettings(
3201,
await env.RECFLARE_PLAYER_SETTINGS.put(
'player:3201',
JSON.stringify({ 'Recroom.OOBE': '77', TUTORIAL_COMPLETE_MASK: '11' })
)
await write(3201, 'avoidJuniors=True')
@@ -666,21 +646,24 @@ 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 seedSettings(3202, JSON.stringify({ AVOID_JUNIORS: 'True' }))
await env.RECFLARE_PLAYER_SETTINGS.put(
'player: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 — writes are the cost, and the
// Re-posting the stored value writes nothing to KV — 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 when the value is already stored', async () => {
test('does not write KV when the value is already stored', async () => {
const padded = '{ "Recroom.OOBE": "77", "AVOID_JUNIORS": "True" }'
await seedSettings(3205, padded)
await env.RECFLARE_PLAYER_SETTINGS.put('player:3205', padded)
expect(await write(3205, 'avoidJuniors=True')).toBe(true)
expect(await rawSettings(3205)).toBe(padded)
expect(await env.RECFLARE_PLAYER_SETTINGS.get('player:3205', 'text')).toBe(padded)
expect(await write(3205, 'avoidJuniors=False')).toBe(false)
expect(await stored(3205)).toEqual({ 'Recroom.OOBE': '77', AVOID_JUNIORS: 'False' })
+241 -950
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20260831.1 2026-06-16 nodejs_compat
// Runtime types generated with workerd@1.20260625.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. This is how error conditions are described in web APIs.
* The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
*/
declare class DOMException extends Error {
constructor(message?: string, name?: string);
/**
* The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
* The **`message`** read-only property of the a message or description associated with the given error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
*/
readonly message: string;
/**
* The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
* The **`name`** read-only property of the one of the strings associated with an error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
*/
readonly name: string;
/**
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
* 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().
* The **`console.countReset()`** static method resets counter used with console/count_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
*/
countReset(label?: string): void;
/**
* 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.
* The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
*/
debug(...data: any[]): void;
/**
* 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.
* The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
*/
dir(item?: any, options?: any): void;
/**
* 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.
* The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
*/
dirxml(...data: any[]): void;
/**
* 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.
* The **`console.error()`** static method outputs a message to the console at the 'error' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
*/
error(...data: any[]): void;
/**
* 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.
* The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
*/
group(...data: any[]): void;
/**
* 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.
* The **`console.groupCollapsed()`** static method creates a new inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
*/
groupCollapsed(...data: any[]): void;
/**
* 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.
* The **`console.groupEnd()`** static method exits the current inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
*/
groupEnd(): void;
/**
* 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.
* The **`console.info()`** static method outputs a message to the console at the 'info' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
*/
@@ -168,24 +168,23 @@ 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. 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.
* The **`console.time()`** static method starts a timer you can use to track how long an operation takes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
*/
time(label?: string): void;
/**
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time().
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
*/
timeEnd(label?: string): void;
/**
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time().
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
*/
timeLog(label?: string, ...data: any[]): void;
/* 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.
@@ -194,7 +193,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 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.
* The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
*/
@@ -360,7 +359,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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().
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -405,7 +404,6 @@ 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,
@@ -427,7 +425,6 @@ 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>;
@@ -516,7 +513,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" | "us";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -545,7 +542,7 @@ interface DurableObjectState<Props = unknown> {
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string, options?: DurableObjectAbortOptions): void;
abort(reason?: string): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
@@ -581,9 +578,6 @@ interface DurableObjectStorage {
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectAbortOptions {
retryAlarm?: boolean;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
@@ -634,26 +628,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. 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.
* The **`type`** read-only property of the Event interface returns a string containing the event's type.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
*/
get type(): string;
/**
* The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.
* The **`eventPhase`** read-only property of the being evaluated.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
*/
get eventPhase(): number;
/**
* 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.
* The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
*/
@@ -690,13 +684,13 @@ declare class Event {
*/
get currentTarget(): EventTarget | undefined;
/**
* 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.
* The read-only **`target`** property of the dispatched.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
get target(): EventTarget | undefined;
/**
* The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.
* The deprecated **`Event.srcElement`** is an alias for the Event.target property.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
@@ -709,45 +703,45 @@ declare class Event {
*/
get timeStamp(): number;
/**
* 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.
* The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
*/
get isTrusted(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated. 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.
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
get cancelBubble(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated. 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.
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
set cancelBubble(value: boolean);
/**
* The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.
* The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
*/
stopImmediatePropagation(): void;
/**
* 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.
* The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
*/
preventDefault(): void;
/**
* 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().
* The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
*/
stopPropagation(): void;
/**
* 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.
* The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
*/
@@ -768,7 +762,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. In other words, any target of events implements the three methods associated with this interface.
* The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
*/
@@ -781,13 +775,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 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.
* The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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().
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -819,7 +813,7 @@ declare class AbortController {
*/
get signal(): AbortSignal;
/**
* 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.
* The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
*/
@@ -832,7 +826,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 abort event).
* The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
*/
@@ -844,13 +838,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 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.
* The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
*/
static any(signals: AbortSignal[]): AbortSignal;
/**
* 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)
*/
@@ -866,17 +860,12 @@ 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 reason if the signal has been aborted; otherwise it does nothing.
* The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
*/
throwIfAborted(): void;
}
/**
* 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>;
}
@@ -884,20 +873,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. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
* The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
*/
declare abstract class ExtendableEvent extends Event {
/**
* 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.
* The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
*/
waitUntil(promise: Promise<any>): void;
}
/**
* The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
* The **`CustomEvent`** interface represents events initialized by an application for any purpose.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
*/
@@ -936,7 +925,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)
*/
@@ -954,13 +943,13 @@ declare class Blob {
*/
bytes(): Promise<Uint8Array>;
/**
* 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.
* The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)
*/
text(): Promise<string>;
/**
* 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)
*/
@@ -977,13 +966,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. For security reasons, the path is excluded from this property.
* The **`name`** read-only property of the File interface returns the name of the file represented by a File object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
*/
get name(): string;
/**
* 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.
* The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
*/
@@ -1000,7 +989,7 @@ interface FileOptions {
*/
declare abstract class CacheStorage {
/**
* The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.
* The **`open()`** method of the the Cache object matching the `cacheName`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
*/
@@ -1033,14 +1022,14 @@ interface CacheQueryOptions {
*/
declare abstract class Crypto {
/**
* The **`Crypto.subtle`** read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations.
* The **`Crypto.subtle`** read-only property returns a cryptographic operations.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
*/
get subtle(): SubtleCrypto;
/**
* 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).
* The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)
*/
@@ -1068,7 +1057,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. 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").
* The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)
*/
@@ -1086,7 +1075,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. 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.
* The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)
*/
@@ -1104,7 +1093,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 SubtleCrypto interface can be used to derive an array of bits from a base key.
* The **`deriveBits()`** method of the key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)
*/
@@ -1122,13 +1111,13 @@ declare abstract class SubtleCrypto {
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* 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.
* The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)
*/
wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
/**
* 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.
* The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)
*/
@@ -1136,20 +1125,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 generateKey(), deriveKey(), importKey(), or unwrapKey().
* The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
*/
declare abstract class CryptoKey {
/**
* 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:
* The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)
*/
readonly type: string;
/**
* 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)
*/
@@ -1266,15 +1255,12 @@ interface CryptoKeyArbitraryKeyAlgorithm {
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
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, or GBK. A decoder takes an array of bytes as input and returns a JavaScript string.
* The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
*/
@@ -1291,20 +1277,20 @@ declare class TextDecoder {
get ignoreBOM(): boolean;
}
/**
* The **`TextEncoder`** interface enables you to encode a JavaScript string using UTF-8.
* The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
*/
declare class TextEncoder {
constructor();
/**
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Uint8Array containing the string encoded using UTF-8.
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
*/
encode(input?: string): Uint8Array;
/**
* 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.
* The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
*/
@@ -1361,9 +1347,6 @@ declare class ErrorEvent extends Event {
get error(): any;
}
interface ErrorEventErrorEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
message?: string;
filename?: string;
lineno?: number;
@@ -1376,139 +1359,135 @@ 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 MessageEvent interface represents the data sent by the message emitter.
* The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
*/
readonly data: any;
/**
* The **`origin`** read-only property of the MessageEvent interface is a string representing the origin of the message emitter.
* The **`origin`** read-only property of the origin of the message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
*/
readonly origin: string | null;
/**
* The **`lastEventId`** read-only property of the MessageEvent interface is a string representing a unique ID for the event.
* The **`lastEventId`** read-only property of the unique ID for the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
*/
readonly lastEventId: string;
/**
* The **`source`** read-only property of the MessageEvent interface is a MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter.
* The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
*/
readonly source: MessagePort | null;
/**
* The **`ports`** read-only property of the MessageEvent interface is an array of MessagePort objects containing all MessagePort objects sent with the message, in order.
* The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
*/
readonly ports: MessagePort[];
}
interface MessageEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
data?: any;
origin?: string;
lastEventId?: string;
source?: MessagePort;
ports?: MessagePort[];
data: ArrayBuffer | string;
}
/**
* 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.
* The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)
*/
declare abstract class PromiseRejectionEvent extends Event {
/**
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript Promise which was rejected. You can examine the event's PromiseRejectionEvent.reason property to learn why the promise was rejected.
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)
*/
readonly promise: Promise<any>;
/**
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). This in theory provides information about why the promise was rejected.
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)
*/
readonly reason: any;
}
/**
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the 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".
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
*/
declare class FormData {
constructor();
/**
* The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
* 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. If you expect multiple values and want all of them, use the getAll() method instead.
* The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)
*/
get(name: string): (File | string) | null;
/**
* The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a FormData object.
* 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<[
@@ -1587,19 +1566,19 @@ interface DocumentEnd {
append(content: string, options?: ContentOptions): DocumentEnd;
}
/**
* This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.
* This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
*/
declare abstract class FetchEvent extends ExtendableEvent {
/**
* The **`request`** read-only property of the FetchEvent interface returns the Request that triggered the event handler.
* The **`request`** read-only property of the the event handler.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)
*/
readonly request: Request;
/**
* The **`respondWith()`** method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself.
* The **`respondWith()`** method of allows you to provide a promise for a Response yourself.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)
*/
@@ -1608,55 +1587,58 @@ 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. These actions include retrieving, setting, adding to, and removing headers from the list of the request's headers.
* The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
*/
declare class Headers {
constructor(init?: HeadersInit);
/**
* 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.
* The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)
*/
get(name: string): string | null;
getAll(name: string): string[];
/**
* 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.
* The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
*/
getSetCookie(): string[];
/**
* 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,
@@ -1719,7 +1701,7 @@ interface Response extends Body {
*/
statusText: string;
/**
* The **`headers`** read-only property of the Response interface contains the Headers object associated with the response.
* The **`headers`** read-only property of the with the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)
*/
@@ -1737,7 +1719,7 @@ interface Response extends Body {
*/
redirected: boolean;
/**
* 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.
* The **`url`** read-only property of the Response interface contains the URL of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)
*/
@@ -1745,7 +1727,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 determines whether scripts are able to access the response body and headers.
* The **`type`** read-only property of the Response interface contains the type of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)
*/
@@ -1776,13 +1758,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 Request interface contains the request's method (GET, POST, etc.)
* The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
*/
@@ -1794,7 +1776,7 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> e
*/
url: string;
/**
* The **`headers`** read-only property of the Request interface contains the Headers object associated with the request.
* The **`headers`** read-only property of the with the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
*/
@@ -1820,13 +1802,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. It controls how the request will interact with the browser's HTTP cache.
* The **`cache`** read-only property of the Request interface contains the cache mode of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
*/
@@ -2215,7 +2197,7 @@ type ReadableStreamReadResult<R = any> = {
value?: undefined;
};
/**
* 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.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2233,13 +2215,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. While the stream is locked, no other reader can be acquired until this one is released.
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
getReader(): ReadableStreamDefaultReader<R>;
/**
* 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.
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
@@ -2251,13 +2233,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 ReadableStream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances.
* The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)
*/
@@ -2269,7 +2251,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 Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2301,7 +2283,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. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files.
* The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)
*/
@@ -2310,13 +2292,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. 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.
* The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
*/
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* 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.
* The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)
*/
@@ -2335,7 +2317,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)
*/
@@ -2361,13 +2343,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. Default controllers are for streams that are not byte streams.
* The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)
*/
declare abstract class ReadableStreamDefaultController<R = any> {
/**
* The **`desiredSize`** read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue.
* The **`desiredSize`** read-only property of the required to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)
*/
@@ -2379,32 +2361,32 @@ declare abstract class ReadableStreamDefaultController<R = any> {
*/
close(): void;
/**
* The **`enqueue()`** method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream.
* The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)
*/
enqueue(chunk?: R): void;
/**
* The **`error()`** method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error.
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)
*/
error(reason: any): void;
}
/**
* 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.
* The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
*/
declare abstract class ReadableByteStreamController {
/**
* The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests.
* 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)
*/
@@ -2416,7 +2398,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 transferred 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 copied into the stream's internal queues).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)
*/
@@ -2429,7 +2411,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. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
* The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
*/
@@ -2441,7 +2423,7 @@ declare abstract class WritableStreamDefaultController {
*/
get signal(): AbortSignal;
/**
* The **`error()`** method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error.
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)
*/
@@ -2466,7 +2448,7 @@ declare abstract class TransformStreamDefaultController<O = any> {
*/
enqueue(chunk?: O): void;
/**
* 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.
* The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)
*/
@@ -2488,14 +2470,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. This object comes with built-in backpressure and queuing.
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
*/
declare class WritableStream<W = any> {
constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);
/**
* 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)
*/
@@ -2507,83 +2489,83 @@ declare class WritableStream<W = any> {
*/
abort(reason?: any): Promise<void>;
/**
* 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.
* The **`close()`** method of the WritableStream interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)
*/
close(): Promise<void>;
/**
* 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.
* The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)
*/
getWriter(): WritableStreamDefaultWriter<W>;
}
/**
* 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 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.
* The **`closed`** read-only property of the the stream errors or the writer's lock is released.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)
*/
get closed(): Promise<void>;
/**
* 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.
* The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)
*/
get ready(): Promise<void>;
/**
* The **`desiredSize`** read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue.
* The **`desiredSize`** read-only property of the to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)
*/
get desiredSize(): number | null;
/**
* 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.
* The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)
*/
abort(reason?: any): Promise<void>;
/**
* The **`close()`** method of the WritableStreamDefaultWriter interface closes the associated writable stream.
* The **`close()`** method of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)
*/
close(): Promise<void>;
/**
* 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.
* The **`write()`** method of the operation.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)
*/
write(chunk?: W): Promise<void>;
/**
* 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.
* The **`releaseLock()`** method of the corresponding stream.
*
* [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. This stream emits the transformed output data.
* The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)
*/
get readable(): ReadableStream<O>;
/**
* 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.
* The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)
*/
@@ -2602,7 +2584,7 @@ interface ReadableStreamValuesOptions {
preventCancel?: boolean;
}
/**
* 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.
* The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)
*/
@@ -2610,7 +2592,7 @@ declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* 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.
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)
*/
@@ -2618,7 +2600,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. 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.
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)
*/
@@ -2627,7 +2609,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. 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.
* The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)
*/
@@ -2776,12 +2758,6 @@ 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;
@@ -2802,7 +2778,7 @@ interface UnsafeTraceMetrics {
fromTrace(item: TraceItem): TraceMetrics;
}
/**
* 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.
* The **`URL`** interface is used to parse, construct, normalize, and encode URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
*/
@@ -2827,121 +2803,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. If the URL does not have a username, this property contains an empty string, "".
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
get username(): string;
/**
* 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, "".
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
set username(value: string);
/**
* 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, "".
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
get password(): string;
/**
* 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, "".
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
set password(value: string);
/**
* 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, "".
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
get host(): string;
/**
* 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, "".
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
set host(value: string);
/**
* 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.
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
get hostname(): string;
/**
* 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.
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
set hostname(value: string);
/**
* 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, "".
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
get port(): string;
/**
* 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, "".
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
set port(value: string);
/**
* 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.
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
get pathname(): string;
/**
* 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.
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
set pathname(value: string);
/**
* 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, "".
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
get search(): string;
/**
* 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, "".
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
set search(value: string);
/**
* 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, "".
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
get hash(): string;
/**
* 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, "".
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
set hash(value: string);
/**
* 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.
* The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
*/
get searchParams(): URLSearchParams;
/**
* 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().
* The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
*/
@@ -2961,13 +2937,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 blob URL pointing to the object given in the parameter.
* The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
*/
static createObjectURL(object: File | Blob): string;
/**
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL().
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
*/
@@ -3017,22 +2993,25 @@ 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. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it.
* The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
*/
set(name: string, value: string): void;
/**
* 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).
* The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
*/
sort(): void;
/* Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[
key: string,
value: string
]>;
/* 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] }*/
@@ -3042,78 +3021,18 @@ 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 {
@@ -3146,7 +3065,7 @@ interface URLPatternOptions {
ignoreCase?: boolean;
}
/**
* A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
* A `CloseEvent` is sent to clients using WebSockets when the connection is closed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
*/
@@ -3165,16 +3084,13 @@ 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;
@@ -3186,7 +3102,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)
*/
@@ -3203,20 +3119,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. 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.
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
/**
* The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.
* The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
*/
@@ -3236,13 +3152,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. This is currently only the empty string or a list of extensions as negotiated by the connection.
* The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
*/
@@ -3329,25 +3245,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 EventSource.readyState attribute to 2 (closed).
* The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
*/
close(): void;
/**
* The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.
* The **`url`** read-only property of the URL of the source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
*/
get url(): string;
/**
* The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.
* The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
*/
get withCredentials(): boolean;
/**
* The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.
* The **`readyState`** read-only property of the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
*/
@@ -3382,26 +3298,18 @@ 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;
@@ -3428,42 +3336,25 @@ interface ContainerDirectorySnapshotOptions {
dir: string;
name?: string;
}
type ContainerDirectorySnapshotRestoreParams = {
interface 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;
}
type ContainerStartupOptions = {
interface 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[];
} & ({
image: string;
containerSnapshot?: never;
} | {
image?: never;
containerSnapshot?: ContainerSnapshotRestoreParams;
});
interface ContainerStartResources {
vcpu: number;
memoryMib: number;
diskMb: number;
containerSnapshot?: ContainerSnapshot;
}
/**
* 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.
@@ -3472,19 +3363,19 @@ interface ContainerStartResources {
*/
declare abstract class MessagePort extends EventTarget {
/**
* The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
* The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
*/
postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;
/**
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port.
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
*/
close(): void;
/**
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage.
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
*/
@@ -3500,13 +3391,13 @@ declare abstract class MessagePort extends EventTarget {
declare class MessageChannel {
constructor();
/**
* 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.
* The **`port1`** read-only property of the the port attached to the context that originated the channel.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
*/
readonly port1: MessagePort;
/**
* The **`port2`** read-only property of the 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.
* The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
*/
@@ -3566,7 +3457,7 @@ interface WorkerLoaderModule {
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
wasm?: ArrayBuffer;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
@@ -3574,7 +3465,7 @@ interface WorkerLoaderWorkerCode {
allowExperimental?: boolean;
limits?: workerdResourceLimits;
mainModule: string;
modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
modules: Record<string, WorkerLoaderModule | string>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
@@ -3596,7 +3487,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 serializer; it returns a JSON representation of the Performance object.
* The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
*/
@@ -3605,13 +3496,11 @@ 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): this;
setAttributes(attributes: Record<string, boolean | number | string | undefined>): this;
setAttribute(key: string, value?: (boolean | number | string)): void;
end(): void;
}
/**
@@ -4251,13 +4140,6 @@ 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[];
@@ -10155,163 +10037,6 @@ 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;
@@ -10404,13 +10129,6 @@ 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 = {
/**
@@ -11077,15 +10795,6 @@ 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"`. */
@@ -11120,7 +10829,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?: {
@@ -11156,7 +10865,7 @@ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @default 30000 */
timeout?: number;
};
} & BrowserRunAlternateBackendOptions;
};
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
/** CSS selectors to scrape. At least one element is required. */
elements: Array<{
@@ -11169,29 +10878,10 @@ 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<{
@@ -11205,7 +10895,7 @@ interface BrowserRunJsonBaseOptions {
* Options for the `json` quick action.
* At least one of `prompt` or `response_format` must be provided.
*/
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
type BrowserRunJsonOptions = BrowserRunCommonOptions & 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/ */
@@ -11216,80 +10906,14 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBacken
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
response_format: AiTextGenerationResponseFormat;
});
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 BrowserRunContentOptions = BrowserRunCommonOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
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;
@@ -11302,7 +10926,6 @@ type BrowserRunLinksSuccessResponse = {
success: true;
/** Extracted links */
result: string[];
meta: BrowserRunResponseMeta;
};
/** Success response for `scrape` action. */
type BrowserRunScrapeSuccessResponse = {
@@ -11333,33 +10956,15 @@ type BrowserRunScrapeSuccessResponse = {
}>;
}>;
}>;
meta: BrowserRunResponseMeta;
};
/** Success response for `snapshot` action. Each field is present only when the
* corresponding entry was requested in `formats`.
*/
/** Success response for `snapshot` action. */
type BrowserRunSnapshotSuccessResponse = {
success: true;
result: {
/** HTML content of the page. */
content?: string;
content: string;
/** Base64-encoded screenshot image. */
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;
screenshot: string;
};
meta: BrowserRunResponseMeta;
};
@@ -11368,14 +10973,12 @@ 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 = {
@@ -11485,10 +11088,9 @@ declare abstract class BrowserRun {
*/
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
/**
* Get several representations of a web page in one request.
* Get both the HTML content and a base64-encoded screenshot of a web page.
* @param action - Must be `'snapshot'`.
* @param options - Snapshot options including the `formats` to return and
* screenshot settings (encoding is always base64).
* @param options - Snapshot options including screenshot settings (encoding is always base64).
* @returns A `Response` containing one of:
*
* **Success (HTTP 200):**
@@ -11536,26 +11138,6 @@ 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
@@ -12626,13 +12208,6 @@ 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 = {
@@ -12653,46 +12228,23 @@ 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: EmailMessageBuilder): 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>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
@@ -12846,15 +12398,6 @@ 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.
*/
@@ -12876,78 +12419,6 @@ 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
@@ -12959,27 +12430,6 @@ 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;
@@ -13069,9 +12519,6 @@ 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 {
@@ -13079,40 +12526,11 @@ 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[];
@@ -13130,13 +12548,6 @@ 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
@@ -13172,14 +12583,6 @@ 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 {
/**
@@ -13194,13 +12597,6 @@ 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
*/
@@ -13230,15 +12626,11 @@ 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(options?: ImageTransformationResponseOptions): Response;
response(): Response;
/**
* The content type of the returned image
*/
@@ -13674,11 +13066,6 @@ 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';
@@ -13686,32 +13073,12 @@ declare namespace CloudflareWorkersModule {
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
delay: WorkflowDelayDuration | number;
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. */
@@ -13732,51 +13099,28 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
export type WorkflowStepContext = {
step: {
name: string;
count: number;
};
attempt: number;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
config: WorkflowStepConfig;
};
// 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>;
export type WorkflowRollbackContext<T = unknown> = {
ctx: WorkflowStepContext;
error: Error;
output: T | undefined;
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
stepName: string;
};
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>;
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown> = {
rollback: WorkflowRollbackHandler<T>;
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>;
@@ -14552,12 +13896,11 @@ type MarkdownDocument = {
name: string;
blob: Blob;
};
type OutputFormat = 'markdown' | 'text';
type ConversionResponse = {
id: string;
name: string;
mimeType: string;
format: OutputFormat;
format: 'markdown';
tokens: number;
data: string;
} | {
@@ -14574,11 +13917,7 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOutputOptions = {
format?: OutputFormat;
};
type ConversionOptions = {
output?: ConversionOutputOptions;
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
@@ -14673,7 +14012,7 @@ declare namespace TailStream {
interface ConnectEventInfo {
readonly type: "connect";
}
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime" | "aborted";
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime";
interface ScriptVersion {
readonly id: string;
readonly tag?: string;
@@ -14692,7 +14031,6 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
@@ -14727,22 +14065,11 @@ declare namespace TailStream {
readonly message: string;
readonly stack?: string;
}
interface TailStreamErrorInfo {
readonly name: string;
readonly message: string;
readonly stack?: string;
}
type Log = {
interface 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;
@@ -15220,31 +14547,10 @@ 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.
@@ -15262,9 +14568,6 @@ 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)
@@ -15282,13 +14585,6 @@ 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.
@@ -15322,19 +14618,14 @@ 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(options?: WorkflowInstanceTerminateOptions): Promise<void>;
public terminate(): 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
@@ -5,10 +5,8 @@
"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), 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.
// personal dorm room on first dorm entry (see getOrCreateDormRoom), and holds
// player presence (the `presence` table — owned/migrated by the `rooms` worker).
// 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.
@@ -22,6 +20,15 @@
"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
+5 -3
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 and the Notifications Durable
* Object — this is a de-duplicated union, not a migration.
* `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.
* 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,12 +20,14 @@ 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, playersettings, rooms, …).
// Shared `recflare` database (accounts, auth, api, clubs, match, 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>
+241 -950
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20260831.1 2026-06-16 nodejs_compat
// Runtime types generated with workerd@1.20260625.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. This is how error conditions are described in web APIs.
* The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
*/
declare class DOMException extends Error {
constructor(message?: string, name?: string);
/**
* The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
* The **`message`** read-only property of the a message or description associated with the given error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
*/
readonly message: string;
/**
* The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
* The **`name`** read-only property of the one of the strings associated with an error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
*/
readonly name: string;
/**
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
* 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().
* The **`console.countReset()`** static method resets counter used with console/count_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
*/
countReset(label?: string): void;
/**
* 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.
* The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
*/
debug(...data: any[]): void;
/**
* 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.
* The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
*/
dir(item?: any, options?: any): void;
/**
* 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.
* The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
*/
dirxml(...data: any[]): void;
/**
* 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.
* The **`console.error()`** static method outputs a message to the console at the 'error' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
*/
error(...data: any[]): void;
/**
* 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.
* The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
*/
group(...data: any[]): void;
/**
* 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.
* The **`console.groupCollapsed()`** static method creates a new inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
*/
groupCollapsed(...data: any[]): void;
/**
* 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.
* The **`console.groupEnd()`** static method exits the current inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
*/
groupEnd(): void;
/**
* 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.
* The **`console.info()`** static method outputs a message to the console at the 'info' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
*/
@@ -168,24 +168,23 @@ 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. 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.
* The **`console.time()`** static method starts a timer you can use to track how long an operation takes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
*/
time(label?: string): void;
/**
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time().
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
*/
timeEnd(label?: string): void;
/**
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time().
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
*/
timeLog(label?: string, ...data: any[]): void;
/* 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.
@@ -194,7 +193,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 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.
* The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
*/
@@ -360,7 +359,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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().
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -405,7 +404,6 @@ 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,
@@ -427,7 +425,6 @@ 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>;
@@ -516,7 +513,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" | "us";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -545,7 +542,7 @@ interface DurableObjectState<Props = unknown> {
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string, options?: DurableObjectAbortOptions): void;
abort(reason?: string): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
@@ -581,9 +578,6 @@ interface DurableObjectStorage {
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectAbortOptions {
retryAlarm?: boolean;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
@@ -634,26 +628,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. 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.
* The **`type`** read-only property of the Event interface returns a string containing the event's type.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
*/
get type(): string;
/**
* The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.
* The **`eventPhase`** read-only property of the being evaluated.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
*/
get eventPhase(): number;
/**
* 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.
* The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
*/
@@ -690,13 +684,13 @@ declare class Event {
*/
get currentTarget(): EventTarget | undefined;
/**
* 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.
* The read-only **`target`** property of the dispatched.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
get target(): EventTarget | undefined;
/**
* The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.
* The deprecated **`Event.srcElement`** is an alias for the Event.target property.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
@@ -709,45 +703,45 @@ declare class Event {
*/
get timeStamp(): number;
/**
* 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.
* The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
*/
get isTrusted(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated. 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.
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
get cancelBubble(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated. 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.
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
set cancelBubble(value: boolean);
/**
* The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.
* The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
*/
stopImmediatePropagation(): void;
/**
* 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.
* The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
*/
preventDefault(): void;
/**
* 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().
* The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
*/
stopPropagation(): void;
/**
* 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.
* The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
*/
@@ -768,7 +762,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. In other words, any target of events implements the three methods associated with this interface.
* The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
*/
@@ -781,13 +775,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 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.
* The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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().
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -819,7 +813,7 @@ declare class AbortController {
*/
get signal(): AbortSignal;
/**
* 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.
* The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
*/
@@ -832,7 +826,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 abort event).
* The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
*/
@@ -844,13 +838,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 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.
* The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
*/
static any(signals: AbortSignal[]): AbortSignal;
/**
* 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)
*/
@@ -866,17 +860,12 @@ 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 reason if the signal has been aborted; otherwise it does nothing.
* The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
*/
throwIfAborted(): void;
}
/**
* 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>;
}
@@ -884,20 +873,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. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
* The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
*/
declare abstract class ExtendableEvent extends Event {
/**
* 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.
* The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
*/
waitUntil(promise: Promise<any>): void;
}
/**
* The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
* The **`CustomEvent`** interface represents events initialized by an application for any purpose.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
*/
@@ -936,7 +925,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)
*/
@@ -954,13 +943,13 @@ declare class Blob {
*/
bytes(): Promise<Uint8Array>;
/**
* 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.
* The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)
*/
text(): Promise<string>;
/**
* 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)
*/
@@ -977,13 +966,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. For security reasons, the path is excluded from this property.
* The **`name`** read-only property of the File interface returns the name of the file represented by a File object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
*/
get name(): string;
/**
* 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.
* The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
*/
@@ -1000,7 +989,7 @@ interface FileOptions {
*/
declare abstract class CacheStorage {
/**
* The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.
* The **`open()`** method of the the Cache object matching the `cacheName`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
*/
@@ -1033,14 +1022,14 @@ interface CacheQueryOptions {
*/
declare abstract class Crypto {
/**
* The **`Crypto.subtle`** read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations.
* The **`Crypto.subtle`** read-only property returns a cryptographic operations.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
*/
get subtle(): SubtleCrypto;
/**
* 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).
* The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)
*/
@@ -1068,7 +1057,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. 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").
* The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)
*/
@@ -1086,7 +1075,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. 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.
* The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)
*/
@@ -1104,7 +1093,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 SubtleCrypto interface can be used to derive an array of bits from a base key.
* The **`deriveBits()`** method of the key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)
*/
@@ -1122,13 +1111,13 @@ declare abstract class SubtleCrypto {
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* 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.
* The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)
*/
wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
/**
* 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.
* The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)
*/
@@ -1136,20 +1125,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 generateKey(), deriveKey(), importKey(), or unwrapKey().
* The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
*/
declare abstract class CryptoKey {
/**
* 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:
* The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)
*/
readonly type: string;
/**
* 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)
*/
@@ -1266,15 +1255,12 @@ interface CryptoKeyArbitraryKeyAlgorithm {
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
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, or GBK. A decoder takes an array of bytes as input and returns a JavaScript string.
* The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
*/
@@ -1291,20 +1277,20 @@ declare class TextDecoder {
get ignoreBOM(): boolean;
}
/**
* The **`TextEncoder`** interface enables you to encode a JavaScript string using UTF-8.
* The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
*/
declare class TextEncoder {
constructor();
/**
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Uint8Array containing the string encoded using UTF-8.
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
*/
encode(input?: string): Uint8Array;
/**
* 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.
* The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
*/
@@ -1361,9 +1347,6 @@ declare class ErrorEvent extends Event {
get error(): any;
}
interface ErrorEventErrorEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
message?: string;
filename?: string;
lineno?: number;
@@ -1376,139 +1359,135 @@ 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 MessageEvent interface represents the data sent by the message emitter.
* The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
*/
readonly data: any;
/**
* The **`origin`** read-only property of the MessageEvent interface is a string representing the origin of the message emitter.
* The **`origin`** read-only property of the origin of the message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
*/
readonly origin: string | null;
/**
* The **`lastEventId`** read-only property of the MessageEvent interface is a string representing a unique ID for the event.
* The **`lastEventId`** read-only property of the unique ID for the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
*/
readonly lastEventId: string;
/**
* The **`source`** read-only property of the MessageEvent interface is a MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter.
* The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
*/
readonly source: MessagePort | null;
/**
* The **`ports`** read-only property of the MessageEvent interface is an array of MessagePort objects containing all MessagePort objects sent with the message, in order.
* The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
*/
readonly ports: MessagePort[];
}
interface MessageEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
data?: any;
origin?: string;
lastEventId?: string;
source?: MessagePort;
ports?: MessagePort[];
data: ArrayBuffer | string;
}
/**
* 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.
* The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)
*/
declare abstract class PromiseRejectionEvent extends Event {
/**
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript Promise which was rejected. You can examine the event's PromiseRejectionEvent.reason property to learn why the promise was rejected.
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)
*/
readonly promise: Promise<any>;
/**
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). This in theory provides information about why the promise was rejected.
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)
*/
readonly reason: any;
}
/**
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the 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".
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
*/
declare class FormData {
constructor();
/**
* The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
* 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. If you expect multiple values and want all of them, use the getAll() method instead.
* The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)
*/
get(name: string): (File | string) | null;
/**
* The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a FormData object.
* 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<[
@@ -1587,19 +1566,19 @@ interface DocumentEnd {
append(content: string, options?: ContentOptions): DocumentEnd;
}
/**
* This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.
* This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
*/
declare abstract class FetchEvent extends ExtendableEvent {
/**
* The **`request`** read-only property of the FetchEvent interface returns the Request that triggered the event handler.
* The **`request`** read-only property of the the event handler.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)
*/
readonly request: Request;
/**
* The **`respondWith()`** method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself.
* The **`respondWith()`** method of allows you to provide a promise for a Response yourself.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)
*/
@@ -1608,55 +1587,58 @@ 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. These actions include retrieving, setting, adding to, and removing headers from the list of the request's headers.
* The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
*/
declare class Headers {
constructor(init?: HeadersInit);
/**
* 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.
* The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)
*/
get(name: string): string | null;
getAll(name: string): string[];
/**
* 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.
* The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
*/
getSetCookie(): string[];
/**
* 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,
@@ -1719,7 +1701,7 @@ interface Response extends Body {
*/
statusText: string;
/**
* The **`headers`** read-only property of the Response interface contains the Headers object associated with the response.
* The **`headers`** read-only property of the with the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)
*/
@@ -1737,7 +1719,7 @@ interface Response extends Body {
*/
redirected: boolean;
/**
* 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.
* The **`url`** read-only property of the Response interface contains the URL of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)
*/
@@ -1745,7 +1727,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 determines whether scripts are able to access the response body and headers.
* The **`type`** read-only property of the Response interface contains the type of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)
*/
@@ -1776,13 +1758,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 Request interface contains the request's method (GET, POST, etc.)
* The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
*/
@@ -1794,7 +1776,7 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> e
*/
url: string;
/**
* The **`headers`** read-only property of the Request interface contains the Headers object associated with the request.
* The **`headers`** read-only property of the with the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
*/
@@ -1820,13 +1802,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. It controls how the request will interact with the browser's HTTP cache.
* The **`cache`** read-only property of the Request interface contains the cache mode of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
*/
@@ -2215,7 +2197,7 @@ type ReadableStreamReadResult<R = any> = {
value?: undefined;
};
/**
* 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.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2233,13 +2215,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. While the stream is locked, no other reader can be acquired until this one is released.
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
getReader(): ReadableStreamDefaultReader<R>;
/**
* 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.
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
@@ -2251,13 +2233,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 ReadableStream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances.
* The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)
*/
@@ -2269,7 +2251,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 Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2301,7 +2283,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. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files.
* The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)
*/
@@ -2310,13 +2292,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. 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.
* The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
*/
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* 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.
* The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)
*/
@@ -2335,7 +2317,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)
*/
@@ -2361,13 +2343,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. Default controllers are for streams that are not byte streams.
* The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)
*/
declare abstract class ReadableStreamDefaultController<R = any> {
/**
* The **`desiredSize`** read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue.
* The **`desiredSize`** read-only property of the required to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)
*/
@@ -2379,32 +2361,32 @@ declare abstract class ReadableStreamDefaultController<R = any> {
*/
close(): void;
/**
* The **`enqueue()`** method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream.
* The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)
*/
enqueue(chunk?: R): void;
/**
* The **`error()`** method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error.
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)
*/
error(reason: any): void;
}
/**
* 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.
* The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
*/
declare abstract class ReadableByteStreamController {
/**
* The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests.
* 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)
*/
@@ -2416,7 +2398,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 transferred 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 copied into the stream's internal queues).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)
*/
@@ -2429,7 +2411,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. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
* The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
*/
@@ -2441,7 +2423,7 @@ declare abstract class WritableStreamDefaultController {
*/
get signal(): AbortSignal;
/**
* The **`error()`** method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error.
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)
*/
@@ -2466,7 +2448,7 @@ declare abstract class TransformStreamDefaultController<O = any> {
*/
enqueue(chunk?: O): void;
/**
* 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.
* The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)
*/
@@ -2488,14 +2470,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. This object comes with built-in backpressure and queuing.
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
*/
declare class WritableStream<W = any> {
constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);
/**
* 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)
*/
@@ -2507,83 +2489,83 @@ declare class WritableStream<W = any> {
*/
abort(reason?: any): Promise<void>;
/**
* 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.
* The **`close()`** method of the WritableStream interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)
*/
close(): Promise<void>;
/**
* 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.
* The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)
*/
getWriter(): WritableStreamDefaultWriter<W>;
}
/**
* 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 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.
* The **`closed`** read-only property of the the stream errors or the writer's lock is released.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)
*/
get closed(): Promise<void>;
/**
* 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.
* The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)
*/
get ready(): Promise<void>;
/**
* The **`desiredSize`** read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue.
* The **`desiredSize`** read-only property of the to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)
*/
get desiredSize(): number | null;
/**
* 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.
* The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)
*/
abort(reason?: any): Promise<void>;
/**
* The **`close()`** method of the WritableStreamDefaultWriter interface closes the associated writable stream.
* The **`close()`** method of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)
*/
close(): Promise<void>;
/**
* 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.
* The **`write()`** method of the operation.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)
*/
write(chunk?: W): Promise<void>;
/**
* 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.
* The **`releaseLock()`** method of the corresponding stream.
*
* [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. This stream emits the transformed output data.
* The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)
*/
get readable(): ReadableStream<O>;
/**
* 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.
* The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)
*/
@@ -2602,7 +2584,7 @@ interface ReadableStreamValuesOptions {
preventCancel?: boolean;
}
/**
* 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.
* The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)
*/
@@ -2610,7 +2592,7 @@ declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* 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.
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)
*/
@@ -2618,7 +2600,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. 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.
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)
*/
@@ -2627,7 +2609,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. 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.
* The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)
*/
@@ -2776,12 +2758,6 @@ 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;
@@ -2802,7 +2778,7 @@ interface UnsafeTraceMetrics {
fromTrace(item: TraceItem): TraceMetrics;
}
/**
* 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.
* The **`URL`** interface is used to parse, construct, normalize, and encode URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
*/
@@ -2827,121 +2803,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. If the URL does not have a username, this property contains an empty string, "".
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
get username(): string;
/**
* 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, "".
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
set username(value: string);
/**
* 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, "".
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
get password(): string;
/**
* 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, "".
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
set password(value: string);
/**
* 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, "".
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
get host(): string;
/**
* 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, "".
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
set host(value: string);
/**
* 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.
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
get hostname(): string;
/**
* 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.
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
set hostname(value: string);
/**
* 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, "".
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
get port(): string;
/**
* 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, "".
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
set port(value: string);
/**
* 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.
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
get pathname(): string;
/**
* 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.
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
set pathname(value: string);
/**
* 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, "".
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
get search(): string;
/**
* 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, "".
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
set search(value: string);
/**
* 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, "".
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
get hash(): string;
/**
* 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, "".
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
set hash(value: string);
/**
* 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.
* The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
*/
get searchParams(): URLSearchParams;
/**
* 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().
* The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
*/
@@ -2961,13 +2937,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 blob URL pointing to the object given in the parameter.
* The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
*/
static createObjectURL(object: File | Blob): string;
/**
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL().
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
*/
@@ -3017,22 +2993,25 @@ 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. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it.
* The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
*/
set(name: string, value: string): void;
/**
* 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).
* The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
*/
sort(): void;
/* Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[
key: string,
value: string
]>;
/* 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] }*/
@@ -3042,78 +3021,18 @@ 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 {
@@ -3146,7 +3065,7 @@ interface URLPatternOptions {
ignoreCase?: boolean;
}
/**
* A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
* A `CloseEvent` is sent to clients using WebSockets when the connection is closed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
*/
@@ -3165,16 +3084,13 @@ 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;
@@ -3186,7 +3102,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)
*/
@@ -3203,20 +3119,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. 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.
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
/**
* The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.
* The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
*/
@@ -3236,13 +3152,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. This is currently only the empty string or a list of extensions as negotiated by the connection.
* The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
*/
@@ -3329,25 +3245,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 EventSource.readyState attribute to 2 (closed).
* The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
*/
close(): void;
/**
* The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.
* The **`url`** read-only property of the URL of the source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
*/
get url(): string;
/**
* The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.
* The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
*/
get withCredentials(): boolean;
/**
* The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.
* The **`readyState`** read-only property of the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
*/
@@ -3382,26 +3298,18 @@ 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;
@@ -3428,42 +3336,25 @@ interface ContainerDirectorySnapshotOptions {
dir: string;
name?: string;
}
type ContainerDirectorySnapshotRestoreParams = {
interface 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;
}
type ContainerStartupOptions = {
interface 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[];
} & ({
image: string;
containerSnapshot?: never;
} | {
image?: never;
containerSnapshot?: ContainerSnapshotRestoreParams;
});
interface ContainerStartResources {
vcpu: number;
memoryMib: number;
diskMb: number;
containerSnapshot?: ContainerSnapshot;
}
/**
* 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.
@@ -3472,19 +3363,19 @@ interface ContainerStartResources {
*/
declare abstract class MessagePort extends EventTarget {
/**
* The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
* The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
*/
postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;
/**
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port.
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
*/
close(): void;
/**
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage.
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
*/
@@ -3500,13 +3391,13 @@ declare abstract class MessagePort extends EventTarget {
declare class MessageChannel {
constructor();
/**
* 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.
* The **`port1`** read-only property of the the port attached to the context that originated the channel.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
*/
readonly port1: MessagePort;
/**
* The **`port2`** read-only property of the 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.
* The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
*/
@@ -3566,7 +3457,7 @@ interface WorkerLoaderModule {
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
wasm?: ArrayBuffer;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
@@ -3574,7 +3465,7 @@ interface WorkerLoaderWorkerCode {
allowExperimental?: boolean;
limits?: workerdResourceLimits;
mainModule: string;
modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
modules: Record<string, WorkerLoaderModule | string>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
@@ -3596,7 +3487,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 serializer; it returns a JSON representation of the Performance object.
* The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
*/
@@ -3605,13 +3496,11 @@ 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): this;
setAttributes(attributes: Record<string, boolean | number | string | undefined>): this;
setAttribute(key: string, value?: (boolean | number | string)): void;
end(): void;
}
/**
@@ -4251,13 +4140,6 @@ 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[];
@@ -10155,163 +10037,6 @@ 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;
@@ -10404,13 +10129,6 @@ 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 = {
/**
@@ -11077,15 +10795,6 @@ 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"`. */
@@ -11120,7 +10829,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?: {
@@ -11156,7 +10865,7 @@ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @default 30000 */
timeout?: number;
};
} & BrowserRunAlternateBackendOptions;
};
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
/** CSS selectors to scrape. At least one element is required. */
elements: Array<{
@@ -11169,29 +10878,10 @@ 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<{
@@ -11205,7 +10895,7 @@ interface BrowserRunJsonBaseOptions {
* Options for the `json` quick action.
* At least one of `prompt` or `response_format` must be provided.
*/
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
type BrowserRunJsonOptions = BrowserRunCommonOptions & 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/ */
@@ -11216,80 +10906,14 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBacken
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
response_format: AiTextGenerationResponseFormat;
});
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 BrowserRunContentOptions = BrowserRunCommonOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
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;
@@ -11302,7 +10926,6 @@ type BrowserRunLinksSuccessResponse = {
success: true;
/** Extracted links */
result: string[];
meta: BrowserRunResponseMeta;
};
/** Success response for `scrape` action. */
type BrowserRunScrapeSuccessResponse = {
@@ -11333,33 +10956,15 @@ type BrowserRunScrapeSuccessResponse = {
}>;
}>;
}>;
meta: BrowserRunResponseMeta;
};
/** Success response for `snapshot` action. Each field is present only when the
* corresponding entry was requested in `formats`.
*/
/** Success response for `snapshot` action. */
type BrowserRunSnapshotSuccessResponse = {
success: true;
result: {
/** HTML content of the page. */
content?: string;
content: string;
/** Base64-encoded screenshot image. */
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;
screenshot: string;
};
meta: BrowserRunResponseMeta;
};
@@ -11368,14 +10973,12 @@ 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 = {
@@ -11485,10 +11088,9 @@ declare abstract class BrowserRun {
*/
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
/**
* Get several representations of a web page in one request.
* Get both the HTML content and a base64-encoded screenshot of a web page.
* @param action - Must be `'snapshot'`.
* @param options - Snapshot options including the `formats` to return and
* screenshot settings (encoding is always base64).
* @param options - Snapshot options including screenshot settings (encoding is always base64).
* @returns A `Response` containing one of:
*
* **Success (HTTP 200):**
@@ -11536,26 +11138,6 @@ 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
@@ -12626,13 +12208,6 @@ 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 = {
@@ -12653,46 +12228,23 @@ 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: EmailMessageBuilder): 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>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
@@ -12846,15 +12398,6 @@ 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.
*/
@@ -12876,78 +12419,6 @@ 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
@@ -12959,27 +12430,6 @@ 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;
@@ -13069,9 +12519,6 @@ 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 {
@@ -13079,40 +12526,11 @@ 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[];
@@ -13130,13 +12548,6 @@ 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
@@ -13172,14 +12583,6 @@ 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 {
/**
@@ -13194,13 +12597,6 @@ 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
*/
@@ -13230,15 +12626,11 @@ 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(options?: ImageTransformationResponseOptions): Response;
response(): Response;
/**
* The content type of the returned image
*/
@@ -13674,11 +13066,6 @@ 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';
@@ -13686,32 +13073,12 @@ declare namespace CloudflareWorkersModule {
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
delay: WorkflowDelayDuration | number;
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. */
@@ -13732,51 +13099,28 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
export type WorkflowStepContext = {
step: {
name: string;
count: number;
};
attempt: number;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
config: WorkflowStepConfig;
};
// 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>;
export type WorkflowRollbackContext<T = unknown> = {
ctx: WorkflowStepContext;
error: Error;
output: T | undefined;
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
stepName: string;
};
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>;
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown> = {
rollback: WorkflowRollbackHandler<T>;
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>;
@@ -14552,12 +13896,11 @@ type MarkdownDocument = {
name: string;
blob: Blob;
};
type OutputFormat = 'markdown' | 'text';
type ConversionResponse = {
id: string;
name: string;
mimeType: string;
format: OutputFormat;
format: 'markdown';
tokens: number;
data: string;
} | {
@@ -14574,11 +13917,7 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOutputOptions = {
format?: OutputFormat;
};
type ConversionOptions = {
output?: ConversionOutputOptions;
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
@@ -14673,7 +14012,7 @@ declare namespace TailStream {
interface ConnectEventInfo {
readonly type: "connect";
}
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime" | "aborted";
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime";
interface ScriptVersion {
readonly id: string;
readonly tag?: string;
@@ -14692,7 +14031,6 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
@@ -14727,22 +14065,11 @@ declare namespace TailStream {
readonly message: string;
readonly stack?: string;
}
interface TailStreamErrorInfo {
readonly name: string;
readonly message: string;
readonly stack?: string;
}
type Log = {
interface 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;
@@ -15220,31 +14547,10 @@ 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.
@@ -15262,9 +14568,6 @@ 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)
@@ -15282,13 +14585,6 @@ 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.
@@ -15322,19 +14618,14 @@ 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(options?: WorkflowInstanceTerminateOptions): Promise<void>;
public terminate(): 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,6 +32,13 @@
"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": {
+4 -16
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 player's stored map. On a player's
`{ PlayerId, Key, Value }`, read from the per-player KV 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 the `player_settings` D1 table (one JSON row per player).
Persisted in Workers KV (`RECFLARE_PLAYER_SETTINGS`, key `player:<id>`).
- `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,24 +22,12 @@ 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.
## 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.
## KV namespace
```sh
just migrate -F playersettings # create the table (add -- --local for the dev db)
wrangler kv namespace create RECFLARE_PLAYER_SETTINGS # then put the id in .env under RECFLARE_KV (see .env.example)
```
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
@@ -1,13 +0,0 @@
-- 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,7 +12,6 @@
"deploy": "run-wrangler-deploy",
"dev": "run-wrangler-dev",
"fix:workers-types": "run-wrangler-types",
"migrate": "run-wrangler-migrate",
"test": "run-vitest"
},
"dependencies": {
+2 -6
View File
@@ -6,12 +6,8 @@ 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 `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
/** Per-player settings store. Key `player:<id>` → JSON map of `{ key: value }`. */
RECFLARE_PLAYER_SETTINGS: KVNamespace
}
/** Variables can be extended */
+2 -3
View File
@@ -1,8 +1,7 @@
/**
* Default player settings seeded on a player's first read, ported verbatim from
* the reference's `PlayerSettingsController.GetPlayerSettings`. Ordered; written to the player’s row the
* first time a player has no stored settings. Mirrored as `SEEDED_DEFAULTS` in
* packages/tools/src/cmd/admin.cmd.ts (the KV import treats these values as the seed) — keep in sync.
* the reference's `PlayerSettingsController.GetPlayerSettings`. Ordered; written to KV the
* first time a player has no stored settings.
*/
export const DEFAULT_SETTINGS: Array<{ Key: string; Value: string }> = [
{ Key: 'Recroom.OOBE', Value: '77' },
+30 -36
View File
@@ -2,13 +2,7 @@ import { Hono } from 'hono'
import { describeRoute, openAPIRouteHandler } from 'hono-openapi'
import { useWorkersLogger } from 'workers-tagged-logger'
import {
mergePlayerSettings,
PlayerSettingsTooLargeError,
putPlayerSettingsIfChanged,
readPlayerSettings,
writePlayerSettings,
} from '@repo/domain'
import { mergePlayerSettings } from '@repo/domain'
import { withCleanSpec, withNotFound, withOnError } from '@repo/hono-helpers'
import { validateAndGetAccountId } from '@repo/jwt'
@@ -31,11 +25,9 @@ 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 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.
* 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.
*
* Every `/playersettings` route is auth-gated on the Bearer JWT issued by the `auth` worker.
*/
@@ -155,7 +147,7 @@ const app = new Hono<App>()
)
// The authenticated player's settings as `{ PlayerId, Key, Value }`. Reads
// the player's row; seeds (and persists) the defaults on first read.
// the per-player KV map; seeds (and persists) the defaults on first read.
.get(
'/playersettings',
describeRoute({
@@ -163,7 +155,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 stored map. A player with nothing stored is seeded with the reference defaults',
'their KV 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(' '),
@@ -177,42 +169,40 @@ const app = new Hono<App>()
const id = await authedId(c)
if (id === null) return unauthorized(c)
let stored = await readPlayerSettings(c.env.DB, id)
const kvKey = `player:${id}`
let stored = await c.env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(kvKey, 'json')
if (!stored || Object.keys(stored).length === 0) {
stored = Object.fromEntries(DEFAULT_SETTINGS.map((s) => [s.Key, s.Value]))
await writePlayerSettings(c.env.DB, id, stored)
await c.env.RECFLARE_PLAYER_SETTINGS.put(kvKey, JSON.stringify(stored))
}
return c.json(Object.entries(stored).map(([Key, Value]) => ({ PlayerId: id, Key, Value })))
}
)
// Upsert player settings into the player's row, keyed by the authenticated player id.
// Upsert player settings into KV, 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 — the row is written only when a value changed.
// read only — KV writes are what cost money here.
.put(
'/playersettings',
describeRoute({
tags: ['Player Settings'],
summary: 'Write the player’s settings',
description: [
'Upserts the posted setting(s) into the caller’s settings map. The write MERGES: a single',
'Upserts the posted setting(s) into the caller’s KV 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. A PUT that would make the stored map',
'larger than 64 KiB of JSON is refused with a 413 and changes nothing. Empty body on',
'success.',
'values are already stored — nothing is written to KV. Empty body on success.',
].join(' '),
security: AUTHED,
requestBody: formOrJson(SettingFormWrite, SettingJsonWrite, 'The setting(s) to write'),
responses: {
200: { description: 'Applied, or nothing parseable to apply (empty body)' },
401: UNAUTHORIZED_RESPONSE,
413: { description: 'The stored map would exceed 64 KiB; nothing was written' },
},
}),
async (c) => {
@@ -225,12 +215,7 @@ const app = new Hono<App>()
const patch: Record<string, string> = {}
for (const { key, value } of incoming) patch[key] = value
try {
await mergePlayerSettings(c.env.DB, id, patch)
} catch (err) {
if (err instanceof PlayerSettingsTooLargeError) return c.body(null, 413)
throw err
}
await mergePlayerSettings(c.env.RECFLARE_PLAYER_SETTINGS, id, patch)
return c.body(null, 200)
}
)
@@ -244,7 +229,7 @@ const app = new Hono<App>()
tags: ['Player Settings'],
summary: 'Delete a player setting',
description: [
'Removes the named setting(s) from the caller’s settings map. The client sends a bare',
'Removes the named setting(s) from the caller’s KV 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',
@@ -267,13 +252,22 @@ const app = new Hono<App>()
const keys = await parseDeleteKeys(c)
if (keys.length === 0) return c.body(null, 200)
const existing = await readPlayerSettings(c.env.DB, id)
const kvKey = `player:${id}`
const existing = await c.env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
kvKey,
'json'
)
if (!existing) return c.body(null, 200)
const remaining = { ...existing }
for (const key of keys) delete remaining[key]
// Nothing stored was named: no write.
await putPlayerSettingsIfChanged(c.env.DB, id, existing, remaining)
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))
return c.body(null, 200)
}
@@ -293,8 +287,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 as one JSON row per player on the shared',
'D1, seeded with the reference defaults on a player’s first read.',
'player toggles options; they are stored in a per-player KV map, seeded with the',
'reference defaults on a player’s first read.',
].join('\n'),
},
servers: [{ url: 'https://playersettings.recflare.net', description: 'Production' }],
@@ -3,8 +3,6 @@ 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' {
@@ -16,33 +14,8 @@ 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'
@@ -112,9 +85,12 @@ 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.
const map = await stored(100)
expect(map?.['Recroom.OOBE']).toBe('77')
// 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')
})
it('GET /playersettings reflects a value written by PUT', async () => {
@@ -133,15 +109,18 @@ describe('playersettings endpoints', () => {
expect(res.status).toBe(401)
})
it('PUT /playersettings persists the form key/value', async () => {
it('PUT /playersettings persists the form key/value into KV', async () => {
const res = await SELF.fetch(
`${ORIGIN}/playersettings`,
putForm({ key: 'PlayerSessionCount', value: '1' }, await bearer('7'))
)
expect(res.status).toBe(200)
const map = await stored(7)
expect(map).toEqual({ PlayerSessionCount: '1' })
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:7',
'json'
)
expect(stored).toEqual({ PlayerSessionCount: '1' })
})
it('PUT /playersettings merges instead of replacing', async () => {
@@ -154,57 +133,37 @@ describe('playersettings endpoints', () => {
putForm({ key: 'B', value: '2' }, await bearer('8'))
)
const map = await stored(8)
expect(map).toEqual({ A: '1', B: '2' })
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:8',
'json'
)
expect(stored).toEqual({ A: '1', B: '2' })
})
// 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 () => {
// 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 () => {
const padded = '{ "PlayerSessionCount": "5", "Recroom.OOBE": "77" }'
await seedRaw(10, padded)
await env.RECFLARE_PLAYER_SETTINGS.put('player:10', padded)
const same = await SELF.fetch(
`${ORIGIN}/playersettings`,
putForm({ key: 'PlayerSessionCount', value: '5' }, await bearer('10'))
)
expect(same.status).toBe(200)
expect(await rawData(10)).toBe(padded)
expect(await env.RECFLARE_PLAYER_SETTINGS.get('player:10', 'text')).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 rawData(10)).toBe(
expect(await env.RECFLARE_PLAYER_SETTINGS.get('player:10', 'text')).toBe(
JSON.stringify({ PlayerSessionCount: '6', 'Recroom.OOBE': '77' })
)
})
// The map lives on the D1 every worker shares, so a player can't grow it without bound.
it('PUT /playersettings refuses a write that would push the map past the cap', async () => {
await seedRaw(11, JSON.stringify({ A: '1' }))
const big = Array.from({ length: 70 }, (_, i) => ({ key: `K${i}`, value: 'x'.repeat(1024) }))
const res = await SELF.fetch(`${ORIGIN}/playersettings`, {
method: 'PUT',
headers: { ...(await bearer('11')), 'content-type': 'application/json' },
body: JSON.stringify(big),
})
expect(res.status).toBe(413)
expect(await stored(11)).toEqual({ A: '1' })
// Under the cap, the same kind of write still lands.
const ok = await SELF.fetch(`${ORIGIN}/playersettings`, {
method: 'PUT',
headers: { ...(await bearer('11')), 'content-type': 'application/json' },
body: JSON.stringify(big.slice(0, 10)),
})
expect(ok.status).toBe(200)
expect(Object.keys((await stored(11)) ?? {})).toHaveLength(11)
})
it('PUT /playersettings 200s with no parseable settings', async () => {
const res = await SELF.fetch(`${ORIGIN}/playersettings`, putForm({}, await bearer('9')))
expect(res.status).toBe(200)
@@ -234,8 +193,11 @@ describe('playersettings endpoints', () => {
)
expect(res.status).toBe(200)
const map = await stored(20)
expect(map).toEqual({ PlayerSessionCount: '3' })
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:20',
'json'
)
expect(stored).toEqual({ PlayerSessionCount: '3' })
})
it('DELETE /playersettings reads a body with no content-type', async () => {
@@ -251,8 +213,11 @@ describe('playersettings endpoints', () => {
})
expect(res.status).toBe(200)
const map = await stored(21)
expect(map).toEqual({})
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:21',
'json'
)
expect(stored).toEqual({})
})
it('DELETE /playersettings 200s for an unknown key and an empty body', async () => {
@@ -271,8 +236,11 @@ describe('playersettings endpoints', () => {
expect(empty.status).toBe(200)
// Neither call touched the stored map.
const map = await stored(22)
expect(map).toEqual({ A: '1' })
const stored = await env.RECFLARE_PLAYER_SETTINGS.get<Record<string, string>>(
'player:22',
'json'
)
expect(stored).toEqual({ A: '1' })
})
it('GET /openapi.json documents every route', async () => {
+242 -953
View File
@@ -1,5 +1,5 @@
/* eslint-disable */
// Runtime types generated with workerd@1.20260831.1 2026-06-16 nodejs_compat
// Runtime types generated with workerd@1.20260625.1 2025-09-20 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. This is how error conditions are described in web APIs.
* The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
*/
declare class DOMException extends Error {
constructor(message?: string, name?: string);
/**
* The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
* The **`message`** read-only property of the a message or description associated with the given error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
*/
readonly message: string;
/**
* The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
* The **`name`** read-only property of the one of the strings associated with an error name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
*/
readonly name: string;
/**
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
* 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().
* The **`console.countReset()`** static method resets counter used with console/count_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)
*/
countReset(label?: string): void;
/**
* 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.
* The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
*/
debug(...data: any[]): void;
/**
* 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.
* The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)
*/
dir(item?: any, options?: any): void;
/**
* 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.
* The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)
*/
dirxml(...data: any[]): void;
/**
* 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.
* The **`console.error()`** static method outputs a message to the console at the 'error' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
*/
error(...data: any[]): void;
/**
* 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.
* The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)
*/
group(...data: any[]): void;
/**
* 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.
* The **`console.groupCollapsed()`** static method creates a new inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)
*/
groupCollapsed(...data: any[]): void;
/**
* 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.
* The **`console.groupEnd()`** static method exits the current inline group in the console.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)
*/
groupEnd(): void;
/**
* 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.
* The **`console.info()`** static method outputs a message to the console at the 'info' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
*/
@@ -168,24 +168,23 @@ 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. 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.
* The **`console.time()`** static method starts a timer you can use to track how long an operation takes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)
*/
time(label?: string): void;
/**
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console.time().
* The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)
*/
timeEnd(label?: string): void;
/**
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console.time().
* The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)
*/
timeLog(label?: string, ...data: any[]): void;
/* 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.
@@ -194,7 +193,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 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.
* The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
*/
@@ -360,7 +359,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;
declare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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().
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -405,7 +404,6 @@ 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,
@@ -422,12 +420,10 @@ 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>;
@@ -516,7 +512,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" | "us";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
@@ -530,7 +526,6 @@ 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;
@@ -545,7 +540,7 @@ interface DurableObjectState<Props = unknown> {
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
getHibernatableWebSocketEventTimeout(): number | null;
getTags(ws: WebSocket): string[];
abort(reason?: string, options?: DurableObjectAbortOptions): void;
abort(reason?: string): void;
}
interface DurableObjectTransaction {
get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
@@ -581,9 +576,6 @@ interface DurableObjectStorage {
getBookmarkForTime(timestamp: number | Date): Promise<string>;
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
}
interface DurableObjectAbortOptions {
retryAlarm?: boolean;
}
interface DurableObjectListOptions {
start?: string;
startAfter?: string;
@@ -634,26 +626,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. 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.
* The **`type`** read-only property of the Event interface returns a string containing the event's type.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
*/
get type(): string;
/**
* The **`eventPhase`** read-only property of the Event interface indicates which phase of the event flow is currently being evaluated.
* The **`eventPhase`** read-only property of the being evaluated.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
*/
get eventPhase(): number;
/**
* 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.
* The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
*/
@@ -690,13 +682,13 @@ declare class Event {
*/
get currentTarget(): EventTarget | undefined;
/**
* 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.
* The read-only **`target`** property of the dispatched.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
get target(): EventTarget | undefined;
/**
* The deprecated **`Event.srcElement`** is an alias for the Event.target property. Use Event.target instead.
* The deprecated **`Event.srcElement`** is an alias for the Event.target property.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
@@ -709,45 +701,45 @@ declare class Event {
*/
get timeStamp(): number;
/**
* 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.
* The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
*/
get isTrusted(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated. 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.
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
get cancelBubble(): boolean;
/**
* The **`cancelBubble`** property of the Event interface is deprecated. 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.
* The **`cancelBubble`** property of the Event interface is deprecated.
* @deprecated
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
*/
set cancelBubble(value: boolean);
/**
* The **`stopImmediatePropagation()`** method of the Event interface prevents other listeners of the same event from being called.
* The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
*/
stopImmediatePropagation(): void;
/**
* 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.
* The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
*/
preventDefault(): void;
/**
* 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().
* The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
*/
stopPropagation(): void;
/**
* 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.
* The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
*/
@@ -768,7 +760,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. In other words, any target of events implements the three methods associated with this interface.
* The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
*/
@@ -781,13 +773,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 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.
* The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;
/**
* 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().
* The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
*/
@@ -819,7 +811,7 @@ declare class AbortController {
*/
get signal(): AbortSignal;
/**
* 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.
* The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)
*/
@@ -832,7 +824,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 abort event).
* The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)
*/
@@ -844,13 +836,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 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.
* The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)
*/
static any(signals: AbortSignal[]): AbortSignal;
/**
* 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)
*/
@@ -866,17 +858,12 @@ 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 reason if the signal has been aborted; otherwise it does nothing.
* The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)
*/
throwIfAborted(): void;
}
/**
* 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>;
}
@@ -884,20 +871,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. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
* The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
*/
declare abstract class ExtendableEvent extends Event {
/**
* 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.
* The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
*/
waitUntil(promise: Promise<any>): void;
}
/**
* The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
* The **`CustomEvent`** interface represents events initialized by an application for any purpose.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
*/
@@ -936,7 +923,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)
*/
@@ -954,13 +941,13 @@ declare class Blob {
*/
bytes(): Promise<Uint8Array>;
/**
* 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.
* The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)
*/
text(): Promise<string>;
/**
* 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)
*/
@@ -977,13 +964,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. For security reasons, the path is excluded from this property.
* The **`name`** read-only property of the File interface returns the name of the file represented by a File object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
*/
get name(): string;
/**
* 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.
* The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
*/
@@ -1000,7 +987,7 @@ interface FileOptions {
*/
declare abstract class CacheStorage {
/**
* The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.
* The **`open()`** method of the the Cache object matching the `cacheName`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
*/
@@ -1033,14 +1020,14 @@ interface CacheQueryOptions {
*/
declare abstract class Crypto {
/**
* The **`Crypto.subtle`** read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations.
* The **`Crypto.subtle`** read-only property returns a cryptographic operations.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
*/
get subtle(): SubtleCrypto;
/**
* 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).
* The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)
*/
@@ -1068,7 +1055,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. 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").
* The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)
*/
@@ -1086,7 +1073,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. 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.
* The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)
*/
@@ -1104,7 +1091,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 SubtleCrypto interface can be used to derive an array of bits from a base key.
* The **`deriveBits()`** method of the key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)
*/
@@ -1122,13 +1109,13 @@ declare abstract class SubtleCrypto {
*/
exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
/**
* 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.
* The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)
*/
wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
/**
* 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.
* The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)
*/
@@ -1136,20 +1123,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 generateKey(), deriveKey(), importKey(), or unwrapKey().
* The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.
* Available only in secure contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)
*/
declare abstract class CryptoKey {
/**
* 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:
* The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)
*/
readonly type: string;
/**
* 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)
*/
@@ -1266,15 +1253,12 @@ interface CryptoKeyArbitraryKeyAlgorithm {
length?: number;
}
declare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {
constructor(algorithm: string | SubtleCryptoHashAlgorithm, options?: DigestStreamOptions);
constructor(algorithm: string | SubtleCryptoHashAlgorithm);
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, or GBK. A decoder takes an array of bytes as input and returns a JavaScript string.
* The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
*/
@@ -1291,20 +1275,20 @@ declare class TextDecoder {
get ignoreBOM(): boolean;
}
/**
* The **`TextEncoder`** interface enables you to encode a JavaScript string using UTF-8.
* The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)
*/
declare class TextEncoder {
constructor();
/**
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Uint8Array containing the string encoded using UTF-8.
* The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)
*/
encode(input?: string): Uint8Array;
/**
* 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.
* The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
*/
@@ -1361,9 +1345,6 @@ declare class ErrorEvent extends Event {
get error(): any;
}
interface ErrorEventErrorEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
message?: string;
filename?: string;
lineno?: number;
@@ -1376,139 +1357,135 @@ 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 MessageEvent interface represents the data sent by the message emitter.
* The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
*/
readonly data: any;
/**
* The **`origin`** read-only property of the MessageEvent interface is a string representing the origin of the message emitter.
* The **`origin`** read-only property of the origin of the message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
*/
readonly origin: string | null;
/**
* The **`lastEventId`** read-only property of the MessageEvent interface is a string representing a unique ID for the event.
* The **`lastEventId`** read-only property of the unique ID for the event.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
*/
readonly lastEventId: string;
/**
* The **`source`** read-only property of the MessageEvent interface is a MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter.
* The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
*/
readonly source: MessagePort | null;
/**
* The **`ports`** read-only property of the MessageEvent interface is an array of MessagePort objects containing all MessagePort objects sent with the message, in order.
* The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
*/
readonly ports: MessagePort[];
}
interface MessageEventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
data?: any;
origin?: string;
lastEventId?: string;
source?: MessagePort;
ports?: MessagePort[];
data: ArrayBuffer | string;
}
/**
* 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.
* The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)
*/
declare abstract class PromiseRejectionEvent extends Event {
/**
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript Promise which was rejected. You can examine the event's PromiseRejectionEvent.reason property to learn why the promise was rejected.
* The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)
*/
readonly promise: Promise<any>;
/**
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject(). This in theory provides information about why the promise was rejected.
* The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)
*/
readonly reason: any;
}
/**
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the 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".
* The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)
*/
declare class FormData {
constructor();
/**
* The **`append()`** method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
* 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. If you expect multiple values and want all of them, use the getAll() method instead.
* The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)
*/
get(name: string): (File | string) | null;
/**
* The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a FormData object.
* 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<[
@@ -1587,19 +1564,19 @@ interface DocumentEnd {
append(content: string, options?: ContentOptions): DocumentEnd;
}
/**
* This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.
* This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)
*/
declare abstract class FetchEvent extends ExtendableEvent {
/**
* The **`request`** read-only property of the FetchEvent interface returns the Request that triggered the event handler.
* The **`request`** read-only property of the the event handler.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)
*/
readonly request: Request;
/**
* The **`respondWith()`** method of FetchEvent prevents the browser's default fetch handling, and allows you to provide a promise for a Response yourself.
* The **`respondWith()`** method of allows you to provide a promise for a Response yourself.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)
*/
@@ -1608,62 +1585,65 @@ 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. These actions include retrieving, setting, adding to, and removing headers from the list of the request's headers.
* The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)
*/
declare class Headers {
constructor(init?: HeadersInit);
/**
* 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.
* The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)
*/
get(name: string): string | null;
getAll(name: string): string[];
/**
* 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.
* The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
*/
getSetCookie(): string[];
/**
* 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 | Iterable<ArrayBuffer | ArrayBufferView> | AsyncIterable<ArrayBuffer | ArrayBufferView>;
type BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;
declare abstract class Body {
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
get body(): ReadableStream | null;
@@ -1719,7 +1699,7 @@ interface Response extends Body {
*/
statusText: string;
/**
* The **`headers`** read-only property of the Response interface contains the Headers object associated with the response.
* The **`headers`** read-only property of the with the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)
*/
@@ -1737,7 +1717,7 @@ interface Response extends Body {
*/
redirected: boolean;
/**
* 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.
* The **`url`** read-only property of the Response interface contains the URL of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)
*/
@@ -1745,7 +1725,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 determines whether scripts are able to access the response body and headers.
* The **`type`** read-only property of the Response interface contains the type of the response.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)
*/
@@ -1776,13 +1756,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 Request interface contains the request's method (GET, POST, etc.)
* The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
*/
@@ -1794,7 +1774,7 @@ interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> e
*/
url: string;
/**
* The **`headers`** read-only property of the Request interface contains the Headers object associated with the request.
* The **`headers`** read-only property of the with the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
*/
@@ -1820,13 +1800,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. It controls how the request will interact with the browser's HTTP cache.
* The **`cache`** read-only property of the Request interface contains the cache mode of the request.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
*/
@@ -2215,7 +2195,7 @@ type ReadableStreamReadResult<R = any> = {
value?: undefined;
};
/**
* 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.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2233,13 +2213,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. While the stream is locked, no other reader can be acquired until this one is released.
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
getReader(): ReadableStreamDefaultReader<R>;
/**
* 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.
* The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)
*/
@@ -2251,13 +2231,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 ReadableStream interface tees the current readable stream, returning a two-element array containing the two resulting branches as new ReadableStream instances.
* The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)
*/
@@ -2269,7 +2249,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 Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
* The `ReadableStream` interface of the Streams API represents a readable stream of byte data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)
*/
@@ -2301,7 +2281,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. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files.
* The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)
*/
@@ -2310,13 +2290,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. 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.
* The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
*/
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
/**
* 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.
* The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)
*/
@@ -2335,7 +2315,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)
*/
@@ -2361,13 +2341,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. Default controllers are for streams that are not byte streams.
* The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)
*/
declare abstract class ReadableStreamDefaultController<R = any> {
/**
* The **`desiredSize`** read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue.
* The **`desiredSize`** read-only property of the required to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)
*/
@@ -2379,32 +2359,32 @@ declare abstract class ReadableStreamDefaultController<R = any> {
*/
close(): void;
/**
* The **`enqueue()`** method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream.
* The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)
*/
enqueue(chunk?: R): void;
/**
* The **`error()`** method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error.
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)
*/
error(reason: any): void;
}
/**
* 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.
* The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
*/
declare abstract class ReadableByteStreamController {
/**
* The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or null if there are no pending requests.
* 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)
*/
@@ -2416,7 +2396,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 transferred 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 copied into the stream's internal queues).
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)
*/
@@ -2429,7 +2409,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. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate.
* The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
*/
@@ -2441,7 +2421,7 @@ declare abstract class WritableStreamDefaultController {
*/
get signal(): AbortSignal;
/**
* The **`error()`** method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error.
* The **`error()`** method of the with the associated stream to error.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)
*/
@@ -2466,7 +2446,7 @@ declare abstract class TransformStreamDefaultController<O = any> {
*/
enqueue(chunk?: O): void;
/**
* 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.
* The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)
*/
@@ -2488,14 +2468,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. This object comes with built-in backpressure and queuing.
* The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)
*/
declare class WritableStream<W = any> {
constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);
/**
* 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)
*/
@@ -2507,83 +2487,83 @@ declare class WritableStream<W = any> {
*/
abort(reason?: any): Promise<void>;
/**
* 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.
* The **`close()`** method of the WritableStream interface closes the associated stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)
*/
close(): Promise<void>;
/**
* 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.
* The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)
*/
getWriter(): WritableStreamDefaultWriter<W>;
}
/**
* 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 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.
* The **`closed`** read-only property of the the stream errors or the writer's lock is released.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)
*/
get closed(): Promise<void>;
/**
* 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.
* The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)
*/
get ready(): Promise<void>;
/**
* The **`desiredSize`** read-only property of the WritableStreamDefaultWriter interface returns the desired size required to fill the stream's internal queue.
* The **`desiredSize`** read-only property of the to fill the stream's internal queue.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)
*/
get desiredSize(): number | null;
/**
* 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.
* The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)
*/
abort(reason?: any): Promise<void>;
/**
* The **`close()`** method of the WritableStreamDefaultWriter interface closes the associated writable stream.
* The **`close()`** method of the stream.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)
*/
close(): Promise<void>;
/**
* 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.
* The **`write()`** method of the operation.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)
*/
write(chunk?: W): Promise<void>;
/**
* 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.
* The **`releaseLock()`** method of the corresponding stream.
*
* [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. This stream emits the transformed output data.
* The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)
*/
get readable(): ReadableStream<O>;
/**
* 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.
* The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)
*/
@@ -2602,7 +2582,7 @@ interface ReadableStreamValuesOptions {
preventCancel?: boolean;
}
/**
* 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.
* The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)
*/
@@ -2610,7 +2590,7 @@ declare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBuffe
constructor(format: "gzip" | "deflate" | "deflate-raw");
}
/**
* 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.
* The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)
*/
@@ -2618,7 +2598,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. 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.
* The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)
*/
@@ -2627,7 +2607,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. 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.
* The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)
*/
@@ -2776,12 +2756,6 @@ 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;
@@ -2802,7 +2776,7 @@ interface UnsafeTraceMetrics {
fromTrace(item: TraceItem): TraceMetrics;
}
/**
* 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.
* The **`URL`** interface is used to parse, construct, normalize, and encode URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)
*/
@@ -2827,121 +2801,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. If the URL does not have a username, this property contains an empty string, "".
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
get username(): string;
/**
* 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, "".
* The **`username`** property of the URL interface is a string containing the username component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
*/
set username(value: string);
/**
* 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, "".
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
get password(): string;
/**
* 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, "".
* The **`password`** property of the URL interface is a string containing the password component of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
*/
set password(value: string);
/**
* 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, "".
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
get host(): string;
/**
* 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, "".
* The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
*/
set host(value: string);
/**
* 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.
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
get hostname(): string;
/**
* 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.
* The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
*/
set hostname(value: string);
/**
* 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, "".
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
get port(): string;
/**
* 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, "".
* The **`port`** property of the URL interface is a string containing the port number of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
*/
set port(value: string);
/**
* 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.
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
get pathname(): string;
/**
* 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.
* The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
*/
set pathname(value: string);
/**
* 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, "".
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
get search(): string;
/**
* 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, "".
* The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
*/
set search(value: string);
/**
* 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, "".
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
get hash(): string;
/**
* 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, "".
* The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
*/
set hash(value: string);
/**
* 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.
* The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
*/
get searchParams(): URLSearchParams;
/**
* 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().
* The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
*/
@@ -2961,13 +2935,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 blob URL pointing to the object given in the parameter.
* The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
*/
static createObjectURL(object: File | Blob): string;
/**
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling URL.createObjectURL().
* The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
*/
@@ -3017,22 +2991,25 @@ 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. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it.
* The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
*/
set(name: string, value: string): void;
/**
* 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).
* The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)
*/
sort(): void;
/* Returns an array of key, value pairs for every entry in the search params. */
entries(): IterableIterator<[
key: string,
value: string
]>;
/* 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] }*/
@@ -3042,78 +3019,18 @@ 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 {
@@ -3146,7 +3063,7 @@ interface URLPatternOptions {
ignoreCase?: boolean;
}
/**
* A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
* A `CloseEvent` is sent to clients using WebSockets when the connection is closed.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
*/
@@ -3165,16 +3082,13 @@ 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;
@@ -3186,7 +3100,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)
*/
@@ -3203,20 +3117,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. 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.
* The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
*/
send(message: (ArrayBuffer | ArrayBufferView) | string): void;
/**
* The **`WebSocket.close()`** method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.
* The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
*/
@@ -3236,13 +3150,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. This is currently only the empty string or a list of extensions as negotiated by the connection.
* The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
*/
@@ -3329,25 +3243,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 EventSource.readyState attribute to 2 (closed).
* The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
*/
close(): void;
/**
* The **`url`** read-only property of the EventSource interface returns a string representing the URL of the source.
* The **`url`** read-only property of the URL of the source.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
*/
get url(): string;
/**
* The **`withCredentials`** read-only property of the EventSource interface returns a boolean value indicating whether the EventSource object was instantiated with CORS credentials set.
* The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
*/
get withCredentials(): boolean;
/**
* The **`readyState`** read-only property of the EventSource interface returns a number representing the state of the connection.
* The **`readyState`** read-only property of the connection.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
*/
@@ -3382,26 +3296,18 @@ 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;
@@ -3428,42 +3334,25 @@ interface ContainerDirectorySnapshotOptions {
dir: string;
name?: string;
}
type ContainerDirectorySnapshotRestoreParams = {
interface 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;
}
type ContainerStartupOptions = {
interface 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[];
} & ({
image: string;
containerSnapshot?: never;
} | {
image?: never;
containerSnapshot?: ContainerSnapshotRestoreParams;
});
interface ContainerStartResources {
vcpu: number;
memoryMib: number;
diskMb: number;
containerSnapshot?: ContainerSnapshot;
}
/**
* 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.
@@ -3472,19 +3361,19 @@ interface ContainerStartResources {
*/
declare abstract class MessagePort extends EventTarget {
/**
* The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
* The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
*/
postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;
/**
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active. This stops the flow of messages to that port.
* The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
*/
close(): void;
/**
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port. This method is only needed when using EventTarget.addEventListener; it is implied when using onmessage.
* The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
*/
@@ -3500,13 +3389,13 @@ declare abstract class MessagePort extends EventTarget {
declare class MessageChannel {
constructor();
/**
* 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.
* The **`port1`** read-only property of the the port attached to the context that originated the channel.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
*/
readonly port1: MessagePort;
/**
* The **`port2`** read-only property of the 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.
* The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
*/
@@ -3566,7 +3455,7 @@ interface WorkerLoaderModule {
data?: ArrayBuffer;
json?: any;
py?: string;
wasm?: ArrayBuffer | ArrayBufferView | WebAssembly.Module;
wasm?: ArrayBuffer;
}
interface WorkerLoaderWorkerCode {
compatibilityDate: string;
@@ -3574,7 +3463,7 @@ interface WorkerLoaderWorkerCode {
allowExperimental?: boolean;
limits?: workerdResourceLimits;
mainModule: string;
modules: Record<string, string | WebAssembly.Module | WorkerLoaderModule>;
modules: Record<string, WorkerLoaderModule | string>;
env?: any;
globalOutbound?: (Fetcher | null);
tails?: Fetcher[];
@@ -3596,7 +3485,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 serializer; it returns a JSON representation of the Performance object.
* The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)
*/
@@ -3605,13 +3494,11 @@ 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): this;
setAttributes(attributes: Record<string, boolean | number | string | undefined>): this;
setAttribute(key: string, value?: (boolean | number | string)): void;
end(): void;
}
/**
@@ -4251,13 +4138,6 @@ 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[];
@@ -10155,163 +10035,6 @@ 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;
@@ -10404,13 +10127,6 @@ 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 = {
/**
@@ -11077,15 +10793,6 @@ 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"`. */
@@ -11120,7 +10827,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?: {
@@ -11156,7 +10863,7 @@ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
/** @default 30000 */
timeout?: number;
};
} & BrowserRunAlternateBackendOptions;
};
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
/** CSS selectors to scrape. At least one element is required. */
elements: Array<{
@@ -11169,29 +10876,10 @@ 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<{
@@ -11205,7 +10893,7 @@ interface BrowserRunJsonBaseOptions {
* Options for the `json` quick action.
* At least one of `prompt` or `response_format` must be provided.
*/
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBackendOptions & BrowserRunJsonBaseOptions & ({
type BrowserRunJsonOptions = BrowserRunCommonOptions & 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/ */
@@ -11216,80 +10904,14 @@ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunAlternateBacken
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
response_format: AiTextGenerationResponseFormat;
});
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 BrowserRunContentOptions = BrowserRunCommonOptions;
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
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;
@@ -11302,7 +10924,6 @@ type BrowserRunLinksSuccessResponse = {
success: true;
/** Extracted links */
result: string[];
meta: BrowserRunResponseMeta;
};
/** Success response for `scrape` action. */
type BrowserRunScrapeSuccessResponse = {
@@ -11333,33 +10954,15 @@ type BrowserRunScrapeSuccessResponse = {
}>;
}>;
}>;
meta: BrowserRunResponseMeta;
};
/** Success response for `snapshot` action. Each field is present only when the
* corresponding entry was requested in `formats`.
*/
/** Success response for `snapshot` action. */
type BrowserRunSnapshotSuccessResponse = {
success: true;
result: {
/** HTML content of the page. */
content?: string;
content: string;
/** Base64-encoded screenshot image. */
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;
screenshot: string;
};
meta: BrowserRunResponseMeta;
};
@@ -11368,14 +10971,12 @@ 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 = {
@@ -11485,10 +11086,9 @@ declare abstract class BrowserRun {
*/
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
/**
* Get several representations of a web page in one request.
* Get both the HTML content and a base64-encoded screenshot of a web page.
* @param action - Must be `'snapshot'`.
* @param options - Snapshot options including the `formats` to return and
* screenshot settings (encoding is always base64).
* @param options - Snapshot options including screenshot settings (encoding is always base64).
* @returns A `Response` containing one of:
*
* **Success (HTTP 200):**
@@ -11536,26 +11136,6 @@ 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
@@ -12626,13 +12206,6 @@ 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 = {
@@ -12653,46 +12226,23 @@ 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: EmailMessageBuilder): 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>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
@@ -12846,15 +12396,6 @@ 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.
*/
@@ -12876,78 +12417,6 @@ 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
@@ -12959,27 +12428,6 @@ 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;
@@ -13069,9 +12517,6 @@ 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 {
@@ -13079,40 +12524,11 @@ 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[];
@@ -13130,13 +12546,6 @@ 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
@@ -13172,14 +12581,6 @@ 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 {
/**
@@ -13194,13 +12595,6 @@ 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
*/
@@ -13230,15 +12624,11 @@ 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(options?: ImageTransformationResponseOptions): Response;
response(): Response;
/**
* The content type of the returned image
*/
@@ -13674,11 +13064,6 @@ 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';
@@ -13686,32 +13071,12 @@ declare namespace CloudflareWorkersModule {
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
delay: WorkflowDelayDuration | number;
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. */
@@ -13732,51 +13097,28 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
export type WorkflowStepContext = {
step: {
name: string;
count: number;
};
attempt: number;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
config: WorkflowStepConfig;
};
// 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>;
export type WorkflowRollbackContext<T = unknown> = {
ctx: WorkflowStepContext;
error: Error;
output: T | undefined;
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
stepName: string;
};
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>;
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
export type WorkflowStepRollbackOptions<T = unknown> = {
rollback: WorkflowRollbackHandler<T>;
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>;
@@ -14552,12 +13894,11 @@ type MarkdownDocument = {
name: string;
blob: Blob;
};
type OutputFormat = 'markdown' | 'text';
type ConversionResponse = {
id: string;
name: string;
mimeType: string;
format: OutputFormat;
format: 'markdown';
tokens: number;
data: string;
} | {
@@ -14574,11 +13915,7 @@ type EmbeddedImageConversionOptions = ImageConversionOptions & {
convert?: boolean;
maxConvertedImages?: number;
};
type ConversionOutputOptions = {
format?: OutputFormat;
};
type ConversionOptions = {
output?: ConversionOutputOptions;
html?: {
images?: EmbeddedImageConversionOptions & {
convertOGImage?: boolean;
@@ -14673,7 +14010,7 @@ declare namespace TailStream {
interface ConnectEventInfo {
readonly type: "connect";
}
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime" | "aborted";
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime";
interface ScriptVersion {
readonly id: string;
readonly tag?: string;
@@ -14692,7 +14029,6 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
@@ -14727,22 +14063,11 @@ declare namespace TailStream {
readonly message: string;
readonly stack?: string;
}
interface TailStreamErrorInfo {
readonly name: string;
readonly message: string;
readonly stack?: string;
}
type Log = {
interface 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;
@@ -15220,31 +14545,10 @@ 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.
@@ -15262,9 +14566,6 @@ 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)
@@ -15282,13 +14583,6 @@ 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.
@@ -15322,19 +14616,14 @@ 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(options?: WorkflowInstanceTerminateOptions): Promise<void>;
public terminate(): 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
@@ -4,18 +4,11 @@
"main": "src/playersettings.app.ts",
"compatibility_date": "2026-06-16",
"compatibility_flags": ["nodejs_compat"],
// 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": [
// Per-player settings persistence.
"kv_namespaces": [
{
"binding": "DB",
"database_name": "recflare",
"database_id": "local",
"migrations_dir": "migrations",
"migrations_table": "d1_migrations_playersettings"
"binding": "RECFLARE_PLAYER_SETTINGS",
"id": "local"
}
],
// Shared Secrets Store holding the HS256 JWT signing key. Every worker binds the
+84 -40
View File
@@ -83,6 +83,7 @@ import {
transferRoomOwnership,
unbanPlayerFromRoom,
updateRoomFields,
withConfirmedRoles,
writeAuditLog,
} from '@repo/domain'
import {
@@ -665,16 +666,14 @@ function parseMaxPlayerCalculationMode(value: unknown): number | undefined {
return Object.values(MAX_PLAYER_CALCULATION_MODES).includes(ordinal) ? ordinal : undefined
}
async function pushRoomUpdate(
c: Context<App>,
playerId: number,
room: Record<string, unknown>
): Promise<void> {
async function pushRoomUpdate(c: Context<App>, playerId: number, room: Room): Promise<void> {
try {
// The pushed room is the client's room, like any served one: pending invites are not
// part of its `Roles` (see `serveRoom`).
await c.env.RECFLARE_NOTIFICATIONS_HUB.getByName(HUB_INSTANCE).notifyPlayer(
playerId,
NotificationType.SubscriptionUpdateRoom,
room
withConfirmedRoles(room)
)
} catch (err) {
logger.error('failed to push RoomUpdate notification', {
@@ -702,7 +701,7 @@ async function pushRoomUpdate(
async function pushRoomUpdateToRoom(
c: Context<App>,
roomId: number,
room: Record<string, unknown>,
room: Room,
alsoNotify: number[] = []
): Promise<void> {
const playerIds = new Set(await getPlayerIdsInRoom(c.env.DB, roomId))
@@ -1114,16 +1113,44 @@ function toSaveDetail(save: Record<string, unknown>, target: number | null) {
}
}
/** Client envelope for room mutations: `{ success, error, value }` (lowercase). */
function roomEnvelope(c: Context<App>, value: unknown, error = '') {
return c.json({ success: error === '', error, value })
/**
* A room as the client is shown it. The stored room is served whole EXCEPT for its pending
* role invites: a `Roles` entry with `Role` 0 and an `InvitedRole` is an offer the player
* has not answered, and served as-is it put the invited player on the room's member list
* (and, on the 2025 client, in its co-owner list) before they had accepted anything. The
* offer reaches them as a `RoomCoOwnerInvited` message; the entry stays in the STORED room
* for the accept to promote, which is why this is applied where the room leaves the worker
* and never to a room about to be written back.
*
* Every room this worker answers — alone, in a list, in the mutation envelope or pushed as
* a `RoomUpdate` — goes through this (or {@link serveRooms}).
*/
const serveRoom = withConfirmedRoles
/** {@link serveRoom} over a list. */
const serveRooms = (rooms: Room[]): Room[] => rooms.map(serveRoom)
/** {@link serveRoom} over a `{ Results, TotalResults }` page. */
const serveRoomPage = <T extends { Results: Room[] }>(page: T): T => ({
...page,
Results: serveRooms(page.Results),
})
/**
* Client envelope for room mutations: `{ success, error, value }` (lowercase). `value` is
* the updated room (served through {@link serveRoom}) or null on a refusal.
*/
function roomEnvelope(c: Context<App>, value: Room | null, error = '') {
return c.json({ success: error === '', error, value: value && serveRoom(value) })
}
/**
* The same envelope for the ban write, whose `value` is the BAN rather than the room —
* a ban isn't part of the room the client renders, so there is no updated room to send.
*/
const banEnvelope = roomEnvelope
function banEnvelope(c: Context<App>, value: unknown, error = '') {
return c.json({ success: error === '', error, value })
}
/**
* The envelope both leaderboard routes answer: `{ Success, Error, error_id }`, carrying
@@ -1162,7 +1189,7 @@ const experienceEnvelope = leaderboardEnvelope
async function ownedRooms(c: Context<App>) {
const accountId = await authedAccountId(c)
if (accountId === null) return unauthorized(c)
return c.json(await getRoomsByCreator(c.env.DB, accountId))
return c.json(serveRooms(await getRoomsByCreator(c.env.DB, accountId)))
}
/**
@@ -1175,7 +1202,7 @@ async function ownedRoomsExcludingDorm(c: Context<App>) {
const rooms = (await getContributedRooms(c.env.DB, accountId)).filter((room) =>
canManageRoom(room, accountId)
)
return c.json(rooms.filter((r) => r.IsDorm !== true))
return c.json(serveRooms(rooms.filter((r) => r.IsDorm !== true)))
}
/** Suggestions `/rooms/autocomplete_search` returns when the client names no `take`. */
@@ -1331,10 +1358,10 @@ const app = new Hono<App>()
if (idParam) {
const id = firstId(idParam)
const room = id === undefined ? null : await getRoomById(c.env.DB, id)
return c.json(room ?? (c.req.query('include') === '525581' ? null : {}))
return c.json(room ? serveRoom(room) : c.req.query('include') === '525581' ? null : {})
}
const room = await getRoomByName(c.env.DB, nameParam ?? '')
return c.json(room ?? (c.req.query('include') === '525581' ? null : {}))
return c.json(room ? serveRoom(room) : c.req.query('include') === '525581' ? null : {})
}
)
@@ -1366,7 +1393,7 @@ const app = new Hono<App>()
return c.json({ error: `You can only have ${maxRooms} rooms.` }, 403)
const room = await createStudioRoom(c.env.DB, name, accountId, version)
if (!room) return c.json({ error: 'A room with that name already exists.' }, 409)
return c.json(room)
return c.json(serveRoom(room))
}
)
@@ -1404,7 +1431,7 @@ const app = new Hono<App>()
const query = c.req.query('query') ?? ''
const skip = Number.parseInt(c.req.query('skip') ?? '0', 10) || 0
const take = Number.parseInt(c.req.query('take') ?? '30', 10) || 30
return c.json(await searchRooms(c.env.DB, query, skip, take))
return c.json(serveRoomPage(await searchRooms(c.env.DB, query, skip, take)))
}
)
@@ -1489,7 +1516,7 @@ const app = new Hono<App>()
const tag = c.req.query('tag') ?? ''
const skip = Number.parseInt(c.req.query('skip') ?? '0', 10) || 0
const take = Number.parseInt(c.req.query('take') ?? '100', 10) || 100
return c.json(await getHotRooms(c.env.DB, tag, skip, take))
return c.json(serveRoomPage(await getHotRooms(c.env.DB, tag, skip, take)))
}
)
@@ -1541,7 +1568,7 @@ const app = new Hono<App>()
async (c) => {
const skip = Number.parseInt(c.req.query('skip') ?? '0', 10) || 0
const take = Number.parseInt(c.req.query('take') ?? '100', 10) || 100
return c.json(await getTrendingRooms(c.env.DB, skip, take))
return c.json(serveRoomPage(await getTrendingRooms(c.env.DB, skip, take)))
}
)
@@ -1563,7 +1590,7 @@ const app = new Hono<App>()
async (c) => {
const skip = Number.parseInt(c.req.query('skip') ?? '0', 10) || 0
const take = Number.parseInt(c.req.query('take') ?? '100', 10) || 100
return c.json(await getBaseRooms(c.env.DB, skip, take))
return c.json(serveRooms(await getBaseRooms(c.env.DB, skip, take)))
}
)
@@ -1591,7 +1618,7 @@ const app = new Hono<App>()
async (c) => {
const skip = Number.parseInt(c.req.query('skip') ?? '0', 10) || 0
const take = Number.parseInt(c.req.query('take') ?? '100', 10) || 100
return c.json(await getRecommendedRooms(c.env.DB, skip, take))
return c.json(serveRooms(await getRecommendedRooms(c.env.DB, skip, take)))
}
)
@@ -1686,13 +1713,15 @@ const app = new Hono<App>()
if (ids.length > MAX_BULK_ROOM_IDS) return tooManyIds(c)
const rooms = await getRoomsByIds(c.env.DB, ids)
return c.json(
excludePrivateRooms(c.req.query('excludePrivateRooms'))
? rooms.filter((r) => r.Accessibility === 1)
: rooms
serveRooms(
excludePrivateRooms(c.req.query('excludePrivateRooms'))
? rooms.filter((r) => r.Accessibility === 1)
: rooms
)
)
}
const room = await getRoomByName(c.env.DB, nameParam ?? '')
return c.json(room ? [room] : [])
return c.json(room ? [serveRoom(room)] : [])
}
)
@@ -1744,7 +1773,7 @@ const app = new Hono<App>()
const rooms = await getRoomsByIds(c.env.DB, ids)
const excludePrivate = excludePrivateRooms(field('excludePrivateRooms')[0])
return c.json(excludePrivate ? rooms.filter((r) => r.Accessibility === 1) : rooms)
return c.json(serveRooms(excludePrivate ? rooms.filter((r) => r.Accessibility === 1) : rooms))
}
)
@@ -1835,7 +1864,7 @@ const app = new Hono<App>()
async (c) => {
const accountId = await authedAccountId(c)
if (accountId === null) return unauthorized(c)
return c.json(await getContributedRooms(c.env.DB, accountId))
return c.json(serveRooms(await getContributedRooms(c.env.DB, accountId)))
}
)
@@ -1892,7 +1921,11 @@ const app = new Hono<App>()
responses: { 200: json(RoomDto.array(), 'That account’s public rooms') },
}),
async (c) =>
c.json(await getPublicRoomsByCreator(c.env.DB, Number.parseInt(c.req.param('accountId'), 10)))
c.json(
serveRooms(
await getPublicRoomsByCreator(c.env.DB, Number.parseInt(c.req.param('accountId'), 10))
)
)
)
// A player's showcased rooms — the hand-picked rail the client draws on a profile,
@@ -1940,7 +1973,7 @@ const app = new Hono<App>()
if (accountId === null) return unauthorized(c)
const skip = Number.parseInt(c.req.query('skip') ?? '0', 10) || 0
const take = Number.parseInt(c.req.query('take') ?? '100', 10) || 100
return c.json(await getFavoritedRooms(c.env.DB, accountId, skip, take))
return c.json(serveRooms(await getFavoritedRooms(c.env.DB, accountId, skip, take)))
}
)
@@ -1964,7 +1997,7 @@ const app = new Hono<App>()
if (accountId === null) return unauthorized(c)
const skip = Number.parseInt(c.req.query('skip') ?? '0', 10) || 0
const take = Number.parseInt(c.req.query('take') ?? '100', 10) || 100
return c.json(await getVisitedRooms(c.env.DB, accountId, skip, take))
return c.json(serveRooms(await getVisitedRooms(c.env.DB, accountId, skip, take)))
}
)
@@ -2010,9 +2043,11 @@ const app = new Hono<App>()
const skip = Number.parseInt(c.req.query('skip') ?? '0', 10) || 0
const take = Number.parseInt(c.req.query('take') ?? '100', 10) || 100
return c.json(
own
? await getVisitedRooms(c.env.DB, playerId, skip, take)
: await getPublicVisitedRooms(c.env.DB, playerId, skip, take)
serveRooms(
own
? await getVisitedRooms(c.env.DB, playerId, skip, take)
: await getPublicVisitedRooms(c.env.DB, playerId, skip, take)
)
)
}
)
@@ -2623,9 +2658,14 @@ const app = new Hono<App>()
summary: 'A room’s roles',
description: [
'Everyone with a role in the room — its creator plus whoever has been granted Host,',
'Moderator or CoOwner — as whole `RoomRole` records. This is the same array the',
'room DTO serves under `Roles`, on its own endpoint, so it is public exactly like the',
'room is: a role list says who runs a room, which the room page already shows.',
'Moderator or CoOwner — as whole `RoomRole` records, PLUS every pending invite. It is',
'public exactly like the room is: a role list says who runs a room, which the room',
'page already shows.',
'',
'Unlike the room DTO’s `Roles`, this list INCLUDES unanswered co-owner invites (`Role`',
'0, the offer on `InvitedRole`): the client reads it to show the players with an',
'invite pending. The room DTO leaves those entries out, because there an invited',
'player read as a member before they had accepted anything.',
'',
'A bare array, NOT the `{ success, error, value }` envelope the role WRITE answers. An',
'unknown room is an empty list rather than an error — it reads the same as a room',
@@ -4311,7 +4351,7 @@ const app = new Hono<App>()
return c.json({
success: true,
error: null,
value: { room: result.room, subRoomDataSave: toSaveResponse(result.save) },
value: { room: serveRoom(result.room), subRoomDataSave: toSaveResponse(result.save) },
})
}
)
@@ -4862,7 +4902,9 @@ const app = new Hono<App>()
const skip = Number.parseInt(c.req.query('skip') ?? '0', 10) || 0
const take = Number.parseInt(c.req.query('take') ?? '100', 10) || 100
return c.json(
await getSimilarRooms(c.env.DB, Number.parseInt(c.req.param('roomId'), 10), skip, take)
serveRoomPage(
await getSimilarRooms(c.env.DB, Number.parseInt(c.req.param('roomId'), 10), skip, take)
)
)
}
)
@@ -5130,7 +5172,9 @@ const app = new Hono<App>()
tags: ['Rooms'],
summary: 'A room by id',
description: [
'The room as stored, with its `SubRooms` re-attached. Unlike `GET /rooms?id=`, an',
'The room as stored, with its `SubRooms` re-attached and pending role invites left',
'out of `Roles` (an unanswered invite is `Role` 0 with the offer on `InvitedRole`; the',
'invited player is not a member until they accept). Unlike `GET /rooms?id=`, an',
'unknown room here is a 404, not `{}`. A save that has a Rec Room Studio build',
'lists its main bundles on `CurrentSave.UnitySubAssets` (`Target` 0 Windows, 2',
'Android/Quest, `Filename` downloaded from the CDN at `/unityasset/{filename}`).',
@@ -5153,7 +5197,7 @@ const app = new Hono<App>()
const room = await getRoomById(c.env.DB, Number.parseInt(c.req.param('roomId'), 10))
if (!room) return c.notFound()
filterRoomUnityAssets(room, unityAssetTargetQuery(c))
return c.json(room)
return c.json(serveRoom(room))
}
)
+94 -7
View File
@@ -9,6 +9,7 @@ import {
import { beforeAll, describe, expect, it } from 'vitest'
import {
answerRoomRoleInvite,
AUDIT_LOG_SCHEMA_DDL,
countRoomsUsingInvention,
createRoomInstance,
@@ -540,6 +541,20 @@ describe('rooms endpoints', () => {
Roles: [{ AccountId: 822, Role: 30 }],
})
await seed({ RoomId: 30405, Name: 'ContribNoRoles', CreatorAccountId: 821, SubRooms: [] })
// ...and one where 820 has only been INVITED to co-own — `Role` 0 with the offer on
// `InvitedRole`. They have no job in the room until they accept, so it stays out of
// both of their lists, and the pending entry is not served as part of the room.
await seed({
RoomId: 30408,
Name: 'ContribInvited',
CreatorAccountId: 821,
Accessibility: 1,
SubRooms: [],
Roles: [
{ AccountId: 821, Role: 255, LastChangedByAccountId: null, InvitedRole: 0 },
{ AccountId: 820, Role: 0, LastChangedByAccountId: 821, InvitedRole: 30 },
],
})
const res = await SELF.fetch(`${ORIGIN}/rooms/contributedby/me`, {
headers: await bearer('820'),
@@ -554,6 +569,46 @@ describe('rooms endpoints', () => {
expect(rooms.some((r) => r.RoomId === 30407)).toBe(false)
expect(rooms[0]).toMatchObject({ Name: expect.any(String), Accessibility: expect.any(Number) })
// The unanswered invite lists the room for NOBODY: not under "contributed" (above),
// not under "owned".
const owned = await SELF.fetch(`${ORIGIN}/rooms/ownedby/me`, { headers: await bearer('820') })
const ownedIds = ((await owned.json()) as Array<{ RoomId: number }>).map((r) => r.RoomId)
expect(ownedIds).toContain(30401)
expect(ownedIds).not.toContain(30408)
// Nor is the invited player part of the room as served: the room DTO carries only HELD
// roles. `GET /rooms/:id/roles` DOES list the invite — the client shows pending invites
// from it — and the stored room keeps the entry for the accept.
type Served = { Roles: Array<{ AccountId: number; Role: number; InvitedRole: number }> }
const servedRoles = async () =>
((await (await SELF.fetch(`${ORIGIN}/rooms/30408`)).json()) as Served).Roles
expect(await servedRoles()).toEqual([
{ AccountId: 821, Role: 255, LastChangedByAccountId: null, InvitedRole: 0 },
])
expect(await (await SELF.fetch(`${ORIGIN}/rooms/30408/roles`)).json()).toEqual([
{ AccountId: 821, Role: 255, LastChangedByAccountId: null, InvitedRole: 0 },
{ AccountId: 820, Role: 0, LastChangedByAccountId: 821, InvitedRole: 30 },
])
expect(
await env.DB.prepare(
'SELECT role, invited_role FROM room_role WHERE room_id = 30408 AND account_id = 820'
).first()
).toEqual({ role: 0, invited_role: 30 })
// Accepting is what puts them in: the room appears in both lists and the entry is served.
const invitedRoom = (await getRoomById(env.DB, 30408))!
expect(await answerRoomRoleInvite(env.DB, 30408, 820, 30, invitedRoom)).not.toBeNull()
expect(await contributed('820')).toContain(30408)
const ownedAfter = await SELF.fetch(`${ORIGIN}/rooms/ownedby/me`, {
headers: await bearer('820'),
})
expect(((await ownedAfter.json()) as Array<{ RoomId: number }>).map((r) => r.RoomId)).toContain(
30408
)
expect(await servedRoles()).toContainEqual(
expect.objectContaining({ AccountId: 820, Role: 30, InvitedRole: 0 })
)
// A player who contributes to nothing gets an empty array, not a 404.
const none = await SELF.fetch(`${ORIGIN}/rooms/contributedby/me`, {
headers: await bearer('829'),
@@ -579,8 +634,8 @@ describe('rooms endpoints', () => {
// The DB is shared across this file, and these are the only player-made public rooms
// in it — leaving them behind changes what the `new`/`community` room feeds serve.
await env.DB.prepare('DELETE FROM room WHERE room_id BETWEEN 30401 AND 30407').run()
await env.DB.prepare('DELETE FROM room_role WHERE room_id BETWEEN 30401 AND 30407').run()
await env.DB.prepare('DELETE FROM room WHERE room_id BETWEEN 30401 AND 30408').run()
await env.DB.prepare('DELETE FROM room_role WHERE room_id BETWEEN 30401 AND 30408').run()
})
it('GET /rooms/:roomId/experience serves the room’s stored XP settings, no auth', async () => {
@@ -1675,6 +1730,18 @@ describe('rooms endpoints', () => {
type RoomEnv = { success: boolean; error: string; value: Record<string, unknown> | null }
const envOf = async (res: Response) => (await res.json()) as RoomEnv
// A role entry as STORED, read off the `room_role` index — pending invites included.
// The served room carries only held roles; `GET /rooms/:id/roles` lists invites too.
type StoredRole = { Role: number; InvitedRole: number; LastChangedByAccountId: number | null }
const storedRoleOf = async (roomId: number, accountId: number) =>
(await env.DB.prepare(
`SELECT role AS Role, invited_role AS InvitedRole,
last_changed_by_account_id AS LastChangedByAccountId
FROM room_role WHERE room_id = ?1 AND account_id = ?2`
)
.bind(roomId, accountId)
.first<StoredRole>()) ?? undefined
// A subroom as the client sees it. There is no GET for a single subroom — the client
// reads them off the room — so tests do the same.
const subRoomOf = async (
@@ -2091,7 +2158,9 @@ describe('rooms endpoints', () => {
success: false,
error: 'You must provide a valid role!',
})
expect(await roleOf(885)).toMatchObject({ InvitedRole: 30 })
expect(await storedRoleOf(2, 885)).toMatchObject({ Role: 0, InvitedRole: 30 })
// The role list still shows the invite as pending.
expect(await roleOf(885)).toMatchObject({ Role: 0, InvitedRole: 30 })
})
it('a revoke pushes a RoomUpdate to the room and to the player who lost the role', async () => {
@@ -2150,9 +2219,13 @@ describe('rooms endpoints', () => {
)
// RecCenter (room 2) is owned by account 1. The owner invites 850 to co-ownership,
// leaving a pending offer and no role yet.
// leaving a pending offer and no role yet. The role list shows the pending invite, but
// the room DTO does not list them: they are not a member until they accept.
expect((await putForm('/rooms/2/roles/850/invite', { role: '30' }, '1')).status).toBe(200)
expect(await storedRoleOf(2, 850)).toMatchObject({ Role: 0, InvitedRole: 30 })
expect(await roleOf(850)).toMatchObject({ Role: 0, InvitedRole: 30 })
const room2 = (await (await SELF.fetch(`${ORIGIN}/rooms/2`)).json()) as { Roles: Role[] }
expect(room2.Roles.some((r) => r.AccountId === 850)).toBe(false)
// No token → 401 (auth gate).
expect((await putForm('/rooms/2/roles/850', { role: '30' })).status).toBe(401)
@@ -2165,7 +2238,7 @@ describe('rooms endpoints', () => {
await envOf(await putForm('/rooms/2/roles/850', { role: '30' }, caller))
).toMatchObject({ success: false, error: 'Co-ownership must be invited, not granted!' })
}
expect(await roleOf(850)).toMatchObject({ Role: 0, InvitedRole: 30 })
expect(await storedRoleOf(2, 850)).toMatchObject({ Role: 0, InvitedRole: 30 })
// Unknown room → failure envelope.
expect(
await envOf(await putForm('/rooms/99999/roles/850', { role: '30' }, '850'))
@@ -2182,7 +2255,7 @@ describe('rooms endpoints', () => {
expect(await envOf(await putForm('/rooms/2/roles/850', { role: '255' }, '850'))).toMatchObject({
success: false,
})
expect(await roleOf(850)).toMatchObject({ Role: 0, InvitedRole: 30 })
expect(await storedRoleOf(2, 850)).toMatchObject({ Role: 0, InvitedRole: 30 })
// A player with no entry in the room at all is the same rejection — probing tells
// them nothing.
@@ -2229,11 +2302,13 @@ describe('rooms endpoints', () => {
// Invited, then declined: the whole entry goes, leaving `Roles` as it was before the
// offer rather than an entry with nothing pending on it.
expect((await putForm('/rooms/2/roles/851/invite', { role: '30' }, '1')).status).toBe(200)
expect(await storedRoleOf(2, 851)).toMatchObject({ Role: 0, InvitedRole: 30 })
expect(await roleOf(851)).toMatchObject({ Role: 0, InvitedRole: 30 })
const declined = await putForm('/rooms/2/roles/851', { role: '0' }, '851')
expect(declined.status).toBe(200)
expect(await envOf(declined)).toMatchObject({ success: true, error: '' })
expect(await storedRoleOf(2, 851)).toBeUndefined()
expect(await roleOf(851)).toBeUndefined()
// And the decline can't be replayed either — there is no entry left to answer.
@@ -2248,6 +2323,7 @@ describe('rooms endpoints', () => {
expect(await roleOf(852)).toMatchObject({ Role: 10, InvitedRole: 0 })
expect((await putForm('/rooms/2/roles/852/invite', { role: '30' }, '1')).status).toBe(200)
expect((await putForm('/rooms/2/roles/852', { role: '0' }, '852')).status).toBe(200)
expect(await storedRoleOf(2, 852)).toBeUndefined()
expect(await roleOf(852)).toBeUndefined()
})
@@ -2495,12 +2571,23 @@ describe('rooms endpoints', () => {
expect(await res.json()).toEqual({ success: true })
// A new entry, holding no role yet — only the pending offer, stamped with the inviter.
// The role list shows it as a pending invite (the client lists pending invites from
// it); the room DTO's `Roles` does not, until they accept.
expect(await storedRoleOf(2, 187)).toEqual({
Role: 0,
InvitedRole: 30,
LastChangedByAccountId: 1,
})
expect(await rolesOf(2)).toContainEqual({
AccountId: 187,
Role: 0,
InvitedRole: 30,
LastChangedByAccountId: 1,
})
const room2 = (await (await SELF.fetch(`${ORIGIN}/rooms/2`)).json()) as {
Roles: Array<{ AccountId: number }>
}
expect(room2.Roles.some((r) => r.AccountId === 187)).toBe(false)
// One MessageReceived to the INVITED player carrying a type 62 RoomCoOwnerInvited —
// the entry alone is silent, this is what raises the invite on their client.
@@ -7320,7 +7407,7 @@ it('omits hydrated Badges when persisting a room settings edit', async () => {
// The badge lookup runs on every room page, served by a partial index over the badge rows
// (api migrations/0035, mirrored in SCHEMA_DDL above). Only a PUBLISHED badge with a built save
// hydrates; a draft stays on its creator's Studio shelf.
it('GET /rooms/:id hydrates the room\'s published badges', async () => {
it("GET /rooms/:id hydrates the room's published badges", async () => {
await seedRoomWithSubRooms(env.DB, {
RoomId: 987671,
Name: 'BadgeHydration',
+17
View File
@@ -154,6 +154,23 @@ box. The grant runs after Plus is granted and the link written, and a failure in
logged rather than failing the claim. Unset, the var awards nothing and the claim is as
before.
**Unlinking.** The same panel offers **Unlink Discord** whenever any Discord is on the
account — a claim's link or the bare one "Sign in with Discord" leaves — and
`POST /api/benefits/unlink` removes every `PlatformType.Discord` link the account holds.
It is refused (403) until the account has an **email address**: an account made from
Discord has none until the player sets one, the link may be its only way in, and an address
is what the account can be recovered through (a password is not required — a passwordless
account sets one in game). The row decides, not the page; `/api/benefits/status` serves the
same flag (`hasEmail`, beside `discordLinked`) so the panel can say so first. Afterwards that
Discord opens no account — signing in with it makes a new one — and the once-only guard lets
it claim elsewhere. **The grants go with the link**: `hasPlus` and `hasStudio` are both
cleared, whoever set them (an operator's grant too — nothing on the row says which wrote
it), and the panel warns before the confirm; both reach the game on the next token. What the
account does keep is that it claimed: removing a link with roles recorded stamps
`hasClaimedDiscord` on the account, and the claim's "first link" check consults it, or
link → unlink → link would pay the one-time supporter gift on every cycle. The route is not gated on the Discord
configuration — the link is in the table whether or not the claim is still open.
The link also records the member's **roles** (`platform_account.role`, a JSON array of
role ids). The claim writes them from the member record it read; on their own they'd be
a snapshot from claim time, because the claim revokes the player's token the moment it's
+140 -1
View File
@@ -560,6 +560,16 @@ interface BenefitsStatus {
hasPlus: boolean
/** Whether a Discord identity is already tied to it. Which one is deliberately not served. */
linked: boolean
/**
* Whether ANY Discord is on the account — a claim's link or the bare one "Sign in with
* Discord" leaves. What the unlink button keys on; `linked` is only the claimed case.
*/
discordLinked: boolean
/**
* The unlink's one precondition: the account must have an email address, or taking the
* Discord off could leave nothing to recover it by. Served so the panel can say so first.
*/
hasEmail: boolean
}
/**
@@ -590,6 +600,14 @@ interface ClaimResult {
const claimBenefits = (code: string): Promise<ClaimResult> =>
call<ClaimResult>('/api/benefits/claim', { json: { code }, authed: true })
/**
* Take the Discord off the account. `www` refuses (403, with a sentence) unless the account
* has a password and an email — the panel checks the same two flags first so the button
* only shows when it can work. Answers the status as it now stands.
*/
const unlinkDiscord = (): Promise<BenefitsStatus> =>
call<BenefitsStatus>('/api/benefits/unlink', { json: {}, authed: true })
/**
* The per-attempt CSRF nonce for the Discord round-trip, in sessionStorage.
*
@@ -778,6 +796,7 @@ function BenefitsPanel({ account, config }: { account: SelfAccount; config: Site
// and tokens last a day and are never refreshed. Without this line the claim looks like
// it silently did nothing, which is the single most likely support question here.
const [relogin, setRelogin] = useState(false)
const [unlinking, setUnlinking] = useState(false)
// StrictMode runs effects twice in dev, and a Discord code is single-use: the second
// run would redeem a spent code and report a failure over a claim that just worked.
const redeemed = useRef(false)
@@ -818,7 +837,14 @@ function BenefitsPanel({ account, config }: { account: SelfAccount; config: Site
setPending(true)
claimBenefits(code)
.then((result) => {
setStatus({ hasPlus: result.hasPlus, linked: true })
setStatus((prev) => ({
hasPlus: result.hasPlus,
linked: true,
discordLinked: true,
// The claim says nothing about this; keep what the status read said, and assume
// none until it answers.
hasEmail: prev?.hasEmail ?? false,
}))
const who = result.discordUsername ? ` as ${result.discordUsername}` : ''
// Linked either way; whether Plus came with it depends on the roles. Without a
// qualifying role the roles are still saved for the game, and that is said
@@ -920,6 +946,60 @@ function BenefitsPanel({ account, config }: { account: SelfAccount; config: Site
Verify with Discord
</button>
)}
{status?.discordLinked && !pending && (
// Taking the Discord off again. Offered for ANY link — a claim's, or the bare one a
// Discord sign-in made — but only once the account can be recovered without it: an
// account made from Discord has no email until the player sets one, and `www`
// refuses the unlink until there is one. The panel says so rather than showing a
// button that would fail.
<div className="unlink">
<h3>Unlink Discord</h3>
{status.hasEmail ? (
<>
<p className="muted">
Removes your Discord from this account. Rec Room Plus and Rec Room Studio access
granted to this account are removed with it, your roles stop being read, and signing
in with that Discord afterwards will make a new account rather than open this one.
You can link again at any time.
</p>
<button
type="button"
className="linkish danger"
disabled={unlinking}
onClick={() => {
if (
!confirm(
'Unlink your Discord from this account? Rec Room Plus and Studio access on this account will be removed.'
)
)
return
setUnlinking(true)
setError('')
setDone('')
unlinkDiscord()
.then((next) => {
setStatus(next)
setRelogin(false)
setDone('Your Discord has been unlinked from this account.')
})
.catch((err: unknown) =>
setError(err instanceof Error ? err.message : String(err))
)
.finally(() => setUnlinking(false))
}}
>
{unlinking ? 'Unlinking…' : 'Unlink Discord'}
</button>
</>
) : (
<p className="hint">
Before you can unlink, add an email address to this account (the{' '}
<strong>Email</strong> tab), so the account can be recovered without Discord.
</p>
)}
</div>
)}
</section>
)
}
@@ -3133,6 +3213,7 @@ function PublicRoomView({
<>
{isDeveloper() && <StaffRoomTokens room={room} />}
<StaffListing room={room} onRoomChange={onRoomChange} />
<StaffClearInstances room={room} />
{isDeveloper() && <StaffTakedown room={room} onTakenDown={onTakenDown} />}
</>
)}
@@ -3271,6 +3352,64 @@ function StaffListing({
)
}
/**
* Delete every instance of the room, for one whose sessions are stuck. Two steps, like the
* dorm clear: nothing is lost for good, but anyone inside is cut off from their session.
*/
function StaffClearInstances({ room }: { room: OwnedRoom }) {
const [confirming, setConfirming] = useState(false)
const { pending, error, done, run } = useAction()
return (
<section className="card">
<h2>Instances</h2>
<p className="hint">
Deletes every instance of this room, including ones with players in them. The next player to
join gets a fresh instance.
</p>
<div className="mod-filter-actions">
{confirming ? (
<>
<button
type="submit"
disabled={pending}
onClick={() =>
void run(async () => {
const res = await call<{ deleted: number[] }>(
`/api/staff/rooms/${room.RoomId}/clear-instances`,
{ authed: true, method: 'POST' }
)
setConfirming(false)
const n = res.deleted.length
return n === 0
? `^${room.Name} had no instances.`
: `Cleared ${n} instance${n === 1 ? '' : 's'} of ^${room.Name}.`
})
}
>
{pending ? 'Clearing…' : 'Confirm clear instances'}
</button>
<button
type="button"
className="linkish"
disabled={pending}
onClick={() => setConfirming(false)}
>
Cancel
</button>
</>
) : (
<button type="submit" onClick={() => setConfirming(true)}>
Clear instances
</button>
)}
</div>
{error && <p className="error">{error}</p>}
{done && <p className="ok">{done}</p>}
</section>
)
}
function StaffTakedown({ room, onTakenDown }: { room: OwnedRoom; onTakenDown: () => void }) {
const [confirming, setConfirming] = useState(false)
const { pending, error, run } = useAction()
+27
View File
@@ -447,6 +447,33 @@ body {
border-color: #4752c4;
}
/* The way back out of the Discord link, at the foot of the benefits card: set apart by a
rule so it doesn't read as part of the claim, and the button in the error colour so it
reads as the undo it is. The hint beside it says what has to be set first. */
.unlink {
margin-top: 22px;
padding-top: 16px;
border-top: 1px solid var(--line);
}
.unlink h3 {
margin: 0 0 8px;
font-size: 1rem;
}
.linkish.danger {
color: var(--error);
}
.linkish.danger:hover {
color: var(--text);
}
.linkish.danger:disabled {
opacity: 0.6;
cursor: default;
}
/* Secondary action: same shape, outlined instead of filled. */
.cta.ghost {
background: transparent;
+23
View File
@@ -4,6 +4,7 @@ import {
clearDormSaveBlob,
clearPasswordHash,
createGift,
deleteRoomInstancesByRoom,
getAccount,
getImageById,
getOnlinePlayerIds,
@@ -1016,6 +1017,28 @@ export async function giftRoomTokensHandler(c: Context<App>) {
return c.json({ roomId, amount, paid, skipped })
}
/**
* Delete every instance of a room from `room_instance`, from the room's own page. For a
* room whose sessions have gone bad: the next player to matchmake in gets a fresh one.
* Clearing a room with no instances succeeds and deletes nothing.
*/
export async function clearRoomInstancesHandler(c: Context<App>) {
const roomId = Number(c.req.param('roomId'))
if (!Number.isInteger(roomId) || roomId <= 0) {
return c.json({ error: 'A numeric room id is required' }, 400)
}
const deleted = await deleteRoomInstancesByRoom(c.env.DB, roomId)
await recordPlayerAudit(c, 'clear_room_instances', { roomId, deleted })
logger.info('staff cleared room instances', {
moderatorId: staffId(c),
roomId,
deletedCount: deleted.length,
})
return c.json({ roomId, deleted })
}
/**
* Send tokens to EVERYONE ONLINE right now — the server-wide drop behind the account page's
* "Token drop" tab, beside the coach broadcast and the maintenance notice.
+179 -5
View File
@@ -22,7 +22,11 @@ import {
setPresence,
} from '@repo/domain/src/presence-db'
import { getProgression, PROGRESSION_SCHEMA_DDL } from '@repo/domain/src/progression-db'
import { ROOM_INSTANCE_SCHEMA_DDL } from '@repo/domain/src/room-instance-db'
import {
createRoomInstance,
getRoomInstancesByRoom,
ROOM_INSTANCE_SCHEMA_DDL,
} from '@repo/domain/src/room-instance-db'
// Banning a player moves them into their own dorm, which is a room (created on demand) with
// a subroom — so those tables have to be here, as they are on the shared database.
import { getOrCreateDormRoom, ROOM_SCHEMA_DDL, SUBROOM_SCHEMA_DDL } from '@repo/domain/src/rooms-db'
@@ -49,6 +53,7 @@ import {
linkPlatformIdentity,
PLATFORM_SCHEMA_DDL,
recordFirstRoles,
unlinkPlatform,
} from '../../../../auth/src/platform-db'
import {
BALANCE_SCHEMA_DDL,
@@ -679,25 +684,168 @@ it('reports where an account stands on benefits', async () => {
headers: { authorization: `Bearer ${token}` },
})
expect(res.status).toBe(200)
expect(await res.json()).toEqual({ hasPlus: false, linked: false })
// No email either: the unlink's one precondition, served alongside so the page can say
// so first. Nothing linked, so there is nothing to unlink yet.
expect(await res.json()).toEqual({
hasPlus: false,
linked: false,
discordLinked: false,
hasEmail: false,
})
// A bare link — what "Sign in with Discord" leaves on an account it just made — is NOT a
// claim: no roles were ever recorded, so the page must still offer the claim.
// claim: no roles were ever recorded, so the page must still offer the claim. It IS a
// Discord on the account, though, so `discordLinked` says so: the unlink is offered for
// it as much as for a claim's link.
await updateAccount(env.DB, 4003, { hasPlus: true })
await linkPlatformIdentity(env.DB, 4003, PlatformType.Discord, '99001')
res = await SELF.fetch('https://example.com/api/benefits/status', {
headers: { authorization: `Bearer ${token}` },
})
expect(await res.json()).toEqual({ hasPlus: true, linked: false })
expect(await res.json()).toEqual({
hasPlus: true,
linked: false,
discordLinked: true,
hasEmail: false,
})
// Claimed (roles recorded, even none). `linked` says THAT a Discord identity has claimed,
// never which one — the id is of no use to the page, and an account's linked identities
// have no business on the wire.
await updateAccount(env.DB, 4003, { email: 'p@example.com' })
await linkPlatformIdentity(env.DB, 4003, PlatformType.Discord, '99001', [])
res = await SELF.fetch('https://example.com/api/benefits/status', {
headers: { authorization: `Bearer ${token}` },
})
expect(await res.json()).toEqual({ hasPlus: true, linked: true })
expect(await res.json()).toEqual({
hasPlus: true,
linked: true,
discordLinked: true,
hasEmail: true,
})
})
// ---- Discord unlink --------------------------------------------------------
// Taking the Discord off an account. The link may be the only way in — an account made by
// "Sign in with Discord" has no email until the player sets one — so the unlink is refused
// until the account has an address to be recovered through, decided from the row and never
// from the page. A password is NOT required: a passwordless account sets one in game.
const unlink = (token: string) =>
SELF.fetch('https://example.com/api/benefits/unlink', {
method: 'POST',
headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },
body: '{}',
})
it('requires a valid session to unlink a discord', async () => {
expect((await unlink('')).status).toBe(401)
const forged = await generateToken('4020', '', 4, 'not-the-real-secret')
expect((await unlink(forged)).status).toBe(401)
})
it('refuses to unlink a discord until the account has an email address', async () => {
const token = await tokenFor(4021)
await linkPlatformIdentity(env.DB, 4021, PlatformType.Discord, '99021')
// No email — and a password doesn't stand in for one.
await updateAccount(env.DB, 4021, { passwordHash: 'salt:hash' })
const res = await unlink(token)
expect(res.status).toBe(403)
expect(await res.json()).toEqual({
error:
'Add an email address to your account before unlinking Discord, so the account can be recovered without it.',
})
// Refused means untouched: the link is still there.
await expect(isPlatformIdentityLinked(env.DB, 4021, PlatformType.Discord, '99021')).resolves.toBe(
true
)
// An email alone, no password, is enough.
await updateAccount(env.DB, 4021, { passwordHash: undefined, email: 'p@example.com' })
expect((await unlink(token)).status).toBe(200)
await expect(isPlatformIdentityLinked(env.DB, 4021, PlatformType.Discord, '99021')).resolves.toBe(
false
)
})
it('unlinks every discord on the account, and takes plus and studio with it', async () => {
const token = await tokenFor(4022)
await updateAccount(env.DB, 4022, {
username: 'Leaver',
email: 'p@example.com',
hasPlus: true,
hasStudio: true,
})
// A claimed link and (the once-only guard aside) a second identity, both Discord — and a
// Steam login that must survive: only the Discord goes.
await linkPlatformIdentity(env.DB, 4022, PlatformType.Discord, '99022', ['r1'])
await linkPlatformIdentity(env.DB, 4022, PlatformType.Discord, '99023')
await linkPlatformIdentity(env.DB, 4022, PlatformType.Steam, '76561000000000022')
const res = await unlink(token)
expect(res.status).toBe(200)
// The status as it now stands, in `/api/benefits/status`'s shape: the grants went with
// the link.
expect(await res.json()).toEqual({
hasPlus: false,
linked: false,
discordLinked: false,
hasEmail: true,
})
expect((await getLinksForAccount(env.DB, 4022)).map((l) => [l.platform, l.platformId])).toEqual([
[PlatformType.Steam, '76561000000000022'],
])
// The identity is free again: the once-only guard counts nobody holding it now.
await expect(
countAccountsForPlatformIdentity(env.DB, PlatformType.Discord, '99022')
).resolves.toBe(0)
// The account remembers it CLAIMED (a link with roles recorded was removed), so a re-link
// won't be a "first" one to the gift — see the test below. Plus and Studio are CLEARED —
// dropped from the blob, not written false — and the rest of the row is untouched.
const after = await getAccount(env.DB, 4022)
expect(after?.hasClaimedDiscord).toBe(true)
expect(after?.hasPlus).toBeUndefined()
expect(after?.hasStudio).toBeUndefined()
expect(after?.username).toBe('Leaver')
expect(after?.email).toBe('p@example.com')
// Nothing left to unlink.
const again = await unlink(token)
expect(again.status).toBe(404)
expect(await again.json()).toEqual({ error: 'No Discord account is linked to this account.' })
})
// Removing a BARE link (a Discord sign-in's, no roles recorded) is not a claim to remember:
// that player's first claim, on whatever account they next link, is still their first.
it('does not remember a claim when the unlinked discord never claimed', async () => {
const token = await tokenFor(4023)
await updateAccount(env.DB, 4023, { email: 'p@example.com' })
await linkPlatformIdentity(env.DB, 4023, PlatformType.Discord, '99024')
expect((await unlink(token)).status).toBe(200)
expect((await getAccount(env.DB, 4023))?.hasClaimedDiscord).toBeUndefined()
// But a claim that found NO roles is still a claim — `[]` is recorded, NULL is not — and
// `unlinkPlatform`'s parsed rows can't tell the two apart, which is why the route asks
// the raw column before it deletes.
await linkPlatformIdentity(env.DB, 4023, PlatformType.Discord, '99024', [])
expect((await unlink(token)).status).toBe(200)
expect((await getAccount(env.DB, 4023))?.hasClaimedDiscord).toBe(true)
})
// The helper itself: returns what it removed (so the caller knows what the rows carried),
// and an account with nothing on that platform yields an empty list and no write.
it('removes every link on one platform and returns them', async () => {
await linkPlatformIdentity(env.DB, 4024, PlatformType.Discord, '99025', ['r1', 'r2'])
await linkPlatformIdentity(env.DB, 4024, PlatformType.Steam, '76561000000000024')
await expect(unlinkPlatform(env.DB, 4024, PlatformType.Oculus)).resolves.toEqual([])
const removed = await unlinkPlatform(env.DB, 4024, PlatformType.Discord)
expect(removed.map((l) => [l.platformId, l.roles])).toEqual([['99025', ['r1', 'r2']]])
await expect(unlinkPlatform(env.DB, 4024, PlatformType.Discord)).resolves.toEqual([])
expect((await getLinksForAccount(env.DB, 4024)).map((l) => l.platform)).toEqual([
PlatformType.Steam,
])
})
// How the claim decides "first claim" now that a Discord link can predate it: a link made by
@@ -943,6 +1091,7 @@ it('refuses every staff endpoint without a token, and without a staff role', asy
'/api/staff/players/1/username-changes',
'/api/staff/players/1/clear-password',
'/api/staff/players/1/clear-dorm',
'/api/staff/rooms/1/clear-instances',
'/api/staff/studio-access',
'/api/staff/players/1/grant-plus',
]
@@ -2328,6 +2477,31 @@ it('clears a player’s dorm by publishing an empty save over the newest one', a
])
})
it('clears every instance of a room, for any staff member', async () => {
const make = (roomId: number, photonRoomId: string) =>
createRoomInstance(env.DB, { ownerAccountId: 8110, roomId, photonRoomId })
const a = await make(7740, 'clear-a')
const b = await make(7740, 'clear-b')
const other = await make(7741, 'clear-other')
// A moderator, not only a developer, may clear a room.
const res = await staffPost('/api/staff/rooms/7740/clear-instances', 8101, {})
expect(res.status).toBe(200)
const body = (await res.json()) as { roomId: number; deleted: number[] }
expect(body.roomId).toBe(7740)
expect(body.deleted.toSorted()).toEqual([a.roomInstanceId, b.roomInstanceId].toSorted())
expect(await getRoomInstancesByRoom(env.DB, 7740)).toEqual([])
// Another room's instances are untouched.
expect((await getRoomInstancesByRoom(env.DB, 7741)).map((i) => i.roomInstanceId)).toEqual([
other.roomInstanceId,
])
// Clearing an empty room succeeds and deletes nothing.
const again = await staffPost('/api/staff/rooms/7740/clear-instances', 8101, {})
expect(await again.json()).toEqual({ roomId: 7740, deleted: [] })
expect((await staffPost('/api/staff/rooms/abc/clear-instances', 8101, {})).status).toBe(400)
})
it('grants a player Plus, developers only', async () => {
await updateAccount(env.DB, 8330, { username: 'Plusless' })
const hasPlus = async () =>
+103 -3
View File
@@ -16,10 +16,12 @@ import { generateIdentityAssertion, validateAndGetAccountId } from '@repo/jwt'
// verify, and its picker lists only the platforms that can be (CACHED_LOGIN_PLATFORMS).
import {
countAccountsForPlatformIdentity,
getLinksForAccount,
hasRecordedRoles,
isPlatformIdentityLinked,
linkPlatformIdentity,
recordFirstRoles,
unlinkPlatform,
} from '../../auth/src/platform-db'
// The signup grant's default and the Discord supporter gift, both `econ`'s. The gift is
// econ's cron paid on demand: the first time an account links its Discord, the claim hands
@@ -49,6 +51,7 @@ import {
bansInForceHandler,
clearDormHandler,
clearPasswordHandler,
clearRoomInstancesHandler,
createReportHandler,
getReportHandler,
giftItemHandler,
@@ -463,9 +466,10 @@ const app = new Hono<App>()
.get('/api/benefits/status', async (c) => {
const accountId = await claimant(c)
if (accountId === null) return c.body(null, 401)
const [account, claimed] = await Promise.all([
const [account, claimed, links] = await Promise.all([
getAccount(c.env.DB, accountId),
hasRecordedRoles(c.env.DB, accountId, PlatformType.Discord),
getLinksForAccount(c.env.DB, accountId),
])
return c.json({
hasPlus: account?.hasPlus ?? false,
@@ -475,6 +479,93 @@ const app = new Hono<App>()
// bare link, which "Sign in with Discord" leaves on a new account, reads as not yet
// claimed: the page then offers the claim, which is what that player still has to do.
linked: claimed,
// Whether ANY Discord identity is on the account, claimed or bare — what the unlink
// button keys on, since a sign-in's bare link is as much a link to take off as a
// claim's. Still never WHICH one.
discordLinked: links.some((link) => link.platform === PlatformType.Discord),
// The unlink's one precondition (see `/api/benefits/unlink`), served beside the link
// so the page can say so before the button fails. The self DTO carries the address
// too; this is the server's own reading of the same row the unlink will decide from.
hasEmail: !!account?.email,
})
})
/**
* Take the account's Discord off it: every `PlatformType.Discord` link goes, whether a
* claim wrote it or "Sign in with Discord" did. Afterwards that Discord opens no account —
* signing in with it makes a NEW one — and the benefits claim's once-only guard lets it
* claim on another account.
*
* Refused unless the account has an EMAIL ADDRESS. The link may be the only way into the
* account: an account made by "Sign in with Discord" has no password and no email until
* the player sets them, and removing its link would leave nothing to recover the account
* by. An address is enough — it is what the account can be recovered through — so a
* password is NOT required: a player with an email and no password sets one in game, as
* any passwordless account does. Checked here, on the row, and not trusted from the page
* (which shows the same flag from `/api/benefits/status` so it can say so before anyone
* presses anything).
*
* The grants the link carried go with it. `hasPlus` and `hasStudio` are both cleared:
* the Discord roles are what the claim granted Plus for and what the Studio rollout reads,
* and a player taking the link off is giving that proof back — unlike a role that merely
* lapses, which the claim deliberately never revokes for. This clears an operator's
* grant too (`runx admin grant-plus`/`grant-studio` write the same flags, and nothing on
* the row says which wrote them); the page warns, and staff can re-grant. Both reach the
* game on the NEXT token, like every account flag.
*
* What it does NOT do is forget that the account has claimed. A link with roles recorded
* was a claim, and the first-link supporter gift keys on "never claimed before", read from
* the link table — which would read as never-linked once the row is gone. So a claimed
* link's removal stamps `hasClaimedDiscord` on the account, and the claim consults both;
* otherwise link → unlink → link would pay the one-time box on every cycle.
*
* Not gated on the Discord configuration: the link is in the table whether or not the
* operator still runs the claim, and a player can always take it off. Answers the same
* shape `/api/benefits/status` does, as the account now stands.
*/
.post('/api/benefits/unlink', async (c) => {
const accountId = await claimant(c)
if (accountId === null) return c.body(null, 401)
const account = await getAccount(c.env.DB, accountId)
if (!account?.email) {
return c.json(
{
error:
'Add an email address to your account before unlinking Discord, so the account can be recovered without it.',
},
403
)
}
// Whether what's being removed includes a CLAIM — a link with `role` recorded, even as
// `[]`. Asked of the raw column BEFORE the delete: the parsed `PlatformLink` reads a
// NULL role and an empty list both as `[]`, and only the column tells a sign-in's bare
// link from a claim that found no roles.
const claimed = await hasRecordedRoles(c.env.DB, accountId, PlatformType.Discord)
const removed = await unlinkPlatform(c.env.DB, accountId, PlatformType.Discord)
if (removed.length === 0) {
return c.json({ error: 'No Discord account is linked to this account.' }, 404)
}
// One write: remember the claim (when there was one), and take back what the link
// carried. `undefined` drops the key from the blob, which is how "no Plus" is spelled.
await updateAccount(c.env.DB, accountId, {
hasClaimedDiscord: claimed || account.hasClaimedDiscord === true ? true : undefined,
hasPlus: undefined,
hasStudio: undefined,
})
logger.info('unlinked a discord from an account', {
accountId,
links: removed.length,
claimed,
hadPlus: account.hasPlus === true,
hadStudio: account.hasStudio === true,
})
return c.json({
hasPlus: false,
linked: false,
discordLinked: false,
hasEmail: true,
})
})
@@ -506,7 +597,8 @@ const app = new Hono<App>()
* Nothing here ever REVOKES Plus: losing the Discord role later leaves the flag set.
* That's deliberate for now — a sweep would need a bot token to enumerate the guild,
* which this design specifically avoids — but it does mean the flag records "held the
* role once", not "holds it today".
* role once", not "holds it today". The player's own unlink (`/api/benefits/unlink`) is
* the one thing that takes it back.
*
* The FIRST time an account links a Discord, the claim also pays the supporter gift
* econ's cron would (`DISCORD_ROLE_TOKENS`, the amount for the best of the roles just
@@ -585,7 +677,13 @@ const app = new Hono<App>()
// DIFFERENT one the once-only guard doesn't stop) has claimed before. A link with NO
// roles has not: that is what "Sign in with Discord" leaves on an account it just made,
// and that player's first claim is still their first.
const firstClaim = !(await hasRecordedRoles(c.env.DB, accountId, PlatformType.Discord))
//
// AND from the account: an unlink removes a claimed link's row, and stamps
// `hasClaimedDiscord` on the account so the table reading as never-linked afterwards
// doesn't make the next link a "first" one. Both are asked; either says not-first.
const firstClaim =
(await getAccount(c.env.DB, accountId))?.hasClaimedDiscord !== true &&
!(await hasRecordedRoles(c.env.DB, accountId, PlatformType.Discord))
// On a link that already exists without roles, writing them is the claim's one-shot
// write — the single-winner guard a fresh link gets from its INSERT below. Asked only
// when the link is the caller's: on anyone else's it would be refused above.
@@ -716,6 +814,8 @@ const app = new Hono<App>()
.post('/api/staff/players/:id/gift-xp', requireDeveloper, giftXpHandler)
// Everyone standing in a room, across all of its instances.
.post('/api/staff/rooms/:roomId/gift-tokens', requireDeveloper, giftRoomTokensHandler)
// Delete every live instance of a room — for one whose sessions are stuck. All staff.
.post('/api/staff/rooms/:roomId/clear-instances', clearRoomInstancesHandler)
// The account page's token drop: the same gift to everyone online at once.
.post('/api/staff/online/gift-tokens', requireDeveloper, giftOnlineTokensHandler)
// Its sibling: the same gift to every account whose Discord link holds a role, offline
+19 -1
View File
@@ -168,7 +168,10 @@ export interface Account {
*
* So never read a Discord link as a precondition for Plus, and never revoke one because
* the other is missing: a manually granted account has `hasPlus` and no link at all, and
* that is a normal, supported state.
* that is a normal, supported state. The one thing that clears it besides an operator is
* the player UNLINKING their Discord (`www` `POST /api/benefits/unlink`), which clears
* this and `hasStudio` together — the player is handing back the proof — and does so
* whoever set them, since nothing on the row says which.
*
* Nothing reads this per request. `auth` stamps it into every token it mints as the
* `rn.plus` claim, and `econ` decides the CampusCard and the subscriber discount from
@@ -177,6 +180,21 @@ export interface Account {
* real: the website's claim page warns about it, and so does `grant-plus`.
*/
hasPlus?: boolean
/**
* Whether this account has EVER claimed its Discord benefits — had roles recorded on a
* `PlatformType.Discord` link by `www`'s `POST /api/benefits/claim` — even if that link is
* gone. Set only by the website's Discord UNLINK, when the link it removes carries roles:
* while the link exists the link table itself says so (`hasRecordedRoles`), and a link
* that never claimed has nothing to remember.
*
* What it protects is the first-link supporter gift. The claim pays that box the FIRST
* time an account links a Discord, deciding "first" from the link table — which, after an
* unlink, reads as if the account had never linked. Without this flag, link → unlink →
* link would pay the one-time gift on every cycle. Nothing else reads it: `hasPlus` stands
* on its own (above), and the once-only-per-Discord-user guard is the link table's.
* Absent/false means no claim remembered.
*/
hasClaimedDiscord?: boolean
/**
* Whether this account may upload from Rec Room Studio. The editor decides Full access
* by reading the token for a `role` claim of exactly `betastudio`, which `auth` stamps
+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-db'
export * from './player-settings-kv'
export * from './rooms-db'
export * from './room-instance-db'
export * from './room-comments-db'
-144
View File
@@ -1,144 +0,0 @@
/**
* 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)
}
/**
* The most a player's stored map may hold, in bytes of its JSON. The map is player-written
* and lives on the D1 every worker shares, so an uncapped one lets any account grow its row
* toward D1's ~2 MB row limit and, across enough accounts, fill the database. Real maps are
* tiny: the 15,134 imported from KV averaged ~2 KB (46 keys), and the largest was ~12 KB
* (182 keys) — this leaves about five times that.
*/
export const MAX_PLAYER_SETTINGS_BYTES = 64 * 1024
/** A write that would grow a player's map past {@link MAX_PLAYER_SETTINGS_BYTES}. */
export class PlayerSettingsTooLargeError extends Error {
constructor(
readonly accountId: number,
readonly bytes: number
) {
super(
`player ${accountId}'s settings would be ${bytes} bytes (limit ${MAX_PLAYER_SETTINGS_BYTES})`
)
this.name = 'PlayerSettingsTooLargeError'
}
}
function settingsBytes(settings: PlayerSettings): number {
return new TextEncoder().encode(JSON.stringify(settings)).byteLength
}
/**
* Store `settings` as the player's whole map, replacing whatever row they had. Throws
* {@link PlayerSettingsTooLargeError} when the map is over {@link MAX_PLAYER_SETTINGS_BYTES}.
*/
export async function writePlayerSettings(
db: D1Database,
accountId: number,
settings: PlayerSettings
): Promise<void> {
const bytes = settingsBytes(settings)
if (bytes > MAX_PLAYER_SETTINGS_BYTES) throw new PlayerSettingsTooLargeError(accountId, bytes)
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. Throws
* {@link PlayerSettingsTooLargeError} when `next` is over {@link MAX_PLAYER_SETTINGS_BYTES}.
*
* `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
@@ -0,0 +1,81 @@
/**
* 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 }
}
+19
View File
@@ -476,6 +476,25 @@ export async function deleteEmptyRoomInstances(
return results.map((r) => r.id)
}
/**
* Delete EVERY instance of a room, occupied or not — the staff "Clear instances" button
* for a room whose sessions are stuck. Presence is left alone: a player still in a
* deleted instance keeps their row until it expires or they move, and their next
* matchmake lands them in a fresh instance.
*
* Returns the ids deleted.
*/
export async function deleteRoomInstancesByRoom(db: D1Database, roomId: number): Promise<number[]> {
const { results } = await db
.prepare(
`DELETE FROM room_instance WHERE room_id = ?1
RETURNING json_extract(data, '$.roomInstanceId') AS id`
)
.bind(roomId)
.all<{ id: number }>()
return results.map((r) => r.id)
}
/**
* The oldest joinable public instance of a room (not private, not full, joins
* enabled, not already in progress, not set to `Ignore`) that is running `gameVersion`,
+38 -2
View File
@@ -292,6 +292,35 @@ export function roomRoles(room: Room): RoomRole[] {
}))
}
/**
* Whether a `Roles` entry records a role the account actually HOLDS, as opposed to one it has
* only been offered. An invite is an entry with `Role` {@link Role.None} and the offer on
* `InvitedRole`; it stays that way until the player accepts ({@link answerRoomRoleInvite})
* or declines (which drops the entry). Tolerates the raw blob shape — older rooms carry
* entries without a `Role` key, which read as None, and a malformed entry is not a role.
*/
function holdsRole(entry: unknown): boolean {
if (entry === null || typeof entry !== 'object') return false
return Number((entry as Partial<RoomRole>).Role ?? Role.None) !== Role.None
}
/**
* The room as SERVED, with pending invites dropped from its `Roles` — a shallow copy; the
* room passed in is untouched, so a caller can keep writing from it. Entries are kept in the
* blob's own shape (not normalised through {@link roomRoles}), so a room that had no
* pending invite serializes exactly as before. A room with no `Roles` array is returned as
* is.
*
* Apply this at the response boundary ONLY, never to a room that is about to be written
* back. Rooms are stored as whole blobs and every writer rewrites the blob from the loaded
* room, so dropping the pending entries any earlier would silently erase every open invite
* on the room's next unrelated edit (a renamed room, a new load screen).
*/
export function withConfirmedRoles<T extends Room>(room: T): T {
if (!Array.isArray(room.Roles)) return room
return { ...room, Roles: room.Roles.filter(holdsRole) }
}
/**
* The statements that bring `room_role` in line with a room's `Roles`: drop the room's rows,
* then insert each entry whole, as {@link roomRoles} reads it. Every entry is stored,
@@ -3317,6 +3346,13 @@ export async function countRoomsByCreator(db: D1Database, accountId: number): Pr
* room the player made. A room matching BOTH halves appears once — the roles half is an
* EXISTS, not a join.
*
* A PENDING invite is not a job. An invited account holds a `Roles` entry with `Role` 0 and
* the offer on `InvitedRole` until it answers, and that entry is indexed like any other —
* so without the `role <> 0` guard a room showed up in the player's "rooms you contribute
* to" (and, through `ownedby/me`, was considered for "rooms you own") the moment someone
* invited them, before they had accepted anything. Only a held role counts here; the offer
* reaches them as a `RoomCoOwnerInvited` message, not through this list.
*
* Roles live inside the room blob, so the roles half reads `room_role`, the trigger-kept
* index of them, rather than a `json_each` over every room's `$.Roles` (which scanned and
* parsed the whole table on every call). Both halves are index lookups, and SQLite runs
@@ -3328,9 +3364,9 @@ export async function getContributedRooms(db: D1Database, accountId: number): Pr
.prepare(
`SELECT ${ROOM_COLUMNS} FROM room
WHERE creator_account_id = ?1
OR room_id IN (SELECT room_id FROM room_role WHERE account_id = ?1)`
OR room_id IN (SELECT room_id FROM room_role WHERE account_id = ?1 AND role <> ?2)`
)
.bind(accountId)
.bind(accountId, Role.None)
.all<RoomRow>()
return (await hydrateRooms(db, parseAll(results))).filter((r) => r.IsDorm !== true)
}
-229
View File
@@ -32,7 +32,6 @@ 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]
*/
/**
@@ -405,233 +404,6 @@ 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: KV fills in what D1 lacks, and D1 wins any key it has
* moved off the seeded default. A key D1 still holds AT its default (`SEEDED_DEFAULTS`) does
* not count as the player's — `GET /playersettings` seeds those for any player with no row, so
* a player who signed in after the cut-over but before the import has a fresh row of
* defaults, and their KV progress (OOBE, tutorial mask) has to beat it. That makes the import
* safe to run after the cut-over and to re-run. `--overwrite` makes KV win outright instead.
* Nothing is deleted on either side.
*
* What it cannot recover is a KV write made after the import read the namespace, to a key the
* imported row already holds off-default: D1 keeps the imported value. So run it once before
* `just deploy` (the bulk) and once after (to catch anyone who changed something in between).
*/
/**
* What `GET /playersettings` seeds for a player with no row — mirror of `DEFAULT_SETTINGS` in
* apps/playersettings/src/default-settings.ts. A D1 value equal to one of these may be the
* seed rather than the player's, so the import lets KV replace it.
*/
const SEEDED_DEFAULTS: Record<string, string> = {
'Recroom.OOBE': '77',
TUTORIAL_COMPLETE_MASK: '11',
FIRST_TIME_IN_FLAGS: '0',
}
/**
* A KV value as a settings map, or null when it isn't one. Numbers and booleans are kept as
* their string form (what a PUT would have stored); a null, object or array value drops just
* that key rather than the player's whole map.
*/
function kvSettingsMap(value: string | null | undefined): Record<string, string> | null {
let parsed: unknown
try {
parsed = value == null ? null : JSON.parse(value)
} catch {
return null
}
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) return null
const map: Record<string, string> = {}
for (const [k, v] of Object.entries(parsed)) {
if (typeof v === 'string') map[k] = v
else if (typeof v === 'number' || typeof v === 'boolean') map[k] = String(v)
}
return map
}
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))
// `bulk get` answers `{ key: value }`, or `{ key: { value, metadata } }` with
// `--with-metadata`; read either.
let got: Record<string, string | { value: string | null } | 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 raw = got[key]
const map = kvSettingsMap(typeof raw === 'string' ? raw : raw?.value)
if (!Number.isSafeInteger(accountId) || accountId <= 0 || map === null) {
skipped.push(key)
continue
}
// An empty map is what a player with no row reads as; nothing to import.
if (Object.keys(map).length === 0) {
empty++
continue
}
rows.push({ accountId, data: JSON.stringify(map) })
}
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`))
// Merge: start from D1, lay KV over it, then lay back every D1 key that isn't sitting at
// its seeded default. (`json_group_object` of no rows is `{}`, which patches nothing.)
const d1OwnKeys = `(SELECT json_group_object(s.key, s.value) FROM json_each(player_settings.data) AS s WHERE NOT EXISTS (SELECT 1 FROM json_each('${sqlStr(JSON.stringify(SEEDED_DEFAULTS))}') AS d WHERE d.key = s.key AND d.value = s.value))`
const onConflict = opts.overwrite
? 'excluded.data'
: `json_patch(json_patch(player_settings.data, excluded.data), ${d1OwnKeys})`
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 unless still at a seeded default)')
)
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')
} catch (err) {
// A large remote `--file` goes through D1's import API, and wrangler can fail its
// final status poll with this after the import has already completed (it did, for
// all 15,137 rows, the first time this ran). Fall through to the check below, which
// decides whether the rows actually landed.
if (!(err instanceof Error && err.message.includes('Not currently importing anything'))) {
throw err
}
console.log(chalk.yellow(' wrangler lost track of the import; checking what landed'))
} 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()
// Chunked: one IN list of every id outgrows D1's statement limit (and argv) at ~15k players.
const ids = rows.map((r) => r.accountId)
let found = 0
for (let i = 0; i < ids.length; i += 1000) {
found += Number(
(
await execSql(
`SELECT COUNT(*) AS n FROM player_settings WHERE account_id IN (${ids.slice(i, i + 1000).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')
@@ -695,7 +467,6 @@ export const adminCmd = new Command('admin')
.addCommand(grantStudio)
.addCommand(reloadPlus)
.addCommand(caiLoad)
.addCommand(settingsImportKv)
.addCommand(lookup)
.addHelpText(
'after',