@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.ts
CHANGED
|
@@ -252,7 +252,6 @@ export 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 @@ export 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 @@ export 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
|
export declare function addEventListener<
|
|
341
340
|
Type extends keyof WorkerGlobalScopeEventMap,
|
|
@@ -391,11 +390,6 @@ export declare function setInterval<Args extends any[]>(
|
|
|
391
390
|
export declare function clearInterval(timeoutId: number | null): void;
|
|
392
391
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */
|
|
393
392
|
export declare function queueMicrotask(task: Function): void;
|
|
394
|
-
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
|
|
395
|
-
export declare function structuredClone<T>(
|
|
396
|
-
value: T,
|
|
397
|
-
options?: StructuredSerializeOptions,
|
|
398
|
-
): T;
|
|
399
393
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */
|
|
400
394
|
export declare function reportError(error: any): void;
|
|
401
395
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */
|
|
@@ -519,9 +513,6 @@ export interface ExportedHandler<
|
|
|
519
513
|
email?: EmailExportedHandler<Env, Props>;
|
|
520
514
|
queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;
|
|
521
515
|
}
|
|
522
|
-
export interface StructuredSerializeOptions {
|
|
523
|
-
transfer?: any[];
|
|
524
|
-
}
|
|
525
516
|
export declare abstract class Navigator {
|
|
526
517
|
sendBeacon(url: string, body?: BodyInit): boolean;
|
|
527
518
|
readonly userAgent: string;
|
|
@@ -3669,6 +3660,7 @@ export interface Socket {
|
|
|
3669
3660
|
close(): Promise<void>;
|
|
3670
3661
|
startTls(options?: TlsOptions): Socket;
|
|
3671
3662
|
proxyTo(sock: Socket, options?: StreamPipeOptions): Promise<void>;
|
|
3663
|
+
accept(): void;
|
|
3672
3664
|
}
|
|
3673
3665
|
export interface SocketOptions {
|
|
3674
3666
|
secureTransport?: string;
|
|
@@ -4029,59 +4021,6 @@ export interface FileSystemFileWriteParams {
|
|
|
4029
4021
|
export interface FileSystemHandleRemoveOptions {
|
|
4030
4022
|
recursive?: boolean;
|
|
4031
4023
|
}
|
|
4032
|
-
/**
|
|
4033
|
-
* 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.
|
|
4034
|
-
*
|
|
4035
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
|
|
4036
|
-
*/
|
|
4037
|
-
export declare abstract class MessagePort extends EventTarget {
|
|
4038
|
-
/**
|
|
4039
|
-
* The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
|
|
4040
|
-
*
|
|
4041
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
|
|
4042
|
-
*/
|
|
4043
|
-
postMessage(
|
|
4044
|
-
data?: any,
|
|
4045
|
-
options?: any[] | MessagePortPostMessageOptions,
|
|
4046
|
-
): void;
|
|
4047
|
-
/**
|
|
4048
|
-
* 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.
|
|
4049
|
-
*
|
|
4050
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
|
|
4051
|
-
*/
|
|
4052
|
-
close(): void;
|
|
4053
|
-
/**
|
|
4054
|
-
* 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.
|
|
4055
|
-
*
|
|
4056
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
|
|
4057
|
-
*/
|
|
4058
|
-
start(): void;
|
|
4059
|
-
get onmessage(): any | null;
|
|
4060
|
-
set onmessage(value: any | null);
|
|
4061
|
-
}
|
|
4062
|
-
/**
|
|
4063
|
-
* 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.
|
|
4064
|
-
*
|
|
4065
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
|
|
4066
|
-
*/
|
|
4067
|
-
export declare class MessageChannel {
|
|
4068
|
-
constructor();
|
|
4069
|
-
/**
|
|
4070
|
-
* 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.
|
|
4071
|
-
*
|
|
4072
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
|
|
4073
|
-
*/
|
|
4074
|
-
readonly port1: MessagePort;
|
|
4075
|
-
/**
|
|
4076
|
-
* 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.
|
|
4077
|
-
*
|
|
4078
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
|
|
4079
|
-
*/
|
|
4080
|
-
readonly port2: MessagePort;
|
|
4081
|
-
}
|
|
4082
|
-
export interface MessagePortPostMessageOptions {
|
|
4083
|
-
transfer?: any[];
|
|
4084
|
-
}
|
|
4085
4024
|
export type LoopbackForExport<
|
|
4086
4025
|
T extends
|
|
4087
4026
|
| (new (...args: any[]) => Rpc.EntrypointBranded)
|
|
@@ -4566,6 +4505,11 @@ export interface Tracing {
|
|
|
4566
4505
|
): T;
|
|
4567
4506
|
Span: typeof Span;
|
|
4568
4507
|
}
|
|
4508
|
+
export interface TracingSpanLink {
|
|
4509
|
+
context: TracingSpanContext;
|
|
4510
|
+
attributes?: Record<string, boolean | number | string | undefined>;
|
|
4511
|
+
droppedAttributesCount?: number;
|
|
4512
|
+
}
|
|
4569
4513
|
export declare abstract class Span {
|
|
4570
4514
|
get isTraced(): boolean;
|
|
4571
4515
|
spanContext(): TracingSpanContext;
|
|
@@ -4598,6 +4542,8 @@ export declare abstract class Span {
|
|
|
4598
4542
|
updateName(name: string): this;
|
|
4599
4543
|
setStatus(status: TracingSpanStatus): this;
|
|
4600
4544
|
end(): void;
|
|
4545
|
+
addLink(link: TracingSpanLink): this;
|
|
4546
|
+
addLinks(links: readonly TracingSpanLink[]): this;
|
|
4601
4547
|
}
|
|
4602
4548
|
export type TracingSpanStatusCode = "unset" | "ok" | "error";
|
|
4603
4549
|
export interface TracingSpanStatus {
|
|
@@ -13562,21 +13508,31 @@ export type BrowserRunScriptOptions = {
|
|
|
13562
13508
|
lab?: boolean;
|
|
13563
13509
|
/** Record the browser session. @default false */
|
|
13564
13510
|
recording?: boolean;
|
|
13511
|
+
/** Run the script on an alternate browser backend. Only the raw CDP client is
|
|
13512
|
+
* supported, and no session is kept open afterwards. Setting `library`,
|
|
13513
|
+
* `keepAlive`, `lab` or `recording` with it returns an HTTP 400 error
|
|
13514
|
+
* response.
|
|
13515
|
+
*/
|
|
13516
|
+
browser?: "kitesurf";
|
|
13565
13517
|
};
|
|
13566
|
-
/** Options for `
|
|
13518
|
+
/** Options for `script()` in an existing browser session. */
|
|
13567
13519
|
export type BrowserRunScriptSessionOptions = {
|
|
13520
|
+
/** Session to run in, such as the `cf-browser-session-id` header returned by
|
|
13521
|
+
* `script()`. The session keeps the launch options it was acquired with.
|
|
13522
|
+
*/
|
|
13523
|
+
sessionId: string;
|
|
13524
|
+
/** Page target the script attaches to, such as the `cf-browser-target-id`
|
|
13525
|
+
* header returned by `script()`. Defaults to the session's first page.
|
|
13526
|
+
*/
|
|
13527
|
+
targetId?: string;
|
|
13568
13528
|
/** Library whose objects are passed to the script. Omit it for raw CDP. */
|
|
13569
13529
|
library?: BrowserRunScriptLibrary;
|
|
13570
13530
|
/** Maximum run time of the script in milliseconds. Between 1 and 120000.
|
|
13571
13531
|
* @default 60000
|
|
13572
13532
|
*/
|
|
13573
13533
|
timeout?: number;
|
|
13574
|
-
/** Page target the script attaches to, such as the `cf-browser-target-id`
|
|
13575
|
-
* header returned by `script()`. Defaults to the session's first page.
|
|
13576
|
-
*/
|
|
13577
|
-
targetId?: string;
|
|
13578
13534
|
};
|
|
13579
|
-
/** JSON success body of `script()
|
|
13535
|
+
/** JSON success body of `script()`. */
|
|
13580
13536
|
export type BrowserRunScriptSuccessResponse = {
|
|
13581
13537
|
success: true;
|
|
13582
13538
|
/** The script's return value, or `null` when it returned nothing. */
|
|
@@ -13801,7 +13757,7 @@ export declare abstract class BrowserRun {
|
|
|
13801
13757
|
* @param code - Source of an async function. It receives the selected
|
|
13802
13758
|
* library's objects (Playwright `{ page, context, browser }`, Puppeteer
|
|
13803
13759
|
* `{ page, browser }`) or, without `library`, a CDP client.
|
|
13804
|
-
* @param options - Library, timeout
|
|
13760
|
+
* @param options - Library, timeout, session launch and backend options.
|
|
13805
13761
|
* @returns A `Response` containing one of:
|
|
13806
13762
|
*
|
|
13807
13763
|
* **Success (HTTP 200):**
|
|
@@ -13811,26 +13767,28 @@ export declare abstract class BrowserRun {
|
|
|
13811
13767
|
* non-JSON output
|
|
13812
13768
|
*
|
|
13813
13769
|
* **Error:**
|
|
13814
|
-
* - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 503)
|
|
13770
|
+
* - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 502, 503)
|
|
13815
13771
|
* - HTTP 408 when the script exceeds `timeout`
|
|
13816
13772
|
* - HTTP 422 when the script fails to compile or throws
|
|
13773
|
+
* - HTTP 502 when the script fails on the `browser: 'kitesurf'` backend
|
|
13817
13774
|
* - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
|
|
13818
13775
|
* throw before any request is made.
|
|
13819
13776
|
*
|
|
13820
|
-
* **Headers
|
|
13821
|
-
* - `cf-browser-session-id`: Session kept open for `
|
|
13777
|
+
* **Headers** (not returned with `browser: 'kitesurf'`):
|
|
13778
|
+
* - `cf-browser-session-id`: Session kept open for a later `script()` call
|
|
13779
|
+
* with `sessionId`
|
|
13822
13780
|
* - `cf-browser-target-id`: Page target the script ran on
|
|
13823
13781
|
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
|
|
13824
13782
|
*/
|
|
13825
13783
|
script(code: string, options?: BrowserRunScriptOptions): Promise<Response>;
|
|
13826
13784
|
/**
|
|
13827
13785
|
* Run a script against an existing browser session, such as one kept open by
|
|
13828
|
-
* `script()
|
|
13829
|
-
* @param
|
|
13830
|
-
*
|
|
13831
|
-
*
|
|
13832
|
-
*
|
|
13833
|
-
* @returns A `Response` with the same success bodies as
|
|
13786
|
+
* an earlier `script()` call.
|
|
13787
|
+
* @param code - Source of an async function, as for a new session.
|
|
13788
|
+
* @param options - The session to run in, plus page target, library and
|
|
13789
|
+
* timeout options. Launch options such as `keepAlive` cannot be set, because
|
|
13790
|
+
* the session keeps the ones it was acquired with.
|
|
13791
|
+
* @returns A `Response` with the same success bodies as a new-session run.
|
|
13834
13792
|
*
|
|
13835
13793
|
* **Error:**
|
|
13836
13794
|
* - JSON error body with an HTTP status code (400, 401, 404, 408, 410, 422, 500)
|
|
@@ -13842,10 +13800,9 @@ export declare abstract class BrowserRun {
|
|
|
13842
13800
|
* **Headers:**
|
|
13843
13801
|
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
|
|
13844
13802
|
*/
|
|
13845
|
-
|
|
13846
|
-
sessionId: string,
|
|
13803
|
+
script(
|
|
13847
13804
|
code: string,
|
|
13848
|
-
options
|
|
13805
|
+
options: BrowserRunScriptSessionOptions,
|
|
13849
13806
|
): Promise<Response>;
|
|
13850
13807
|
/** DevTools JSON methods exposed through one nested binding target. */
|
|
13851
13808
|
get devtools(): BrowserRunDevtools;
|
|
@@ -16149,6 +16106,62 @@ export interface MediaError extends Error {
|
|
|
16149
16106
|
readonly message: string;
|
|
16150
16107
|
readonly stack?: string;
|
|
16151
16108
|
}
|
|
16109
|
+
// MessageChannel and MessagePort, declared at every compatibility date. They
|
|
16110
|
+
// are globals under the expose_global_message_channel compatibility flag (the
|
|
16111
|
+
// default from 2025-08-15); node:worker_threads exports them at any date.
|
|
16112
|
+
/**
|
|
16113
|
+
* 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.
|
|
16114
|
+
*
|
|
16115
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
|
|
16116
|
+
*/
|
|
16117
|
+
export declare abstract class MessagePort extends EventTarget {
|
|
16118
|
+
/**
|
|
16119
|
+
* The **`postMessage()`** method of the MessagePort interface sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.
|
|
16120
|
+
*
|
|
16121
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
|
|
16122
|
+
*/
|
|
16123
|
+
postMessage(
|
|
16124
|
+
data?: any,
|
|
16125
|
+
options?: any[] | MessagePortPostMessageOptions,
|
|
16126
|
+
): void;
|
|
16127
|
+
/**
|
|
16128
|
+
* 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.
|
|
16129
|
+
*
|
|
16130
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
|
|
16131
|
+
*/
|
|
16132
|
+
close(): void;
|
|
16133
|
+
/**
|
|
16134
|
+
* 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.
|
|
16135
|
+
*
|
|
16136
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
|
|
16137
|
+
*/
|
|
16138
|
+
start(): void;
|
|
16139
|
+
get onmessage(): any | null;
|
|
16140
|
+
set onmessage(value: any | null);
|
|
16141
|
+
}
|
|
16142
|
+
/**
|
|
16143
|
+
* 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.
|
|
16144
|
+
*
|
|
16145
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
|
|
16146
|
+
*/
|
|
16147
|
+
export declare class MessageChannel {
|
|
16148
|
+
constructor();
|
|
16149
|
+
/**
|
|
16150
|
+
* 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.
|
|
16151
|
+
*
|
|
16152
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
|
|
16153
|
+
*/
|
|
16154
|
+
readonly port1: MessagePort;
|
|
16155
|
+
/**
|
|
16156
|
+
* 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.
|
|
16157
|
+
*
|
|
16158
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
|
|
16159
|
+
*/
|
|
16160
|
+
readonly port2: MessagePort;
|
|
16161
|
+
}
|
|
16162
|
+
export interface MessagePortPostMessageOptions {
|
|
16163
|
+
transfer?: any[];
|
|
16164
|
+
}
|
|
16152
16165
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
16153
16166
|
export type EventContext<Env, P extends string, Data> = {
|
|
16154
16167
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -17480,6 +17493,17 @@ export interface AlreadyUploadedError extends StreamError {
|
|
|
17480
17493
|
export interface TooManyWatermarksError extends StreamError {
|
|
17481
17494
|
name: "TooManyWatermarksError";
|
|
17482
17495
|
}
|
|
17496
|
+
export interface StructuredSerializeOptions {
|
|
17497
|
+
transfer?: any[];
|
|
17498
|
+
}
|
|
17499
|
+
export interface ServiceWorkerGlobalScope {
|
|
17500
|
+
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
|
|
17501
|
+
}
|
|
17502
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */
|
|
17503
|
+
export declare function structuredClone<T>(
|
|
17504
|
+
value: T,
|
|
17505
|
+
options?: StructuredSerializeOptions,
|
|
17506
|
+
): T;
|
|
17483
17507
|
export type MarkdownDocument = {
|
|
17484
17508
|
name: string;
|
|
17485
17509
|
blob: Blob;
|
|
@@ -17707,6 +17731,22 @@ export declare namespace TailStream {
|
|
|
17707
17731
|
readonly type: "spanUpdate";
|
|
17708
17732
|
readonly info: SpanUpdateInfo;
|
|
17709
17733
|
}
|
|
17734
|
+
/** A causal relationship to a span, including spans in another trace. */
|
|
17735
|
+
interface SpanLink {
|
|
17736
|
+
readonly context: {
|
|
17737
|
+
readonly traceId: string;
|
|
17738
|
+
readonly spanId: string;
|
|
17739
|
+
readonly traceFlags: number;
|
|
17740
|
+
};
|
|
17741
|
+
readonly attributes: readonly Attribute[];
|
|
17742
|
+
/** Attributes dropped before this link was recorded. */
|
|
17743
|
+
readonly droppedAttributesCount: number;
|
|
17744
|
+
}
|
|
17745
|
+
/** Links added to the receiver identified by the event's spanContext. */
|
|
17746
|
+
interface SpanLinks {
|
|
17747
|
+
readonly type: "spanLinks";
|
|
17748
|
+
readonly links: readonly SpanLink[];
|
|
17749
|
+
}
|
|
17710
17750
|
interface DiagnosticChannelEvent {
|
|
17711
17751
|
readonly type: "diagnosticChannel";
|
|
17712
17752
|
readonly channel: string;
|
|
@@ -17777,6 +17817,7 @@ export declare namespace TailStream {
|
|
|
17777
17817
|
| SpanOpen
|
|
17778
17818
|
| SpanClose
|
|
17779
17819
|
| SpanUpdate
|
|
17820
|
+
| SpanLinks
|
|
17780
17821
|
| DiagnosticChannelEvent
|
|
17781
17822
|
| Exception
|
|
17782
17823
|
| Log
|
|
@@ -17820,6 +17861,7 @@ export declare namespace TailStream {
|
|
|
17820
17861
|
spanOpen?: TailEventHandler<SpanOpen>;
|
|
17821
17862
|
spanClose?: TailEventHandler<SpanClose>;
|
|
17822
17863
|
spanUpdate?: TailEventHandler<SpanUpdate>;
|
|
17864
|
+
spanLinks?: TailEventHandler<SpanLinks>;
|
|
17823
17865
|
diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;
|
|
17824
17866
|
exception?: TailEventHandler<Exception>;
|
|
17825
17867
|
log?: TailEventHandler<Log>;
|