@cloudflare/workers-types 5.20261113.1 → 5.20261115.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,60 +15,6 @@ and limitations under the License.
15
15
  /* eslint-disable */
16
16
  // noinspection JSUnusedGlobalSymbols
17
17
  declare var onmessage: never;
18
- /**
19
- * 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.
20
- *
21
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
22
- */
23
- declare class DOMException extends Error {
24
- constructor(message?: string, name?: string);
25
- /**
26
- * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
27
- *
28
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
29
- */
30
- readonly message: string;
31
- /**
32
- * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
33
- *
34
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
35
- */
36
- readonly name: string;
37
- /**
38
- * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
39
- * @deprecated
40
- *
41
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
42
- */
43
- readonly code: number;
44
- static readonly INDEX_SIZE_ERR: number;
45
- static readonly DOMSTRING_SIZE_ERR: number;
46
- static readonly HIERARCHY_REQUEST_ERR: number;
47
- static readonly WRONG_DOCUMENT_ERR: number;
48
- static readonly INVALID_CHARACTER_ERR: number;
49
- static readonly NO_DATA_ALLOWED_ERR: number;
50
- static readonly NO_MODIFICATION_ALLOWED_ERR: number;
51
- static readonly NOT_FOUND_ERR: number;
52
- static readonly NOT_SUPPORTED_ERR: number;
53
- static readonly INUSE_ATTRIBUTE_ERR: number;
54
- static readonly INVALID_STATE_ERR: number;
55
- static readonly SYNTAX_ERR: number;
56
- static readonly INVALID_MODIFICATION_ERR: number;
57
- static readonly NAMESPACE_ERR: number;
58
- static readonly INVALID_ACCESS_ERR: number;
59
- static readonly VALIDATION_ERR: number;
60
- static readonly TYPE_MISMATCH_ERR: number;
61
- static readonly SECURITY_ERR: number;
62
- static readonly NETWORK_ERR: number;
63
- static readonly ABORT_ERR: number;
64
- static readonly URL_MISMATCH_ERR: number;
65
- static readonly QUOTA_EXCEEDED_ERR: number;
66
- static readonly TIMEOUT_ERR: number;
67
- static readonly INVALID_NODE_TYPE_ERR: number;
68
- static readonly DATA_CLONE_ERR: number;
69
- get stack(): any;
70
- set stack(value: any);
71
- }
72
18
  type WorkerGlobalScopeEventMap = {
73
19
  fetch: FetchEvent;
74
20
  scheduled: ScheduledEvent;
@@ -13570,6 +13516,49 @@ type BrowserRunDevtools = {
13570
13516
  type BrowserRunCloseSessionResult = {
13571
13517
  status: "closing" | "closed";
13572
13518
  };
13519
+ /** Library the script runs against. Omit it to receive a raw CDP client. */
13520
+ type BrowserRunScriptLibrary = "playwright" | "puppeteer";
13521
+ /** Options for `script()`. */
13522
+ type BrowserRunScriptOptions = {
13523
+ /** Library whose objects are passed to the script. Omit it for raw CDP. */
13524
+ library?: BrowserRunScriptLibrary;
13525
+ /** Maximum run time of the script in milliseconds, not counting browser
13526
+ * acquisition. Between 1 and 120000.
13527
+ * @default 60000
13528
+ */
13529
+ timeout?: number;
13530
+ /** How long the session stays open without activity after the run, in
13531
+ * milliseconds. Between 10000 and 1200000.
13532
+ * @default 60000
13533
+ */
13534
+ keepAlive?: number;
13535
+ /** Use the experimental pool, whose browsers enable Chrome features before
13536
+ * they reach stable Chrome.
13537
+ * @default false
13538
+ */
13539
+ lab?: boolean;
13540
+ /** Record the browser session. @default false */
13541
+ recording?: boolean;
13542
+ };
13543
+ /** Options for `scriptInSession()`. */
13544
+ type BrowserRunScriptSessionOptions = {
13545
+ /** Library whose objects are passed to the script. Omit it for raw CDP. */
13546
+ library?: BrowserRunScriptLibrary;
13547
+ /** Maximum run time of the script in milliseconds. Between 1 and 120000.
13548
+ * @default 60000
13549
+ */
13550
+ timeout?: number;
13551
+ /** Page target the script attaches to, such as the `cf-browser-target-id`
13552
+ * header returned by `script()`. Defaults to the session's first page.
13553
+ */
13554
+ targetId?: string;
13555
+ };
13556
+ /** JSON success body of `script()` and `scriptInSession()`. */
13557
+ type BrowserRunScriptSuccessResponse = {
13558
+ success: true;
13559
+ /** The script's return value, or `null` when it returned nothing. */
13560
+ result: unknown;
13561
+ };
13573
13562
  /**
13574
13563
  * Browser Run API binding for automating headless browsers.
13575
13564
  * @see https://developers.cloudflare.com/browser-run/
@@ -13784,6 +13773,57 @@ declare abstract class BrowserRun {
13784
13773
  getSession(sessionId: string): Promise<BrowserRunSession | null>;
13785
13774
  /** Close a browser session. */
13786
13775
  closeSession(sessionId: string): Promise<BrowserRunCloseSessionResult>;
13776
+ /**
13777
+ * Run a script against a new browser session.
13778
+ * @param code - Source of an async function. It receives the selected
13779
+ * library's objects (Playwright `{ page, context, browser }`, Puppeteer
13780
+ * `{ page, browser }`) or, without `library`, a CDP client.
13781
+ * @param options - Library, timeout and session launch options.
13782
+ * @returns A `Response` containing one of:
13783
+ *
13784
+ * **Success (HTTP 200):**
13785
+ * - `BrowserRunScriptSuccessResponse` JSON with `Content-Type: application/json`
13786
+ * when the script returns a JSON-serializable value or nothing
13787
+ * - The raw body and content type when the script returns binary or other
13788
+ * non-JSON output
13789
+ *
13790
+ * **Error:**
13791
+ * - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 503)
13792
+ * - HTTP 408 when the script exceeds `timeout`
13793
+ * - HTTP 422 when the script fails to compile or throws
13794
+ * - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
13795
+ * throw before any request is made.
13796
+ *
13797
+ * **Headers:**
13798
+ * - `cf-browser-session-id`: Session kept open for `scriptInSession()`
13799
+ * - `cf-browser-target-id`: Page target the script ran on
13800
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
13801
+ */
13802
+ script(code: string, options?: BrowserRunScriptOptions): Promise<Response>;
13803
+ /**
13804
+ * Run a script against an existing browser session, such as one kept open by
13805
+ * `script()`.
13806
+ * @param sessionId - Session to run in, such as the `cf-browser-session-id`
13807
+ * header returned by `script()`.
13808
+ * @param code - Source of an async function, as for `script()`.
13809
+ * @param options - Library, timeout and page target options.
13810
+ * @returns A `Response` with the same success bodies as `script()`.
13811
+ *
13812
+ * **Error:**
13813
+ * - JSON error body with an HTTP status code (400, 401, 404, 408, 410, 422, 500)
13814
+ * - HTTP 404 when the session or `targetId` does not exist
13815
+ * - HTTP 410 when the session is already closed
13816
+ * - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
13817
+ * throw before any request is made.
13818
+ *
13819
+ * **Headers:**
13820
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
13821
+ */
13822
+ scriptInSession(
13823
+ sessionId: string,
13824
+ code: string,
13825
+ options?: BrowserRunScriptSessionOptions,
13826
+ ): Promise<Response>;
13787
13827
  /** DevTools JSON methods exposed through one nested binding target. */
13788
13828
  get devtools(): BrowserRunDevtools;
13789
13829
  }
@@ -15100,6 +15140,60 @@ declare abstract class D1PreparedStatement {
15100
15140
  // TypeScript's interface merging will ensure our empty interface is effectively
15101
15141
  // ignored when `Disposable` is included in the standard lib.
15102
15142
  interface Disposable {}
15143
+ /**
15144
+ * 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.
15145
+ *
15146
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
15147
+ */
15148
+ declare class DOMException extends Error {
15149
+ constructor(message?: string, name?: string);
15150
+ /**
15151
+ * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
15152
+ *
15153
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
15154
+ */
15155
+ readonly message: string;
15156
+ /**
15157
+ * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
15158
+ *
15159
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
15160
+ */
15161
+ readonly name: string;
15162
+ /**
15163
+ * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
15164
+ * @deprecated
15165
+ *
15166
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
15167
+ */
15168
+ readonly code: number;
15169
+ static readonly INDEX_SIZE_ERR: number;
15170
+ static readonly DOMSTRING_SIZE_ERR: number;
15171
+ static readonly HIERARCHY_REQUEST_ERR: number;
15172
+ static readonly WRONG_DOCUMENT_ERR: number;
15173
+ static readonly INVALID_CHARACTER_ERR: number;
15174
+ static readonly NO_DATA_ALLOWED_ERR: number;
15175
+ static readonly NO_MODIFICATION_ALLOWED_ERR: number;
15176
+ static readonly NOT_FOUND_ERR: number;
15177
+ static readonly NOT_SUPPORTED_ERR: number;
15178
+ static readonly INUSE_ATTRIBUTE_ERR: number;
15179
+ static readonly INVALID_STATE_ERR: number;
15180
+ static readonly SYNTAX_ERR: number;
15181
+ static readonly INVALID_MODIFICATION_ERR: number;
15182
+ static readonly NAMESPACE_ERR: number;
15183
+ static readonly INVALID_ACCESS_ERR: number;
15184
+ static readonly VALIDATION_ERR: number;
15185
+ static readonly TYPE_MISMATCH_ERR: number;
15186
+ static readonly SECURITY_ERR: number;
15187
+ static readonly NETWORK_ERR: number;
15188
+ static readonly ABORT_ERR: number;
15189
+ static readonly URL_MISMATCH_ERR: number;
15190
+ static readonly QUOTA_EXCEEDED_ERR: number;
15191
+ static readonly TIMEOUT_ERR: number;
15192
+ static readonly INVALID_NODE_TYPE_ERR: number;
15193
+ static readonly DATA_CLONE_ERR: number;
15194
+ get stack(): any;
15195
+ set stack(value: any);
15196
+ }
15103
15197
  declare module "cloudflare:durable-objects" {
15104
15198
  /**
15105
15199
  * Marks Durable Object methods as safe to run more than once. The runtime may then retry calls
@@ -15,60 +15,6 @@ and limitations under the License.
15
15
  /* eslint-disable */
16
16
  // noinspection JSUnusedGlobalSymbols
17
17
  export declare var onmessage: never;
18
- /**
19
- * 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.
20
- *
21
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
22
- */
23
- export declare class DOMException extends Error {
24
- constructor(message?: string, name?: string);
25
- /**
26
- * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
27
- *
28
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
29
- */
30
- readonly message: string;
31
- /**
32
- * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
33
- *
34
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
35
- */
36
- readonly name: string;
37
- /**
38
- * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
39
- * @deprecated
40
- *
41
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
42
- */
43
- readonly code: number;
44
- static readonly INDEX_SIZE_ERR: number;
45
- static readonly DOMSTRING_SIZE_ERR: number;
46
- static readonly HIERARCHY_REQUEST_ERR: number;
47
- static readonly WRONG_DOCUMENT_ERR: number;
48
- static readonly INVALID_CHARACTER_ERR: number;
49
- static readonly NO_DATA_ALLOWED_ERR: number;
50
- static readonly NO_MODIFICATION_ALLOWED_ERR: number;
51
- static readonly NOT_FOUND_ERR: number;
52
- static readonly NOT_SUPPORTED_ERR: number;
53
- static readonly INUSE_ATTRIBUTE_ERR: number;
54
- static readonly INVALID_STATE_ERR: number;
55
- static readonly SYNTAX_ERR: number;
56
- static readonly INVALID_MODIFICATION_ERR: number;
57
- static readonly NAMESPACE_ERR: number;
58
- static readonly INVALID_ACCESS_ERR: number;
59
- static readonly VALIDATION_ERR: number;
60
- static readonly TYPE_MISMATCH_ERR: number;
61
- static readonly SECURITY_ERR: number;
62
- static readonly NETWORK_ERR: number;
63
- static readonly ABORT_ERR: number;
64
- static readonly URL_MISMATCH_ERR: number;
65
- static readonly QUOTA_EXCEEDED_ERR: number;
66
- static readonly TIMEOUT_ERR: number;
67
- static readonly INVALID_NODE_TYPE_ERR: number;
68
- static readonly DATA_CLONE_ERR: number;
69
- get stack(): any;
70
- set stack(value: any);
71
- }
72
18
  export type WorkerGlobalScopeEventMap = {
73
19
  fetch: FetchEvent;
74
20
  scheduled: ScheduledEvent;
@@ -13585,6 +13531,49 @@ export type BrowserRunDevtools = {
13585
13531
  export type BrowserRunCloseSessionResult = {
13586
13532
  status: "closing" | "closed";
13587
13533
  };
13534
+ /** Library the script runs against. Omit it to receive a raw CDP client. */
13535
+ export type BrowserRunScriptLibrary = "playwright" | "puppeteer";
13536
+ /** Options for `script()`. */
13537
+ export type BrowserRunScriptOptions = {
13538
+ /** Library whose objects are passed to the script. Omit it for raw CDP. */
13539
+ library?: BrowserRunScriptLibrary;
13540
+ /** Maximum run time of the script in milliseconds, not counting browser
13541
+ * acquisition. Between 1 and 120000.
13542
+ * @default 60000
13543
+ */
13544
+ timeout?: number;
13545
+ /** How long the session stays open without activity after the run, in
13546
+ * milliseconds. Between 10000 and 1200000.
13547
+ * @default 60000
13548
+ */
13549
+ keepAlive?: number;
13550
+ /** Use the experimental pool, whose browsers enable Chrome features before
13551
+ * they reach stable Chrome.
13552
+ * @default false
13553
+ */
13554
+ lab?: boolean;
13555
+ /** Record the browser session. @default false */
13556
+ recording?: boolean;
13557
+ };
13558
+ /** Options for `scriptInSession()`. */
13559
+ export type BrowserRunScriptSessionOptions = {
13560
+ /** Library whose objects are passed to the script. Omit it for raw CDP. */
13561
+ library?: BrowserRunScriptLibrary;
13562
+ /** Maximum run time of the script in milliseconds. Between 1 and 120000.
13563
+ * @default 60000
13564
+ */
13565
+ timeout?: number;
13566
+ /** Page target the script attaches to, such as the `cf-browser-target-id`
13567
+ * header returned by `script()`. Defaults to the session's first page.
13568
+ */
13569
+ targetId?: string;
13570
+ };
13571
+ /** JSON success body of `script()` and `scriptInSession()`. */
13572
+ export type BrowserRunScriptSuccessResponse = {
13573
+ success: true;
13574
+ /** The script's return value, or `null` when it returned nothing. */
13575
+ result: unknown;
13576
+ };
13588
13577
  /**
13589
13578
  * Browser Run API binding for automating headless browsers.
13590
13579
  * @see https://developers.cloudflare.com/browser-run/
@@ -13799,6 +13788,57 @@ export declare abstract class BrowserRun {
13799
13788
  getSession(sessionId: string): Promise<BrowserRunSession | null>;
13800
13789
  /** Close a browser session. */
13801
13790
  closeSession(sessionId: string): Promise<BrowserRunCloseSessionResult>;
13791
+ /**
13792
+ * Run a script against a new browser session.
13793
+ * @param code - Source of an async function. It receives the selected
13794
+ * library's objects (Playwright `{ page, context, browser }`, Puppeteer
13795
+ * `{ page, browser }`) or, without `library`, a CDP client.
13796
+ * @param options - Library, timeout and session launch options.
13797
+ * @returns A `Response` containing one of:
13798
+ *
13799
+ * **Success (HTTP 200):**
13800
+ * - `BrowserRunScriptSuccessResponse` JSON with `Content-Type: application/json`
13801
+ * when the script returns a JSON-serializable value or nothing
13802
+ * - The raw body and content type when the script returns binary or other
13803
+ * non-JSON output
13804
+ *
13805
+ * **Error:**
13806
+ * - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 503)
13807
+ * - HTTP 408 when the script exceeds `timeout`
13808
+ * - HTTP 422 when the script fails to compile or throws
13809
+ * - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
13810
+ * throw before any request is made.
13811
+ *
13812
+ * **Headers:**
13813
+ * - `cf-browser-session-id`: Session kept open for `scriptInSession()`
13814
+ * - `cf-browser-target-id`: Page target the script ran on
13815
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
13816
+ */
13817
+ script(code: string, options?: BrowserRunScriptOptions): Promise<Response>;
13818
+ /**
13819
+ * Run a script against an existing browser session, such as one kept open by
13820
+ * `script()`.
13821
+ * @param sessionId - Session to run in, such as the `cf-browser-session-id`
13822
+ * header returned by `script()`.
13823
+ * @param code - Source of an async function, as for `script()`.
13824
+ * @param options - Library, timeout and page target options.
13825
+ * @returns A `Response` with the same success bodies as `script()`.
13826
+ *
13827
+ * **Error:**
13828
+ * - JSON error body with an HTTP status code (400, 401, 404, 408, 410, 422, 500)
13829
+ * - HTTP 404 when the session or `targetId` does not exist
13830
+ * - HTTP 410 when the session is already closed
13831
+ * - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
13832
+ * throw before any request is made.
13833
+ *
13834
+ * **Headers:**
13835
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
13836
+ */
13837
+ scriptInSession(
13838
+ sessionId: string,
13839
+ code: string,
13840
+ options?: BrowserRunScriptSessionOptions,
13841
+ ): Promise<Response>;
13802
13842
  /** DevTools JSON methods exposed through one nested binding target. */
13803
13843
  get devtools(): BrowserRunDevtools;
13804
13844
  }
@@ -15122,6 +15162,60 @@ export declare abstract class D1PreparedStatement {
15122
15162
  // TypeScript's interface merging will ensure our empty interface is effectively
15123
15163
  // ignored when `Disposable` is included in the standard lib.
15124
15164
  export interface Disposable {}
15165
+ /**
15166
+ * 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.
15167
+ *
15168
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
15169
+ */
15170
+ export declare class DOMException extends Error {
15171
+ constructor(message?: string, name?: string);
15172
+ /**
15173
+ * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
15174
+ *
15175
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
15176
+ */
15177
+ readonly message: string;
15178
+ /**
15179
+ * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
15180
+ *
15181
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
15182
+ */
15183
+ readonly name: string;
15184
+ /**
15185
+ * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
15186
+ * @deprecated
15187
+ *
15188
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
15189
+ */
15190
+ readonly code: number;
15191
+ static readonly INDEX_SIZE_ERR: number;
15192
+ static readonly DOMSTRING_SIZE_ERR: number;
15193
+ static readonly HIERARCHY_REQUEST_ERR: number;
15194
+ static readonly WRONG_DOCUMENT_ERR: number;
15195
+ static readonly INVALID_CHARACTER_ERR: number;
15196
+ static readonly NO_DATA_ALLOWED_ERR: number;
15197
+ static readonly NO_MODIFICATION_ALLOWED_ERR: number;
15198
+ static readonly NOT_FOUND_ERR: number;
15199
+ static readonly NOT_SUPPORTED_ERR: number;
15200
+ static readonly INUSE_ATTRIBUTE_ERR: number;
15201
+ static readonly INVALID_STATE_ERR: number;
15202
+ static readonly SYNTAX_ERR: number;
15203
+ static readonly INVALID_MODIFICATION_ERR: number;
15204
+ static readonly NAMESPACE_ERR: number;
15205
+ static readonly INVALID_ACCESS_ERR: number;
15206
+ static readonly VALIDATION_ERR: number;
15207
+ static readonly TYPE_MISMATCH_ERR: number;
15208
+ static readonly SECURITY_ERR: number;
15209
+ static readonly NETWORK_ERR: number;
15210
+ static readonly ABORT_ERR: number;
15211
+ static readonly URL_MISMATCH_ERR: number;
15212
+ static readonly QUOTA_EXCEEDED_ERR: number;
15213
+ static readonly TIMEOUT_ERR: number;
15214
+ static readonly INVALID_NODE_TYPE_ERR: number;
15215
+ static readonly DATA_CLONE_ERR: number;
15216
+ get stack(): any;
15217
+ set stack(value: any);
15218
+ }
15125
15219
  /**
15126
15220
  * The returned data after sending an email
15127
15221
  */
package/index.d.ts CHANGED
@@ -15,60 +15,6 @@ and limitations under the License.
15
15
  /* eslint-disable */
16
16
  // noinspection JSUnusedGlobalSymbols
17
17
  declare var onmessage: never;
18
- /**
19
- * 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.
20
- *
21
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
22
- */
23
- declare class DOMException extends Error {
24
- constructor(message?: string, name?: string);
25
- /**
26
- * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
27
- *
28
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
29
- */
30
- readonly message: string;
31
- /**
32
- * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
33
- *
34
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
35
- */
36
- readonly name: string;
37
- /**
38
- * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
39
- * @deprecated
40
- *
41
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
42
- */
43
- readonly code: number;
44
- static readonly INDEX_SIZE_ERR: number;
45
- static readonly DOMSTRING_SIZE_ERR: number;
46
- static readonly HIERARCHY_REQUEST_ERR: number;
47
- static readonly WRONG_DOCUMENT_ERR: number;
48
- static readonly INVALID_CHARACTER_ERR: number;
49
- static readonly NO_DATA_ALLOWED_ERR: number;
50
- static readonly NO_MODIFICATION_ALLOWED_ERR: number;
51
- static readonly NOT_FOUND_ERR: number;
52
- static readonly NOT_SUPPORTED_ERR: number;
53
- static readonly INUSE_ATTRIBUTE_ERR: number;
54
- static readonly INVALID_STATE_ERR: number;
55
- static readonly SYNTAX_ERR: number;
56
- static readonly INVALID_MODIFICATION_ERR: number;
57
- static readonly NAMESPACE_ERR: number;
58
- static readonly INVALID_ACCESS_ERR: number;
59
- static readonly VALIDATION_ERR: number;
60
- static readonly TYPE_MISMATCH_ERR: number;
61
- static readonly SECURITY_ERR: number;
62
- static readonly NETWORK_ERR: number;
63
- static readonly ABORT_ERR: number;
64
- static readonly URL_MISMATCH_ERR: number;
65
- static readonly QUOTA_EXCEEDED_ERR: number;
66
- static readonly TIMEOUT_ERR: number;
67
- static readonly INVALID_NODE_TYPE_ERR: number;
68
- static readonly DATA_CLONE_ERR: number;
69
- get stack(): any;
70
- set stack(value: any);
71
- }
72
18
  type WorkerGlobalScopeEventMap = {
73
19
  fetch: FetchEvent;
74
20
  scheduled: ScheduledEvent;
@@ -13203,6 +13149,49 @@ type BrowserRunDevtools = {
13203
13149
  type BrowserRunCloseSessionResult = {
13204
13150
  status: "closing" | "closed";
13205
13151
  };
13152
+ /** Library the script runs against. Omit it to receive a raw CDP client. */
13153
+ type BrowserRunScriptLibrary = "playwright" | "puppeteer";
13154
+ /** Options for `script()`. */
13155
+ type BrowserRunScriptOptions = {
13156
+ /** Library whose objects are passed to the script. Omit it for raw CDP. */
13157
+ library?: BrowserRunScriptLibrary;
13158
+ /** Maximum run time of the script in milliseconds, not counting browser
13159
+ * acquisition. Between 1 and 120000.
13160
+ * @default 60000
13161
+ */
13162
+ timeout?: number;
13163
+ /** How long the session stays open without activity after the run, in
13164
+ * milliseconds. Between 10000 and 1200000.
13165
+ * @default 60000
13166
+ */
13167
+ keepAlive?: number;
13168
+ /** Use the experimental pool, whose browsers enable Chrome features before
13169
+ * they reach stable Chrome.
13170
+ * @default false
13171
+ */
13172
+ lab?: boolean;
13173
+ /** Record the browser session. @default false */
13174
+ recording?: boolean;
13175
+ };
13176
+ /** Options for `scriptInSession()`. */
13177
+ type BrowserRunScriptSessionOptions = {
13178
+ /** Library whose objects are passed to the script. Omit it for raw CDP. */
13179
+ library?: BrowserRunScriptLibrary;
13180
+ /** Maximum run time of the script in milliseconds. Between 1 and 120000.
13181
+ * @default 60000
13182
+ */
13183
+ timeout?: number;
13184
+ /** Page target the script attaches to, such as the `cf-browser-target-id`
13185
+ * header returned by `script()`. Defaults to the session's first page.
13186
+ */
13187
+ targetId?: string;
13188
+ };
13189
+ /** JSON success body of `script()` and `scriptInSession()`. */
13190
+ type BrowserRunScriptSuccessResponse = {
13191
+ success: true;
13192
+ /** The script's return value, or `null` when it returned nothing. */
13193
+ result: unknown;
13194
+ };
13206
13195
  /**
13207
13196
  * Browser Run API binding for automating headless browsers.
13208
13197
  * @see https://developers.cloudflare.com/browser-run/
@@ -13417,6 +13406,57 @@ declare abstract class BrowserRun {
13417
13406
  getSession(sessionId: string): Promise<BrowserRunSession | null>;
13418
13407
  /** Close a browser session. */
13419
13408
  closeSession(sessionId: string): Promise<BrowserRunCloseSessionResult>;
13409
+ /**
13410
+ * Run a script against a new browser session.
13411
+ * @param code - Source of an async function. It receives the selected
13412
+ * library's objects (Playwright `{ page, context, browser }`, Puppeteer
13413
+ * `{ page, browser }`) or, without `library`, a CDP client.
13414
+ * @param options - Library, timeout and session launch options.
13415
+ * @returns A `Response` containing one of:
13416
+ *
13417
+ * **Success (HTTP 200):**
13418
+ * - `BrowserRunScriptSuccessResponse` JSON with `Content-Type: application/json`
13419
+ * when the script returns a JSON-serializable value or nothing
13420
+ * - The raw body and content type when the script returns binary or other
13421
+ * non-JSON output
13422
+ *
13423
+ * **Error:**
13424
+ * - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 503)
13425
+ * - HTTP 408 when the script exceeds `timeout`
13426
+ * - HTTP 422 when the script fails to compile or throws
13427
+ * - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
13428
+ * throw before any request is made.
13429
+ *
13430
+ * **Headers:**
13431
+ * - `cf-browser-session-id`: Session kept open for `scriptInSession()`
13432
+ * - `cf-browser-target-id`: Page target the script ran on
13433
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
13434
+ */
13435
+ script(code: string, options?: BrowserRunScriptOptions): Promise<Response>;
13436
+ /**
13437
+ * Run a script against an existing browser session, such as one kept open by
13438
+ * `script()`.
13439
+ * @param sessionId - Session to run in, such as the `cf-browser-session-id`
13440
+ * header returned by `script()`.
13441
+ * @param code - Source of an async function, as for `script()`.
13442
+ * @param options - Library, timeout and page target options.
13443
+ * @returns A `Response` with the same success bodies as `script()`.
13444
+ *
13445
+ * **Error:**
13446
+ * - JSON error body with an HTTP status code (400, 401, 404, 408, 410, 422, 500)
13447
+ * - HTTP 404 when the session or `targetId` does not exist
13448
+ * - HTTP 410 when the session is already closed
13449
+ * - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
13450
+ * throw before any request is made.
13451
+ *
13452
+ * **Headers:**
13453
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
13454
+ */
13455
+ scriptInSession(
13456
+ sessionId: string,
13457
+ code: string,
13458
+ options?: BrowserRunScriptSessionOptions,
13459
+ ): Promise<Response>;
13420
13460
  /** DevTools JSON methods exposed through one nested binding target. */
13421
13461
  get devtools(): BrowserRunDevtools;
13422
13462
  }
@@ -14733,6 +14773,60 @@ declare abstract class D1PreparedStatement {
14733
14773
  // TypeScript's interface merging will ensure our empty interface is effectively
14734
14774
  // ignored when `Disposable` is included in the standard lib.
14735
14775
  interface Disposable {}
14776
+ /**
14777
+ * 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.
14778
+ *
14779
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
14780
+ */
14781
+ declare class DOMException extends Error {
14782
+ constructor(message?: string, name?: string);
14783
+ /**
14784
+ * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
14785
+ *
14786
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
14787
+ */
14788
+ readonly message: string;
14789
+ /**
14790
+ * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
14791
+ *
14792
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
14793
+ */
14794
+ readonly name: string;
14795
+ /**
14796
+ * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
14797
+ * @deprecated
14798
+ *
14799
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
14800
+ */
14801
+ readonly code: number;
14802
+ static readonly INDEX_SIZE_ERR: number;
14803
+ static readonly DOMSTRING_SIZE_ERR: number;
14804
+ static readonly HIERARCHY_REQUEST_ERR: number;
14805
+ static readonly WRONG_DOCUMENT_ERR: number;
14806
+ static readonly INVALID_CHARACTER_ERR: number;
14807
+ static readonly NO_DATA_ALLOWED_ERR: number;
14808
+ static readonly NO_MODIFICATION_ALLOWED_ERR: number;
14809
+ static readonly NOT_FOUND_ERR: number;
14810
+ static readonly NOT_SUPPORTED_ERR: number;
14811
+ static readonly INUSE_ATTRIBUTE_ERR: number;
14812
+ static readonly INVALID_STATE_ERR: number;
14813
+ static readonly SYNTAX_ERR: number;
14814
+ static readonly INVALID_MODIFICATION_ERR: number;
14815
+ static readonly NAMESPACE_ERR: number;
14816
+ static readonly INVALID_ACCESS_ERR: number;
14817
+ static readonly VALIDATION_ERR: number;
14818
+ static readonly TYPE_MISMATCH_ERR: number;
14819
+ static readonly SECURITY_ERR: number;
14820
+ static readonly NETWORK_ERR: number;
14821
+ static readonly ABORT_ERR: number;
14822
+ static readonly URL_MISMATCH_ERR: number;
14823
+ static readonly QUOTA_EXCEEDED_ERR: number;
14824
+ static readonly TIMEOUT_ERR: number;
14825
+ static readonly INVALID_NODE_TYPE_ERR: number;
14826
+ static readonly DATA_CLONE_ERR: number;
14827
+ get stack(): any;
14828
+ set stack(value: any);
14829
+ }
14736
14830
  declare module "cloudflare:durable-objects" {
14737
14831
  /**
14738
14832
  * Marks Durable Object methods as safe to run more than once. The runtime may then retry calls
package/index.ts CHANGED
@@ -15,60 +15,6 @@ and limitations under the License.
15
15
  /* eslint-disable */
16
16
  // noinspection JSUnusedGlobalSymbols
17
17
  export declare var onmessage: never;
18
- /**
19
- * 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.
20
- *
21
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
22
- */
23
- export declare class DOMException extends Error {
24
- constructor(message?: string, name?: string);
25
- /**
26
- * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
27
- *
28
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
29
- */
30
- readonly message: string;
31
- /**
32
- * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
33
- *
34
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
35
- */
36
- readonly name: string;
37
- /**
38
- * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
39
- * @deprecated
40
- *
41
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
42
- */
43
- readonly code: number;
44
- static readonly INDEX_SIZE_ERR: number;
45
- static readonly DOMSTRING_SIZE_ERR: number;
46
- static readonly HIERARCHY_REQUEST_ERR: number;
47
- static readonly WRONG_DOCUMENT_ERR: number;
48
- static readonly INVALID_CHARACTER_ERR: number;
49
- static readonly NO_DATA_ALLOWED_ERR: number;
50
- static readonly NO_MODIFICATION_ALLOWED_ERR: number;
51
- static readonly NOT_FOUND_ERR: number;
52
- static readonly NOT_SUPPORTED_ERR: number;
53
- static readonly INUSE_ATTRIBUTE_ERR: number;
54
- static readonly INVALID_STATE_ERR: number;
55
- static readonly SYNTAX_ERR: number;
56
- static readonly INVALID_MODIFICATION_ERR: number;
57
- static readonly NAMESPACE_ERR: number;
58
- static readonly INVALID_ACCESS_ERR: number;
59
- static readonly VALIDATION_ERR: number;
60
- static readonly TYPE_MISMATCH_ERR: number;
61
- static readonly SECURITY_ERR: number;
62
- static readonly NETWORK_ERR: number;
63
- static readonly ABORT_ERR: number;
64
- static readonly URL_MISMATCH_ERR: number;
65
- static readonly QUOTA_EXCEEDED_ERR: number;
66
- static readonly TIMEOUT_ERR: number;
67
- static readonly INVALID_NODE_TYPE_ERR: number;
68
- static readonly DATA_CLONE_ERR: number;
69
- get stack(): any;
70
- set stack(value: any);
71
- }
72
18
  export type WorkerGlobalScopeEventMap = {
73
19
  fetch: FetchEvent;
74
20
  scheduled: ScheduledEvent;
@@ -13221,6 +13167,49 @@ export type BrowserRunDevtools = {
13221
13167
  export type BrowserRunCloseSessionResult = {
13222
13168
  status: "closing" | "closed";
13223
13169
  };
13170
+ /** Library the script runs against. Omit it to receive a raw CDP client. */
13171
+ export type BrowserRunScriptLibrary = "playwright" | "puppeteer";
13172
+ /** Options for `script()`. */
13173
+ export type BrowserRunScriptOptions = {
13174
+ /** Library whose objects are passed to the script. Omit it for raw CDP. */
13175
+ library?: BrowserRunScriptLibrary;
13176
+ /** Maximum run time of the script in milliseconds, not counting browser
13177
+ * acquisition. Between 1 and 120000.
13178
+ * @default 60000
13179
+ */
13180
+ timeout?: number;
13181
+ /** How long the session stays open without activity after the run, in
13182
+ * milliseconds. Between 10000 and 1200000.
13183
+ * @default 60000
13184
+ */
13185
+ keepAlive?: number;
13186
+ /** Use the experimental pool, whose browsers enable Chrome features before
13187
+ * they reach stable Chrome.
13188
+ * @default false
13189
+ */
13190
+ lab?: boolean;
13191
+ /** Record the browser session. @default false */
13192
+ recording?: boolean;
13193
+ };
13194
+ /** Options for `scriptInSession()`. */
13195
+ export type BrowserRunScriptSessionOptions = {
13196
+ /** Library whose objects are passed to the script. Omit it for raw CDP. */
13197
+ library?: BrowserRunScriptLibrary;
13198
+ /** Maximum run time of the script in milliseconds. Between 1 and 120000.
13199
+ * @default 60000
13200
+ */
13201
+ timeout?: number;
13202
+ /** Page target the script attaches to, such as the `cf-browser-target-id`
13203
+ * header returned by `script()`. Defaults to the session's first page.
13204
+ */
13205
+ targetId?: string;
13206
+ };
13207
+ /** JSON success body of `script()` and `scriptInSession()`. */
13208
+ export type BrowserRunScriptSuccessResponse = {
13209
+ success: true;
13210
+ /** The script's return value, or `null` when it returned nothing. */
13211
+ result: unknown;
13212
+ };
13224
13213
  /**
13225
13214
  * Browser Run API binding for automating headless browsers.
13226
13215
  * @see https://developers.cloudflare.com/browser-run/
@@ -13435,6 +13424,57 @@ export declare abstract class BrowserRun {
13435
13424
  getSession(sessionId: string): Promise<BrowserRunSession | null>;
13436
13425
  /** Close a browser session. */
13437
13426
  closeSession(sessionId: string): Promise<BrowserRunCloseSessionResult>;
13427
+ /**
13428
+ * Run a script against a new browser session.
13429
+ * @param code - Source of an async function. It receives the selected
13430
+ * library's objects (Playwright `{ page, context, browser }`, Puppeteer
13431
+ * `{ page, browser }`) or, without `library`, a CDP client.
13432
+ * @param options - Library, timeout and session launch options.
13433
+ * @returns A `Response` containing one of:
13434
+ *
13435
+ * **Success (HTTP 200):**
13436
+ * - `BrowserRunScriptSuccessResponse` JSON with `Content-Type: application/json`
13437
+ * when the script returns a JSON-serializable value or nothing
13438
+ * - The raw body and content type when the script returns binary or other
13439
+ * non-JSON output
13440
+ *
13441
+ * **Error:**
13442
+ * - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 503)
13443
+ * - HTTP 408 when the script exceeds `timeout`
13444
+ * - HTTP 422 when the script fails to compile or throws
13445
+ * - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
13446
+ * throw before any request is made.
13447
+ *
13448
+ * **Headers:**
13449
+ * - `cf-browser-session-id`: Session kept open for `scriptInSession()`
13450
+ * - `cf-browser-target-id`: Page target the script ran on
13451
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
13452
+ */
13453
+ script(code: string, options?: BrowserRunScriptOptions): Promise<Response>;
13454
+ /**
13455
+ * Run a script against an existing browser session, such as one kept open by
13456
+ * `script()`.
13457
+ * @param sessionId - Session to run in, such as the `cf-browser-session-id`
13458
+ * header returned by `script()`.
13459
+ * @param code - Source of an async function, as for `script()`.
13460
+ * @param options - Library, timeout and page target options.
13461
+ * @returns A `Response` with the same success bodies as `script()`.
13462
+ *
13463
+ * **Error:**
13464
+ * - JSON error body with an HTTP status code (400, 401, 404, 408, 410, 422, 500)
13465
+ * - HTTP 404 when the session or `targetId` does not exist
13466
+ * - HTTP 410 when the session is already closed
13467
+ * - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
13468
+ * throw before any request is made.
13469
+ *
13470
+ * **Headers:**
13471
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
13472
+ */
13473
+ scriptInSession(
13474
+ sessionId: string,
13475
+ code: string,
13476
+ options?: BrowserRunScriptSessionOptions,
13477
+ ): Promise<Response>;
13438
13478
  /** DevTools JSON methods exposed through one nested binding target. */
13439
13479
  get devtools(): BrowserRunDevtools;
13440
13480
  }
@@ -14758,6 +14798,60 @@ export declare abstract class D1PreparedStatement {
14758
14798
  // TypeScript's interface merging will ensure our empty interface is effectively
14759
14799
  // ignored when `Disposable` is included in the standard lib.
14760
14800
  export interface Disposable {}
14801
+ /**
14802
+ * 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.
14803
+ *
14804
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
14805
+ */
14806
+ export declare class DOMException extends Error {
14807
+ constructor(message?: string, name?: string);
14808
+ /**
14809
+ * The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
14810
+ *
14811
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
14812
+ */
14813
+ readonly message: string;
14814
+ /**
14815
+ * The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
14816
+ *
14817
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
14818
+ */
14819
+ readonly name: string;
14820
+ /**
14821
+ * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
14822
+ * @deprecated
14823
+ *
14824
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
14825
+ */
14826
+ readonly code: number;
14827
+ static readonly INDEX_SIZE_ERR: number;
14828
+ static readonly DOMSTRING_SIZE_ERR: number;
14829
+ static readonly HIERARCHY_REQUEST_ERR: number;
14830
+ static readonly WRONG_DOCUMENT_ERR: number;
14831
+ static readonly INVALID_CHARACTER_ERR: number;
14832
+ static readonly NO_DATA_ALLOWED_ERR: number;
14833
+ static readonly NO_MODIFICATION_ALLOWED_ERR: number;
14834
+ static readonly NOT_FOUND_ERR: number;
14835
+ static readonly NOT_SUPPORTED_ERR: number;
14836
+ static readonly INUSE_ATTRIBUTE_ERR: number;
14837
+ static readonly INVALID_STATE_ERR: number;
14838
+ static readonly SYNTAX_ERR: number;
14839
+ static readonly INVALID_MODIFICATION_ERR: number;
14840
+ static readonly NAMESPACE_ERR: number;
14841
+ static readonly INVALID_ACCESS_ERR: number;
14842
+ static readonly VALIDATION_ERR: number;
14843
+ static readonly TYPE_MISMATCH_ERR: number;
14844
+ static readonly SECURITY_ERR: number;
14845
+ static readonly NETWORK_ERR: number;
14846
+ static readonly ABORT_ERR: number;
14847
+ static readonly URL_MISMATCH_ERR: number;
14848
+ static readonly QUOTA_EXCEEDED_ERR: number;
14849
+ static readonly TIMEOUT_ERR: number;
14850
+ static readonly INVALID_NODE_TYPE_ERR: number;
14851
+ static readonly DATA_CLONE_ERR: number;
14852
+ get stack(): any;
14853
+ set stack(value: any);
14854
+ }
14761
14855
  /**
14762
14856
  * The returned data after sending an email
14763
14857
  */
package/package.json CHANGED
@@ -7,5 +7,5 @@
7
7
  },
8
8
  "author": "Cloudflare Workers DevProd Team <workers-devprod@cloudflare.com> (https://workers.cloudflare.com)",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "5.20261113.1"
10
+ "version": "5.20261115.1"
11
11
  }