@cloudflare/workers-types 3.10.0 → 3.13.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.
Files changed (2) hide show
  1. package/index.d.ts +66 -17
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -16,6 +16,19 @@ declare class AbortSignal extends EventTarget {
16
16
  throwIfAborted(): void;
17
17
  }
18
18
 
19
+ interface AnalyticsEngine {
20
+ writeEvent(event?: AnalyticsEngineEvent): void;
21
+ logEvent(event?: AnalyticsEngineEvent): void;
22
+ }
23
+
24
+ interface AnalyticsEngineEvent {
25
+ accountId?: any;
26
+ indexId?: any;
27
+ version?: any;
28
+ doubles?: number[];
29
+ blobs?: (ArrayBuffer | string | null)[];
30
+ }
31
+
19
32
  interface BasicImageTransformations {
20
33
  /**
21
34
  * Maximum width in image pixels. The value must be an integer.
@@ -344,6 +357,7 @@ interface DocumentEnd {
344
357
 
345
358
  interface DurableObject {
346
359
  fetch(request: Request): Promise<Response>;
360
+ alarm?(): Promise<void>;
347
361
  }
348
362
 
349
363
  interface DurableObjectGetAlarmOptions {
@@ -363,6 +377,7 @@ interface DurableObjectId {
363
377
 
364
378
  interface DurableObjectListOptions {
365
379
  start?: string;
380
+ startAfter?: string;
366
381
  end?: string;
367
382
  prefix?: string;
368
383
  reverse?: boolean;
@@ -646,7 +661,7 @@ interface FileOptions {
646
661
  lastModified?: number;
647
662
  }
648
663
 
649
- declare class FixedLengthStream extends TransformStream {
664
+ declare class FixedLengthStream extends IdentityTransformStream {
650
665
  constructor(expectedLength: number | bigint);
651
666
  }
652
667
 
@@ -751,6 +766,7 @@ interface IncomingRequestCfProperties {
751
766
  asOrganization: string;
752
767
  botManagement?: IncomingRequestCfPropertiesBotManagement;
753
768
  city?: string;
769
+ clientAcceptEncoding?: string;
754
770
  clientTcpRtt: number;
755
771
  clientTrustScore?: number;
756
772
  /**
@@ -987,6 +1003,7 @@ interface PipeToOptions {
987
1003
  preventClose?: boolean;
988
1004
  preventAbort?: boolean;
989
1005
  preventCancel?: boolean;
1006
+ signal?: AbortSignal;
990
1007
  }
991
1008
 
992
1009
  declare abstract class PromiseRejectionEvent extends Event {
@@ -1002,8 +1019,19 @@ interface QueuingStrategyInit {
1002
1019
  * An instance of the R2 bucket binding.
1003
1020
  */
1004
1021
  interface R2Bucket {
1005
- head(key: string, options?: R2HeadOptions): Promise<R2Object | null>;
1006
- get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;
1022
+ head(key: string): Promise<R2Object | null>;
1023
+ get(key: string): Promise<R2ObjectBody | null>;
1024
+ /**
1025
+ * Returns R2Object on a failure of the conditional specified in onlyIf.
1026
+ */
1027
+ get(
1028
+ key: string,
1029
+ options: R2GetOptions
1030
+ ): Promise<R2ObjectBody | R2Object | null>;
1031
+ get(
1032
+ key: string,
1033
+ options?: R2GetOptions
1034
+ ): Promise<R2ObjectBody | R2Object | null>;
1007
1035
  put(
1008
1036
  key: string,
1009
1037
  value:
@@ -1057,13 +1085,6 @@ interface R2HTTPMetadata {
1057
1085
  cacheExpiry?: Date;
1058
1086
  }
1059
1087
 
1060
- /**
1061
- * Options for retrieving the object metadata.
1062
- */
1063
- interface R2HeadOptions {
1064
- onlyIf?: R2Conditional | Headers;
1065
- }
1066
-
1067
1088
  interface R2ListOptions {
1068
1089
  limit?: number;
1069
1090
  prefix?: string;
@@ -1123,13 +1144,12 @@ interface R2PutOptions {
1123
1144
  httpMetadata?: R2HTTPMetadata | Headers;
1124
1145
  customMetadata?: Record<string, string>;
1125
1146
  md5?: ArrayBuffer | string;
1126
- sha1?: ArrayBuffer | string;
1127
1147
  }
1128
1148
 
1129
- interface R2Range {
1130
- offset: number;
1131
- length: number;
1132
- }
1149
+ declare type R2Range =
1150
+ | { offset: number; length?: number }
1151
+ | { offset?: number; length: number }
1152
+ | { suffix: number };
1133
1153
 
1134
1154
  interface ReadResult {
1135
1155
  value?: any;
@@ -1290,6 +1310,15 @@ interface RequestInitCfProperties {
1290
1310
  * Only available for Enterprise customers.
1291
1311
  */
1292
1312
  cacheKey?: string;
1313
+ /**
1314
+ * This allows you to append additional Cache-Tag response headers
1315
+ * to the origin response without modifications to the origin server.
1316
+ * This will allow for greater control over the Purge by Cache Tag feature
1317
+ * utilizing changes only in the Workers process.
1318
+ *
1319
+ * Only available for Enterprise customers.
1320
+ */
1321
+ cacheTags?: string[];
1293
1322
  /**
1294
1323
  * Force response to be cached for a given number of seconds. (e.g. 300)
1295
1324
  */
@@ -1444,6 +1473,7 @@ declare type RequestInitializerDict = RequestInit;
1444
1473
  declare class Response extends Body {
1445
1474
  constructor(bodyInit?: BodyInit | null, maybeInit?: ResponseInit | Response);
1446
1475
  static redirect(url: string, status?: number): Response;
1476
+ static json(any: any, maybeInit?: ResponseInit | Response): Response;
1447
1477
  clone(): Response;
1448
1478
  readonly status: number;
1449
1479
  readonly statusText: string;
@@ -1537,7 +1567,7 @@ declare type StreamPipeOptions = PipeToOptions;
1537
1567
 
1538
1568
  interface StreamQueuingStrategy {
1539
1569
  highWaterMark?: number;
1540
- size(chunk: ArrayBuffer): number;
1570
+ size(chunk: any): number;
1541
1571
  }
1542
1572
 
1543
1573
  declare abstract class SubtleCrypto {
@@ -1713,11 +1743,30 @@ interface TextEncoderEncodeIntoResult {
1713
1743
  }
1714
1744
 
1715
1745
  declare class TransformStream {
1716
- constructor();
1746
+ constructor(
1747
+ maybeTransformer?: Transformer,
1748
+ maybeWritableStrategy?: StreamQueuingStrategy,
1749
+ maybeReadableStrategy?: StreamQueuingStrategy
1750
+ );
1717
1751
  readonly readable: ReadableStream;
1718
1752
  readonly writable: WritableStream;
1719
1753
  }
1720
1754
 
1755
+ interface TransformStreamDefaultController {
1756
+ readonly desiredSize: number | null;
1757
+ enqueue(chunk: any): void;
1758
+ error(reason: any): void;
1759
+ terminate(): void;
1760
+ }
1761
+
1762
+ interface Transformer {
1763
+ readableType?: string;
1764
+ writableType?: string;
1765
+ start?(controller: TransformStreamDefaultController): any;
1766
+ transform?(chunk: any, controller: TransformStreamDefaultController): any;
1767
+ flush?(controller: TransformStreamDefaultController): any;
1768
+ }
1769
+
1721
1770
  declare class URL {
1722
1771
  constructor(url: string, base?: string);
1723
1772
  href: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/workers-types",
3
- "version": "3.10.0",
3
+ "version": "3.13.0",
4
4
  "description": "TypeScript typings for Cloudflare Workers",
5
5
  "repository": {
6
6
  "type": "git",