@cloudflare/workers-types 4.20240924.0 → 4.20241004.0
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/2021-11-03/index.d.ts +54 -30
- package/2021-11-03/index.ts +53 -27
- package/2022-01-31/index.d.ts +75 -51
- package/2022-01-31/index.ts +74 -48
- package/2022-03-21/index.d.ts +75 -51
- package/2022-03-21/index.ts +74 -48
- package/2022-08-04/index.d.ts +75 -51
- package/2022-08-04/index.ts +74 -48
- package/2022-10-31/index.d.ts +82 -58
- package/2022-10-31/index.ts +81 -55
- package/2022-11-30/index.d.ts +82 -58
- package/2022-11-30/index.ts +81 -55
- package/2023-03-01/index.d.ts +82 -58
- package/2023-03-01/index.ts +81 -55
- package/2023-07-01/index.d.ts +84 -60
- package/2023-07-01/index.ts +83 -57
- package/experimental/index.d.ts +84 -60
- package/experimental/index.ts +83 -57
- package/index.d.ts +54 -30
- package/index.ts +53 -27
- package/oldest/index.d.ts +54 -30
- package/oldest/index.ts +53 -27
- package/package.json +1 -1
package/experimental/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ and limitations under the License.
|
|
|
14
14
|
***************************************************************************** */
|
|
15
15
|
/* eslint-disable */
|
|
16
16
|
// noinspection JSUnusedGlobalSymbols
|
|
17
|
+
declare var onmessage: never;
|
|
17
18
|
/**
|
|
18
19
|
* An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API.
|
|
19
20
|
*
|
|
@@ -1552,28 +1553,34 @@ declare abstract class Body {
|
|
|
1552
1553
|
*
|
|
1553
1554
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1554
1555
|
*/
|
|
1555
|
-
declare
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1556
|
+
declare var Response: {
|
|
1557
|
+
prototype: Response;
|
|
1558
|
+
new (body?: BodyInit | null, init?: ResponseInit): Response;
|
|
1559
|
+
redirect(url: string, status?: number): Response;
|
|
1560
|
+
json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
1561
|
+
};
|
|
1562
|
+
/**
|
|
1563
|
+
* This Fetch API interface represents the response to a request.
|
|
1564
|
+
*
|
|
1565
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1566
|
+
*/
|
|
1567
|
+
interface Response extends Body {
|
|
1561
1568
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
|
|
1562
1569
|
clone(): Response;
|
|
1563
1570
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
|
|
1564
|
-
|
|
1571
|
+
status: number;
|
|
1565
1572
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
|
|
1566
|
-
|
|
1573
|
+
statusText: string;
|
|
1567
1574
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
|
|
1568
|
-
|
|
1575
|
+
headers: Headers;
|
|
1569
1576
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
|
|
1570
|
-
|
|
1577
|
+
ok: boolean;
|
|
1571
1578
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
|
|
1572
|
-
|
|
1579
|
+
redirected: boolean;
|
|
1573
1580
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1581
|
+
url: string;
|
|
1582
|
+
webSocket: WebSocket | null;
|
|
1583
|
+
cf: any | undefined;
|
|
1577
1584
|
}
|
|
1578
1585
|
interface ResponseInit {
|
|
1579
1586
|
status?: number;
|
|
@@ -1592,11 +1599,20 @@ type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
|
|
|
1592
1599
|
*
|
|
1593
1600
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1594
1601
|
*/
|
|
1595
|
-
declare
|
|
1596
|
-
|
|
1597
|
-
Cf = CfProperties<CfHostMetadata
|
|
1598
|
-
|
|
1599
|
-
|
|
1602
|
+
declare var Request: {
|
|
1603
|
+
prototype: Request;
|
|
1604
|
+
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
|
|
1605
|
+
input: RequestInfo<CfProperties>,
|
|
1606
|
+
init?: RequestInit<Cf>,
|
|
1607
|
+
): Request<CfHostMetadata, Cf>;
|
|
1608
|
+
};
|
|
1609
|
+
/**
|
|
1610
|
+
* This Fetch API interface represents a resource request.
|
|
1611
|
+
*
|
|
1612
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1613
|
+
*/
|
|
1614
|
+
interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>
|
|
1615
|
+
extends Body {
|
|
1600
1616
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
|
|
1601
1617
|
clone(): Request<CfHostMetadata, Cf>;
|
|
1602
1618
|
/**
|
|
@@ -1604,45 +1620,45 @@ declare class Request<
|
|
|
1604
1620
|
*
|
|
1605
1621
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
|
|
1606
1622
|
*/
|
|
1607
|
-
|
|
1623
|
+
method: string;
|
|
1608
1624
|
/**
|
|
1609
1625
|
* Returns the URL of request as a string.
|
|
1610
1626
|
*
|
|
1611
1627
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
|
|
1612
1628
|
*/
|
|
1613
|
-
|
|
1629
|
+
url: string;
|
|
1614
1630
|
/**
|
|
1615
1631
|
* Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.
|
|
1616
1632
|
*
|
|
1617
1633
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
|
|
1618
1634
|
*/
|
|
1619
|
-
|
|
1635
|
+
headers: Headers;
|
|
1620
1636
|
/**
|
|
1621
1637
|
* Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.
|
|
1622
1638
|
*
|
|
1623
1639
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
|
|
1624
1640
|
*/
|
|
1625
|
-
|
|
1626
|
-
|
|
1641
|
+
redirect: string;
|
|
1642
|
+
fetcher: Fetcher | null;
|
|
1627
1643
|
/**
|
|
1628
1644
|
* Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
|
|
1629
1645
|
*
|
|
1630
1646
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
|
|
1631
1647
|
*/
|
|
1632
|
-
|
|
1633
|
-
|
|
1648
|
+
signal: AbortSignal;
|
|
1649
|
+
cf: Cf | undefined;
|
|
1634
1650
|
/**
|
|
1635
1651
|
* Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI]
|
|
1636
1652
|
*
|
|
1637
1653
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
|
|
1638
1654
|
*/
|
|
1639
|
-
|
|
1655
|
+
integrity: string;
|
|
1640
1656
|
/**
|
|
1641
1657
|
* Returns a boolean indicating whether or not request can outlive the global in which it was created.
|
|
1642
1658
|
*
|
|
1643
1659
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
|
|
1644
1660
|
*/
|
|
1645
|
-
|
|
1661
|
+
keepalive: boolean;
|
|
1646
1662
|
/**
|
|
1647
1663
|
* Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
|
|
1648
1664
|
*
|
|
@@ -2377,7 +2393,7 @@ declare class TextDecoderStream extends TransformStream<
|
|
|
2377
2393
|
ArrayBuffer | ArrayBufferView,
|
|
2378
2394
|
string
|
|
2379
2395
|
> {
|
|
2380
|
-
constructor(
|
|
2396
|
+
constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
|
|
2381
2397
|
get encoding(): string;
|
|
2382
2398
|
get fatal(): boolean;
|
|
2383
2399
|
get ignoreBOM(): boolean;
|
|
@@ -2591,13 +2607,13 @@ declare class URL {
|
|
|
2591
2607
|
/*function toString() { [native code] }*/
|
|
2592
2608
|
toString(): string;
|
|
2593
2609
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
|
|
2594
|
-
static canParse(
|
|
2595
|
-
static parse(
|
|
2610
|
+
static canParse(url: string, base?: string): boolean;
|
|
2611
|
+
static parse(url: string, base?: string): URL | null;
|
|
2596
2612
|
}
|
|
2597
2613
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
|
|
2598
2614
|
declare class URLSearchParams {
|
|
2599
2615
|
constructor(
|
|
2600
|
-
|
|
2616
|
+
init?: Iterable<Iterable<string>> | Record<string, string> | string,
|
|
2601
2617
|
);
|
|
2602
2618
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
|
|
2603
2619
|
get size(): number;
|
|
@@ -2606,37 +2622,37 @@ declare class URLSearchParams {
|
|
|
2606
2622
|
*
|
|
2607
2623
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
|
|
2608
2624
|
*/
|
|
2609
|
-
append(
|
|
2625
|
+
append(name: string, value: string): void;
|
|
2610
2626
|
/**
|
|
2611
2627
|
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
|
|
2612
2628
|
*
|
|
2613
2629
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
|
|
2614
2630
|
*/
|
|
2615
|
-
delete(
|
|
2631
|
+
delete(name: string, value?: string): void;
|
|
2616
2632
|
/**
|
|
2617
2633
|
* Returns the first value associated to the given search parameter.
|
|
2618
2634
|
*
|
|
2619
2635
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
|
|
2620
2636
|
*/
|
|
2621
|
-
get(
|
|
2637
|
+
get(name: string): string | null;
|
|
2622
2638
|
/**
|
|
2623
2639
|
* Returns all the values association with a given search parameter.
|
|
2624
2640
|
*
|
|
2625
2641
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
|
|
2626
2642
|
*/
|
|
2627
|
-
getAll(
|
|
2643
|
+
getAll(name: string): string[];
|
|
2628
2644
|
/**
|
|
2629
2645
|
* Returns a Boolean indicating if such a search parameter exists.
|
|
2630
2646
|
*
|
|
2631
2647
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
|
|
2632
2648
|
*/
|
|
2633
|
-
has(
|
|
2649
|
+
has(name: string, value?: string): boolean;
|
|
2634
2650
|
/**
|
|
2635
2651
|
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
|
|
2636
2652
|
*
|
|
2637
2653
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
|
|
2638
2654
|
*/
|
|
2639
|
-
set(
|
|
2655
|
+
set(name: string, value: string): void;
|
|
2640
2656
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
|
|
2641
2657
|
sort(): void;
|
|
2642
2658
|
/* Returns an array of key, value pairs for every entry in the search params. */
|
|
@@ -2766,8 +2782,24 @@ type WebSocketEventMap = {
|
|
|
2766
2782
|
*
|
|
2767
2783
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2768
2784
|
*/
|
|
2769
|
-
declare
|
|
2770
|
-
|
|
2785
|
+
declare var WebSocket: {
|
|
2786
|
+
prototype: WebSocket;
|
|
2787
|
+
new (url: string, protocols?: string[] | string): WebSocket;
|
|
2788
|
+
readonly READY_STATE_CONNECTING: number;
|
|
2789
|
+
readonly CONNECTING: number;
|
|
2790
|
+
readonly READY_STATE_OPEN: number;
|
|
2791
|
+
readonly OPEN: number;
|
|
2792
|
+
readonly READY_STATE_CLOSING: number;
|
|
2793
|
+
readonly CLOSING: number;
|
|
2794
|
+
readonly READY_STATE_CLOSED: number;
|
|
2795
|
+
readonly CLOSED: number;
|
|
2796
|
+
};
|
|
2797
|
+
/**
|
|
2798
|
+
* Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
|
|
2799
|
+
*
|
|
2800
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2801
|
+
*/
|
|
2802
|
+
interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
2771
2803
|
accept(): void;
|
|
2772
2804
|
/**
|
|
2773
2805
|
* Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
|
|
@@ -2783,38 +2815,30 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
2783
2815
|
close(code?: number, reason?: string): void;
|
|
2784
2816
|
serializeAttachment(attachment: any): void;
|
|
2785
2817
|
deserializeAttachment(): any | null;
|
|
2786
|
-
static readonly READY_STATE_CONNECTING: number;
|
|
2787
|
-
static readonly CONNECTING: number;
|
|
2788
|
-
static readonly READY_STATE_OPEN: number;
|
|
2789
|
-
static readonly OPEN: number;
|
|
2790
|
-
static readonly READY_STATE_CLOSING: number;
|
|
2791
|
-
static readonly CLOSING: number;
|
|
2792
|
-
static readonly READY_STATE_CLOSED: number;
|
|
2793
|
-
static readonly CLOSED: number;
|
|
2794
2818
|
/**
|
|
2795
2819
|
* Returns the state of the WebSocket object's connection. It can have the values described below.
|
|
2796
2820
|
*
|
|
2797
2821
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
|
|
2798
2822
|
*/
|
|
2799
|
-
|
|
2823
|
+
readyState: number;
|
|
2800
2824
|
/**
|
|
2801
2825
|
* Returns the URL that was used to establish the WebSocket connection.
|
|
2802
2826
|
*
|
|
2803
2827
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
|
|
2804
2828
|
*/
|
|
2805
|
-
|
|
2829
|
+
url: string | null;
|
|
2806
2830
|
/**
|
|
2807
2831
|
* Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation.
|
|
2808
2832
|
*
|
|
2809
2833
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
|
|
2810
2834
|
*/
|
|
2811
|
-
|
|
2835
|
+
protocol: string | null;
|
|
2812
2836
|
/**
|
|
2813
2837
|
* Returns the extensions selected by the server, if any.
|
|
2814
2838
|
*
|
|
2815
2839
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
|
|
2816
2840
|
*/
|
|
2817
|
-
|
|
2841
|
+
extensions: string | null;
|
|
2818
2842
|
}
|
|
2819
2843
|
declare const WebSocketPair: {
|
|
2820
2844
|
new (): {
|
|
@@ -3603,7 +3627,7 @@ type AiTextToImageInput = {
|
|
|
3603
3627
|
strength?: number;
|
|
3604
3628
|
guidance?: number;
|
|
3605
3629
|
};
|
|
3606
|
-
type AiTextToImageOutput = Uint8Array
|
|
3630
|
+
type AiTextToImageOutput = ReadableStream<Uint8Array>;
|
|
3607
3631
|
declare abstract class BaseAiTextToImage {
|
|
3608
3632
|
inputs: AiTextToImageInput;
|
|
3609
3633
|
postProcessedOutputs: AiTextToImageOutput;
|
|
@@ -4880,7 +4904,7 @@ interface Hyperdrive {
|
|
|
4880
4904
|
// Copyright (c) 2024 Cloudflare, Inc.
|
|
4881
4905
|
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4882
4906
|
// https://opensource.org/licenses/Apache-2.0
|
|
4883
|
-
type
|
|
4907
|
+
type ImageInfoResponse =
|
|
4884
4908
|
| {
|
|
4885
4909
|
format: "image/svg+xml";
|
|
4886
4910
|
}
|
|
@@ -4890,7 +4914,7 @@ type InfoResponse =
|
|
|
4890
4914
|
width: number;
|
|
4891
4915
|
height: number;
|
|
4892
4916
|
};
|
|
4893
|
-
type
|
|
4917
|
+
type ImageTransform = {
|
|
4894
4918
|
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
4895
4919
|
gravity?:
|
|
4896
4920
|
| "left"
|
|
@@ -4940,7 +4964,7 @@ type Transform = {
|
|
|
4940
4964
|
};
|
|
4941
4965
|
zoom?: number;
|
|
4942
4966
|
};
|
|
4943
|
-
type
|
|
4967
|
+
type ImageOutputOptions = {
|
|
4944
4968
|
format:
|
|
4945
4969
|
| "image/jpeg"
|
|
4946
4970
|
| "image/png"
|
|
@@ -4958,7 +4982,7 @@ interface ImagesBinding {
|
|
|
4958
4982
|
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
4959
4983
|
* @param stream The image bytes
|
|
4960
4984
|
*/
|
|
4961
|
-
info(stream: ReadableStream<Uint8Array>): Promise<
|
|
4985
|
+
info(stream: ReadableStream<Uint8Array>): Promise<ImageInfoResponse>;
|
|
4962
4986
|
/**
|
|
4963
4987
|
* Begin applying a series of transformations to an image
|
|
4964
4988
|
* @param stream The image bytes
|
|
@@ -4972,15 +4996,15 @@ interface ImageTransformer {
|
|
|
4972
4996
|
* You can then apply more transformations or retrieve the output.
|
|
4973
4997
|
* @param transform
|
|
4974
4998
|
*/
|
|
4975
|
-
transform(transform:
|
|
4999
|
+
transform(transform: ImageTransform): ImageTransformer;
|
|
4976
5000
|
/**
|
|
4977
5001
|
* Retrieve the image that results from applying the transforms to the
|
|
4978
5002
|
* provided input
|
|
4979
5003
|
* @param options Options that apply to the output e.g. output format
|
|
4980
5004
|
*/
|
|
4981
|
-
output(options:
|
|
5005
|
+
output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
|
|
4982
5006
|
}
|
|
4983
|
-
interface
|
|
5007
|
+
interface ImageTransformationResult {
|
|
4984
5008
|
/**
|
|
4985
5009
|
* The image as a response, ready to store in cache or return to users
|
|
4986
5010
|
*/
|