@cloudflare/workers-types 5.20261118.1 → 5.20261120.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.
- package/experimental/index.d.ts +125 -83
- package/experimental/index.ts +125 -83
- package/index.d.ts +124 -83
- package/index.ts +124 -83
- package/package.json +1 -1
package/experimental/index.d.ts
CHANGED
|
@@ -252,7 +252,6 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
252
252
|
): number;
|
|
253
253
|
clearInterval(timeoutId: number | null): void;
|
|
254
254
|
queueMicrotask(task: Function): void;
|
|
255
|
-
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
|
|
256
255
|
reportError(error: any): void;
|
|
257
256
|
fetch(
|
|
258
257
|
input: RequestInfo | URL,
|
|
@@ -284,8 +283,6 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
284
283
|
ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
|
|
285
284
|
CountQueuingStrategy: typeof CountQueuingStrategy;
|
|
286
285
|
ErrorEvent: typeof ErrorEvent;
|
|
287
|
-
MessageChannel: typeof MessageChannel;
|
|
288
|
-
MessagePort: typeof MessagePort;
|
|
289
286
|
FileSystemHandle: typeof FileSystemHandle;
|
|
290
287
|
FileSystemFileHandle: typeof FileSystemFileHandle;
|
|
291
288
|
FileSystemDirectoryHandle: typeof FileSystemDirectoryHandle;
|
|
@@ -336,6 +333,8 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
336
333
|
PerformanceResourceTiming: typeof PerformanceResourceTiming;
|
|
337
334
|
PerformanceObserver: typeof PerformanceObserver;
|
|
338
335
|
PerformanceObserverEntryList: typeof PerformanceObserverEntryList;
|
|
336
|
+
MessageChannel: typeof MessageChannel;
|
|
337
|
+
MessagePort: typeof MessagePort;
|
|
339
338
|
}
|
|
340
339
|
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
341
340
|
type: Type,
|
|
@@ -389,11 +388,6 @@ declare function setInterval<Args extends any[]>(
|
|
|
389
388
|
declare function clearInterval(timeoutId: number | null): void;
|
|
390
389
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */
|
|
391
390
|
declare function queueMicrotask(task: Function): void;
|
|
392
|
-
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
|
|
393
|
-
declare function structuredClone<T>(
|
|
394
|
-
value: T,
|
|
395
|
-
options?: StructuredSerializeOptions,
|
|
396
|
-
): T;
|
|
397
391
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */
|
|
398
392
|
declare function reportError(error: any): void;
|
|
399
393
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */
|
|
@@ -517,9 +511,6 @@ interface ExportedHandler<
|
|
|
517
511
|
email?: EmailExportedHandler<Env, Props>;
|
|
518
512
|
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
|
|
519
513
|
}
|
|
520
|
-
interface StructuredSerializeOptions {
|
|
521
|
-
transfer?: any[];
|
|
522
|
-
}
|
|
523
514
|
declare abstract class Navigator {
|
|
524
515
|
sendBeacon(url: string, body?: BodyInit): boolean;
|
|
525
516
|
readonly userAgent: string;
|
|
@@ -3663,6 +3654,7 @@ interface Socket {
|
|
|
3663
3654
|
close(): Promise<void>;
|
|
3664
3655
|
startTls(options?: TlsOptions): Socket;
|
|
3665
3656
|
proxyTo(sock: Socket, options?: StreamPipeOptions): Promise<void>;
|
|
3657
|
+
accept(): void;
|
|
3666
3658
|
}
|
|
3667
3659
|
interface SocketOptions {
|
|
3668
3660
|
secureTransport?: string;
|
|
@@ -4023,59 +4015,6 @@ interface FileSystemFileWriteParams {
|
|
|
4023
4015
|
interface FileSystemHandleRemoveOptions {
|
|
4024
4016
|
recursive?: boolean;
|
|
4025
4017
|
}
|
|
4026
|
-
/**
|
|
4027
|
-
* 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.
|
|
4028
|
-
*
|
|
4029
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
|
|
4030
|
-
*/
|
|
4031
|
-
declare abstract class MessagePort extends EventTarget {
|
|
4032
|
-
/**
|
|
4033
|
-
* The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
|
|
4034
|
-
*
|
|
4035
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
|
|
4036
|
-
*/
|
|
4037
|
-
postMessage(
|
|
4038
|
-
data?: any,
|
|
4039
|
-
options?: any[] | MessagePortPostMessageOptions,
|
|
4040
|
-
): void;
|
|
4041
|
-
/**
|
|
4042
|
-
* 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.
|
|
4043
|
-
*
|
|
4044
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
|
|
4045
|
-
*/
|
|
4046
|
-
close(): void;
|
|
4047
|
-
/**
|
|
4048
|
-
* 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.
|
|
4049
|
-
*
|
|
4050
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
|
|
4051
|
-
*/
|
|
4052
|
-
start(): void;
|
|
4053
|
-
get onmessage(): any | null;
|
|
4054
|
-
set onmessage(value: any | null);
|
|
4055
|
-
}
|
|
4056
|
-
/**
|
|
4057
|
-
* The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.
|
|
4058
|
-
*
|
|
4059
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
|
|
4060
|
-
*/
|
|
4061
|
-
declare class MessageChannel {
|
|
4062
|
-
constructor();
|
|
4063
|
-
/**
|
|
4064
|
-
* 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.
|
|
4065
|
-
*
|
|
4066
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
|
|
4067
|
-
*/
|
|
4068
|
-
readonly port1: MessagePort;
|
|
4069
|
-
/**
|
|
4070
|
-
* 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.
|
|
4071
|
-
*
|
|
4072
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
|
|
4073
|
-
*/
|
|
4074
|
-
readonly port2: MessagePort;
|
|
4075
|
-
}
|
|
4076
|
-
interface MessagePortPostMessageOptions {
|
|
4077
|
-
transfer?: any[];
|
|
4078
|
-
}
|
|
4079
4018
|
type LoopbackForExport<
|
|
4080
4019
|
T extends
|
|
4081
4020
|
| (new (...args: any[]) => Rpc.EntrypointBranded)
|
|
@@ -4560,6 +4499,11 @@ interface Tracing {
|
|
|
4560
4499
|
): T;
|
|
4561
4500
|
Span: typeof Span;
|
|
4562
4501
|
}
|
|
4502
|
+
interface TracingSpanLink {
|
|
4503
|
+
context: TracingSpanContext;
|
|
4504
|
+
attributes?: Record<string, boolean | number | string | undefined>;
|
|
4505
|
+
droppedAttributesCount?: number;
|
|
4506
|
+
}
|
|
4563
4507
|
declare abstract class Span {
|
|
4564
4508
|
get isTraced(): boolean;
|
|
4565
4509
|
spanContext(): TracingSpanContext;
|
|
@@ -4592,6 +4536,8 @@ declare abstract class Span {
|
|
|
4592
4536
|
updateName(name: string): this;
|
|
4593
4537
|
setStatus(status: TracingSpanStatus): this;
|
|
4594
4538
|
end(): void;
|
|
4539
|
+
addLink(link: TracingSpanLink): this;
|
|
4540
|
+
addLinks(links: readonly TracingSpanLink[]): this;
|
|
4595
4541
|
}
|
|
4596
4542
|
type TracingSpanStatusCode = "unset" | "ok" | "error";
|
|
4597
4543
|
interface TracingSpanStatus {
|
|
@@ -13547,21 +13493,31 @@ type BrowserRunScriptOptions = {
|
|
|
13547
13493
|
lab?: boolean;
|
|
13548
13494
|
/** Record the browser session. @default false */
|
|
13549
13495
|
recording?: boolean;
|
|
13496
|
+
/** Run the script on an alternate browser backend. Only the raw CDP client is
|
|
13497
|
+
* supported, and no session is kept open afterwards. Setting `library`,
|
|
13498
|
+
* `keepAlive`, `lab` or `recording` with it returns an HTTP 400 error
|
|
13499
|
+
* response.
|
|
13500
|
+
*/
|
|
13501
|
+
browser?: "kitesurf";
|
|
13550
13502
|
};
|
|
13551
|
-
/** Options for `
|
|
13503
|
+
/** Options for `script()` in an existing browser session. */
|
|
13552
13504
|
type BrowserRunScriptSessionOptions = {
|
|
13505
|
+
/** Session to run in, such as the `cf-browser-session-id` header returned by
|
|
13506
|
+
* `script()`. The session keeps the launch options it was acquired with.
|
|
13507
|
+
*/
|
|
13508
|
+
sessionId: string;
|
|
13509
|
+
/** Page target the script attaches to, such as the `cf-browser-target-id`
|
|
13510
|
+
* header returned by `script()`. Defaults to the session's first page.
|
|
13511
|
+
*/
|
|
13512
|
+
targetId?: string;
|
|
13553
13513
|
/** Library whose objects are passed to the script. Omit it for raw CDP. */
|
|
13554
13514
|
library?: BrowserRunScriptLibrary;
|
|
13555
13515
|
/** Maximum run time of the script in milliseconds. Between 1 and 120000.
|
|
13556
13516
|
* @default 60000
|
|
13557
13517
|
*/
|
|
13558
13518
|
timeout?: number;
|
|
13559
|
-
/** Page target the script attaches to, such as the `cf-browser-target-id`
|
|
13560
|
-
* header returned by `script()`. Defaults to the session's first page.
|
|
13561
|
-
*/
|
|
13562
|
-
targetId?: string;
|
|
13563
13519
|
};
|
|
13564
|
-
/** JSON success body of `script()
|
|
13520
|
+
/** JSON success body of `script()`. */
|
|
13565
13521
|
type BrowserRunScriptSuccessResponse = {
|
|
13566
13522
|
success: true;
|
|
13567
13523
|
/** The script's return value, or `null` when it returned nothing. */
|
|
@@ -13786,7 +13742,7 @@ declare abstract class BrowserRun {
|
|
|
13786
13742
|
* @param code - Source of an async function. It receives the selected
|
|
13787
13743
|
* library's objects (Playwright `{ page, context, browser }`, Puppeteer
|
|
13788
13744
|
* `{ page, browser }`) or, without `library`, a CDP client.
|
|
13789
|
-
* @param options - Library, timeout
|
|
13745
|
+
* @param options - Library, timeout, session launch and backend options.
|
|
13790
13746
|
* @returns A `Response` containing one of:
|
|
13791
13747
|
*
|
|
13792
13748
|
* **Success (HTTP 200):**
|
|
@@ -13796,26 +13752,28 @@ declare abstract class BrowserRun {
|
|
|
13796
13752
|
* non-JSON output
|
|
13797
13753
|
*
|
|
13798
13754
|
* **Error:**
|
|
13799
|
-
* - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 503)
|
|
13755
|
+
* - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 502, 503)
|
|
13800
13756
|
* - HTTP 408 when the script exceeds `timeout`
|
|
13801
13757
|
* - HTTP 422 when the script fails to compile or throws
|
|
13758
|
+
* - HTTP 502 when the script fails on the `browser: 'kitesurf'` backend
|
|
13802
13759
|
* - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
|
|
13803
13760
|
* throw before any request is made.
|
|
13804
13761
|
*
|
|
13805
|
-
* **Headers
|
|
13806
|
-
* - `cf-browser-session-id`: Session kept open for `
|
|
13762
|
+
* **Headers** (not returned with `browser: 'kitesurf'`):
|
|
13763
|
+
* - `cf-browser-session-id`: Session kept open for a later `script()` call
|
|
13764
|
+
* with `sessionId`
|
|
13807
13765
|
* - `cf-browser-target-id`: Page target the script ran on
|
|
13808
13766
|
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
|
|
13809
13767
|
*/
|
|
13810
13768
|
script(code: string, options?: BrowserRunScriptOptions): Promise<Response>;
|
|
13811
13769
|
/**
|
|
13812
13770
|
* Run a script against an existing browser session, such as one kept open by
|
|
13813
|
-
* `script()
|
|
13814
|
-
* @param
|
|
13815
|
-
*
|
|
13816
|
-
*
|
|
13817
|
-
*
|
|
13818
|
-
* @returns A `Response` with the same success bodies as
|
|
13771
|
+
* an earlier `script()` call.
|
|
13772
|
+
* @param code - Source of an async function, as for a new session.
|
|
13773
|
+
* @param options - The session to run in, plus page target, library and
|
|
13774
|
+
* timeout options. Launch options such as `keepAlive` cannot be set, because
|
|
13775
|
+
* the session keeps the ones it was acquired with.
|
|
13776
|
+
* @returns A `Response` with the same success bodies as a new-session run.
|
|
13819
13777
|
*
|
|
13820
13778
|
* **Error:**
|
|
13821
13779
|
* - JSON error body with an HTTP status code (400, 401, 404, 408, 410, 422, 500)
|
|
@@ -13827,10 +13785,9 @@ declare abstract class BrowserRun {
|
|
|
13827
13785
|
* **Headers:**
|
|
13828
13786
|
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
|
|
13829
13787
|
*/
|
|
13830
|
-
|
|
13831
|
-
sessionId: string,
|
|
13788
|
+
script(
|
|
13832
13789
|
code: string,
|
|
13833
|
-
options
|
|
13790
|
+
options: BrowserRunScriptSessionOptions,
|
|
13834
13791
|
): Promise<Response>;
|
|
13835
13792
|
/** DevTools JSON methods exposed through one nested binding target. */
|
|
13836
13793
|
get devtools(): BrowserRunDevtools;
|
|
@@ -16160,6 +16117,62 @@ interface MediaError extends Error {
|
|
|
16160
16117
|
readonly message: string;
|
|
16161
16118
|
readonly stack?: string;
|
|
16162
16119
|
}
|
|
16120
|
+
// MessageChannel and MessagePort, declared at every compatibility date. They
|
|
16121
|
+
// are globals under the expose_global_message_channel compatibility flag (the
|
|
16122
|
+
// default from 2025-08-15); node:worker_threads exports them at any date.
|
|
16123
|
+
/**
|
|
16124
|
+
* 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.
|
|
16125
|
+
*
|
|
16126
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
|
|
16127
|
+
*/
|
|
16128
|
+
declare abstract class MessagePort extends EventTarget {
|
|
16129
|
+
/**
|
|
16130
|
+
* The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
|
|
16131
|
+
*
|
|
16132
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
|
|
16133
|
+
*/
|
|
16134
|
+
postMessage(
|
|
16135
|
+
data?: any,
|
|
16136
|
+
options?: any[] | MessagePortPostMessageOptions,
|
|
16137
|
+
): void;
|
|
16138
|
+
/**
|
|
16139
|
+
* 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.
|
|
16140
|
+
*
|
|
16141
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
|
|
16142
|
+
*/
|
|
16143
|
+
close(): void;
|
|
16144
|
+
/**
|
|
16145
|
+
* 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.
|
|
16146
|
+
*
|
|
16147
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
|
|
16148
|
+
*/
|
|
16149
|
+
start(): void;
|
|
16150
|
+
get onmessage(): any | null;
|
|
16151
|
+
set onmessage(value: any | null);
|
|
16152
|
+
}
|
|
16153
|
+
/**
|
|
16154
|
+
* The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.
|
|
16155
|
+
*
|
|
16156
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
|
|
16157
|
+
*/
|
|
16158
|
+
declare class MessageChannel {
|
|
16159
|
+
constructor();
|
|
16160
|
+
/**
|
|
16161
|
+
* 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.
|
|
16162
|
+
*
|
|
16163
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
|
|
16164
|
+
*/
|
|
16165
|
+
readonly port1: MessagePort;
|
|
16166
|
+
/**
|
|
16167
|
+
* 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.
|
|
16168
|
+
*
|
|
16169
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
|
|
16170
|
+
*/
|
|
16171
|
+
readonly port2: MessagePort;
|
|
16172
|
+
}
|
|
16173
|
+
interface MessagePortPostMessageOptions {
|
|
16174
|
+
transfer?: any[];
|
|
16175
|
+
}
|
|
16163
16176
|
declare module "cloudflare:node" {
|
|
16164
16177
|
interface NodeStyleServer {
|
|
16165
16178
|
listen(...args: unknown[]): this;
|
|
@@ -17580,6 +17593,17 @@ interface AlreadyUploadedError extends StreamError {
|
|
|
17580
17593
|
interface TooManyWatermarksError extends StreamError {
|
|
17581
17594
|
name: "TooManyWatermarksError";
|
|
17582
17595
|
}
|
|
17596
|
+
interface StructuredSerializeOptions {
|
|
17597
|
+
transfer?: any[];
|
|
17598
|
+
}
|
|
17599
|
+
interface ServiceWorkerGlobalScope {
|
|
17600
|
+
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
|
|
17601
|
+
}
|
|
17602
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
|
|
17603
|
+
declare function structuredClone<T>(
|
|
17604
|
+
value: T,
|
|
17605
|
+
options?: StructuredSerializeOptions,
|
|
17606
|
+
): T;
|
|
17583
17607
|
type MarkdownDocument = {
|
|
17584
17608
|
name: string;
|
|
17585
17609
|
blob: Blob;
|
|
@@ -17807,6 +17831,22 @@ declare namespace TailStream {
|
|
|
17807
17831
|
readonly type: "spanUpdate";
|
|
17808
17832
|
readonly info: SpanUpdateInfo;
|
|
17809
17833
|
}
|
|
17834
|
+
/** A causal relationship to a span, including spans in another trace. */
|
|
17835
|
+
interface SpanLink {
|
|
17836
|
+
readonly context: {
|
|
17837
|
+
readonly traceId: string;
|
|
17838
|
+
readonly spanId: string;
|
|
17839
|
+
readonly traceFlags: number;
|
|
17840
|
+
};
|
|
17841
|
+
readonly attributes: readonly Attribute[];
|
|
17842
|
+
/** Attributes dropped before this link was recorded. */
|
|
17843
|
+
readonly droppedAttributesCount: number;
|
|
17844
|
+
}
|
|
17845
|
+
/** Links added to the receiver identified by the event's spanContext. */
|
|
17846
|
+
interface SpanLinks {
|
|
17847
|
+
readonly type: "spanLinks";
|
|
17848
|
+
readonly links: readonly SpanLink[];
|
|
17849
|
+
}
|
|
17810
17850
|
interface DiagnosticChannelEvent {
|
|
17811
17851
|
readonly type: "diagnosticChannel";
|
|
17812
17852
|
readonly channel: string;
|
|
@@ -17877,6 +17917,7 @@ declare namespace TailStream {
|
|
|
17877
17917
|
| SpanOpen
|
|
17878
17918
|
| SpanClose
|
|
17879
17919
|
| SpanUpdate
|
|
17920
|
+
| SpanLinks
|
|
17880
17921
|
| DiagnosticChannelEvent
|
|
17881
17922
|
| Exception
|
|
17882
17923
|
| Log
|
|
@@ -17920,6 +17961,7 @@ declare namespace TailStream {
|
|
|
17920
17961
|
spanOpen?: TailEventHandler<SpanOpen>;
|
|
17921
17962
|
spanClose?: TailEventHandler<SpanClose>;
|
|
17922
17963
|
spanUpdate?: TailEventHandler<SpanUpdate>;
|
|
17964
|
+
spanLinks?: TailEventHandler<SpanLinks>;
|
|
17923
17965
|
diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;
|
|
17924
17966
|
exception?: TailEventHandler<Exception>;
|
|
17925
17967
|
log?: TailEventHandler<Log>;
|