@cloudflare/workers-types 3.15.0 → 3.17.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 +167 -24
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -252,8 +252,14 @@ declare type CryptoKeyAlgorithmVariant =
252
252
  | CryptoKeyHmacKeyAlgorithm
253
253
  | CryptoKeyRsaKeyAlgorithm
254
254
  | CryptoKeyEllipticKeyAlgorithm
255
- | CryptoKeyVoprfKeyAlgorithm
256
- | CryptoKeyOprfKeyAlgorithm;
255
+ | CryptoKeyArbitraryKeyAlgorithm;
256
+
257
+ interface CryptoKeyArbitraryKeyAlgorithm {
258
+ name: string;
259
+ hash?: CryptoKeyKeyAlgorithm;
260
+ namedCurve?: string;
261
+ length?: number;
262
+ }
257
263
 
258
264
  interface CryptoKeyEllipticKeyAlgorithm {
259
265
  name: string;
@@ -270,11 +276,6 @@ interface CryptoKeyKeyAlgorithm {
270
276
  name: string;
271
277
  }
272
278
 
273
- interface CryptoKeyOprfKeyAlgorithm {
274
- name: string;
275
- namedCurve: string;
276
- }
277
-
278
279
  interface CryptoKeyPair {
279
280
  publicKey: CryptoKey;
280
281
  privateKey: CryptoKey;
@@ -287,12 +288,29 @@ interface CryptoKeyRsaKeyAlgorithm {
287
288
  hash?: CryptoKeyKeyAlgorithm;
288
289
  }
289
290
 
290
- interface CryptoKeyVoprfKeyAlgorithm {
291
- name: string;
292
- hash: CryptoKeyKeyAlgorithm;
293
- namedCurve: string;
291
+ interface D1Database {
292
+ prepare(query: string): D1PreparedStatement;
293
+ dump(): Promise<ArrayBuffer>;
294
+ batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
295
+ exec<T = unknown>(query: string): Promise<D1Result<T>>;
296
+ }
297
+
298
+ interface D1PreparedStatement {
299
+ bind(...values: any[]): D1PreparedStatement;
300
+ first<T = unknown>(colName?: string): Promise<T>;
301
+ run<T = unknown>(): Promise<D1Result<T>>;
302
+ all<T = unknown>(): Promise<D1Result<T>>;
303
+ raw<T = unknown>(): Promise<T[]>;
294
304
  }
295
305
 
306
+ declare type D1Result<T = unknown> = {
307
+ results?: T[];
308
+ lastRowId: number | null;
309
+ changes: number;
310
+ duration: number;
311
+ error?: string;
312
+ };
313
+
296
314
  declare class DOMException extends Error {
297
315
  constructor(message?: string, name?: string);
298
316
  readonly code: number;
@@ -399,7 +417,7 @@ interface DurableObjectSetAlarmOptions {
399
417
 
400
418
  interface DurableObjectState {
401
419
  waitUntil(promise: Promise<any>): void;
402
- readonly id: DurableObjectId | string;
420
+ id: DurableObjectId;
403
421
  readonly storage: DurableObjectStorage;
404
422
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
405
423
  }
@@ -464,7 +482,10 @@ interface DurableObjectStub extends Fetcher {
464
482
  }
465
483
 
466
484
  interface DurableObjectTransaction {
467
- get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T>;
485
+ get<T = unknown>(
486
+ key: string,
487
+ options?: DurableObjectGetOptions
488
+ ): Promise<T | undefined>;
468
489
  get<T = unknown>(
469
490
  keys: string[],
470
491
  options?: DurableObjectGetOptions
@@ -597,6 +618,10 @@ interface EventTargetEventListenerOptions {
597
618
  capture?: boolean;
598
619
  }
599
620
 
621
+ interface EventTargetHandlerObject {
622
+ handleEvent(arg1: Event): any | undefined;
623
+ }
624
+
600
625
  interface ExecutionContext {
601
626
  waitUntil(promise: Promise<any>): void;
602
627
  passThroughOnException(): void;
@@ -664,12 +689,12 @@ declare class FormData {
664
689
  set(name: string, value: Blob, filename?: string): void;
665
690
  entries(): IterableIterator<[key: string, value: File | string]>;
666
691
  keys(): IterableIterator<string>;
667
- values(): IterableIterator<File | string>;
692
+ values(): IterableIterator<string | File>;
668
693
  forEach<This = unknown>(
669
694
  callback: (
670
695
  this: This,
671
- key: string,
672
696
  value: File | string,
697
+ key: string,
673
698
  parent: FormData
674
699
  ) => void,
675
700
  thisArg?: This
@@ -709,7 +734,7 @@ declare class Headers {
709
734
  append(name: string, value: string): void;
710
735
  delete(name: string): void;
711
736
  forEach<This = unknown>(
712
- callback: (this: This, key: string, value: string, parent: Headers) => void,
737
+ callback: (this: This, value: string, key: string, parent: Headers) => void,
713
738
  thisArg?: This
714
739
  ): void;
715
740
  entries(): IterableIterator<[key: string, value: string]>;
@@ -754,7 +779,7 @@ interface IncomingRequestCfProperties {
754
779
  botManagement?: IncomingRequestCfPropertiesBotManagement;
755
780
  city?: string;
756
781
  clientAcceptEncoding?: string;
757
- clientTcpRtt: number;
782
+ clientTcpRtt?: number;
758
783
  clientTrustScore?: number;
759
784
  /**
760
785
  * The three-letter airport code of the data center that the request
@@ -768,6 +793,7 @@ interface IncomingRequestCfProperties {
768
793
  */
769
794
  country: string;
770
795
  httpProtocol: string;
796
+ isEUCountry?: string;
771
797
  latitude?: string;
772
798
  longitude?: string;
773
799
  /**
@@ -797,6 +823,8 @@ interface IncomingRequestCfProperties {
797
823
  }
798
824
 
799
825
  interface IncomingRequestCfPropertiesBotManagement {
826
+ corporateProxy: boolean;
827
+ ja3Hash?: string;
800
828
  score: number;
801
829
  staticResource: boolean;
802
830
  verifiedBot: boolean;
@@ -805,9 +833,13 @@ interface IncomingRequestCfPropertiesBotManagement {
805
833
  interface IncomingRequestCfPropertiesTLSClientAuth {
806
834
  certIssuerDNLegacy: string;
807
835
  certIssuerDN: string;
836
+ certIssuerDNRFC2253: string;
837
+ certIssuerSKI: string;
838
+ certIssuerSerial: string;
808
839
  certPresented: "0" | "1";
809
840
  certSubjectDNLegacy: string;
810
841
  certSubjectDN: string;
842
+ certSubjectDNRFC2253: string;
811
843
  /**
812
844
  * In format "Dec 22 19:39:00 2018 GMT"
813
845
  */
@@ -822,6 +854,8 @@ interface IncomingRequestCfPropertiesTLSClientAuth {
822
854
  * "SUCCESS", "FAILED:reason", "NONE"
823
855
  */
824
856
  certVerified: string;
857
+ certRevoked: string;
858
+ certSKI: string;
825
859
  }
826
860
 
827
861
  interface JsonWebKey {
@@ -1030,10 +1064,21 @@ interface R2Bucket {
1030
1064
  | Blob,
1031
1065
  options?: R2PutOptions
1032
1066
  ): Promise<R2Object>;
1033
- delete(key: string): Promise<void>;
1067
+ delete(keys: string | string[]): Promise<void>;
1034
1068
  list(options?: R2ListOptions): Promise<R2Objects>;
1035
1069
  }
1036
1070
 
1071
+ /**
1072
+ * The checksums associated with the object.
1073
+ */
1074
+ interface R2Checksums {
1075
+ md5?: ArrayBuffer;
1076
+ sha1?: ArrayBuffer;
1077
+ sha256?: ArrayBuffer;
1078
+ sha384?: ArrayBuffer;
1079
+ sha512?: ArrayBuffer;
1080
+ }
1081
+
1037
1082
  /**
1038
1083
  * Perform the operation conditionally based on meeting the defined criteria.
1039
1084
  */
@@ -1042,6 +1087,7 @@ interface R2Conditional {
1042
1087
  etagDoesNotMatch?: string;
1043
1088
  uploadedBefore?: Date;
1044
1089
  uploadedAfter?: Date;
1090
+ secondsGranularity?: boolean;
1045
1091
  }
1046
1092
 
1047
1093
  /**
@@ -1049,7 +1095,7 @@ interface R2Conditional {
1049
1095
  */
1050
1096
  interface R2GetOptions {
1051
1097
  onlyIf?: R2Conditional | Headers;
1052
- range?: R2Range;
1098
+ range?: R2Range | Headers;
1053
1099
  }
1054
1100
 
1055
1101
  /**
@@ -1077,6 +1123,7 @@ interface R2ListOptions {
1077
1123
  prefix?: string;
1078
1124
  cursor?: string;
1079
1125
  delimiter?: string;
1126
+ startAfter?: string;
1080
1127
  /**
1081
1128
  * If you populate this array, then items returned will include this metadata.
1082
1129
  * A tradeoff is that fewer results may be returned depending on how big this
@@ -1102,9 +1149,10 @@ declare abstract class R2Object {
1102
1149
  readonly size: number;
1103
1150
  readonly etag: string;
1104
1151
  readonly httpEtag: string;
1152
+ readonly checksums: R2Checksums;
1105
1153
  readonly uploaded: Date;
1106
- readonly httpMetadata: R2HTTPMetadata;
1107
- readonly customMetadata: Record<string, string>;
1154
+ readonly httpMetadata?: R2HTTPMetadata;
1155
+ readonly customMetadata?: Record<string, string>;
1108
1156
  readonly range?: R2Range;
1109
1157
  writeHttpMetadata(headers: Headers): void;
1110
1158
  }
@@ -1129,9 +1177,14 @@ interface R2Objects {
1129
1177
  }
1130
1178
 
1131
1179
  interface R2PutOptions {
1180
+ onlyIf?: R2Conditional | Headers;
1132
1181
  httpMetadata?: R2HTTPMetadata | Headers;
1133
1182
  customMetadata?: Record<string, string>;
1134
1183
  md5?: ArrayBuffer | string;
1184
+ sha1?: ArrayBuffer | string;
1185
+ sha256?: ArrayBuffer | string;
1186
+ sha384?: ArrayBuffer | string;
1187
+ sha512?: ArrayBuffer | string;
1135
1188
  }
1136
1189
 
1137
1190
  declare type R2Range =
@@ -1365,8 +1418,10 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
1365
1418
  * - json: instead of generating an image, outputs information about the
1366
1419
  * image, in JSON format. The JSON object will contain image size
1367
1420
  * (before and after resizing), source image’s MIME type, file size, etc.
1421
+ * - jpeg: generate images in JPEG format.
1422
+ * - png: generate images in PNG format.
1368
1423
  */
1369
- format?: "avif" | "webp" | "json";
1424
+ format?: "avif" | "webp" | "json" | "jpeg" | "png";
1370
1425
  /**
1371
1426
  * Whether to preserve animation frames from input files. Default is true.
1372
1427
  * Setting it to false reduces animations to still images. This setting is
@@ -1406,6 +1461,12 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
1406
1461
  * entry is the topmost layer).
1407
1462
  */
1408
1463
  draw?: RequestInitCfPropertiesImageDraw[];
1464
+ /**
1465
+ * Fetching image from authenticated origin. Setting this property will
1466
+ * pass authentication headers (Authorization, Cookie, etc.) through to
1467
+ * the origin.
1468
+ */
1469
+ "origin-auth"?: "share-publicly";
1409
1470
  }
1410
1471
 
1411
1472
  interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
@@ -1554,7 +1615,7 @@ interface ServiceWorkerGlobalScopeStructuredCloneOptions {
1554
1615
  declare type StreamPipeOptions = PipeToOptions;
1555
1616
 
1556
1617
  interface StreamQueuingStrategy {
1557
- highWaterMark?: number;
1618
+ highWaterMark?: bigint;
1558
1619
  size(chunk: any): number;
1559
1620
  }
1560
1621
 
@@ -1624,6 +1685,10 @@ declare abstract class SubtleCrypto {
1624
1685
  extractable: boolean,
1625
1686
  keyUsages: string[]
1626
1687
  ): Promise<CryptoKey>;
1688
+ timingSafeEqual(
1689
+ a: ArrayBuffer | ArrayBufferView,
1690
+ b: ArrayBuffer | ArrayBufferView
1691
+ ): boolean;
1627
1692
  }
1628
1693
 
1629
1694
  interface SubtleCryptoDeriveKeyAlgorithm {
@@ -1718,6 +1783,14 @@ interface TextDecoderDecodeOptions {
1718
1783
  stream: boolean;
1719
1784
  }
1720
1785
 
1786
+ declare class TextDecoderStream extends TransformStream {
1787
+ constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
1788
+ }
1789
+
1790
+ interface TextDecoderStreamTextDecoderStreamInit {
1791
+ fatal?: boolean;
1792
+ }
1793
+
1721
1794
  declare class TextEncoder {
1722
1795
  constructor();
1723
1796
  encode(input?: string): Uint8Array;
@@ -1730,6 +1803,72 @@ interface TextEncoderEncodeIntoResult {
1730
1803
  written: number;
1731
1804
  }
1732
1805
 
1806
+ declare class TextEncoderStream extends TransformStream {
1807
+ constructor();
1808
+ }
1809
+
1810
+ interface TraceEvent extends ExtendableEvent {
1811
+ readonly traces: TraceItem[];
1812
+ }
1813
+
1814
+ interface TraceException {
1815
+ readonly timestamp: number;
1816
+ readonly message: string;
1817
+ readonly name: string;
1818
+ }
1819
+
1820
+ interface TraceItem {
1821
+ readonly event: TraceItemEventInfo | null;
1822
+ readonly eventTimestamp: number | null;
1823
+ readonly logs: TraceLog[];
1824
+ readonly exceptions: TraceException[];
1825
+ readonly scriptName: string | null;
1826
+ readonly dispatchNamespace?: string;
1827
+ readonly outcome: string;
1828
+ }
1829
+
1830
+ interface TraceItemAlarmEventInfo {
1831
+ readonly scheduledTime: Date;
1832
+ }
1833
+
1834
+ declare type TraceItemEventInfo =
1835
+ | TraceItemFetchEventInfo
1836
+ | TraceItemScheduledEventInfo
1837
+ | TraceItemAlarmEventInfo;
1838
+
1839
+ interface TraceItemFetchEventInfo {
1840
+ readonly response?: TraceItemFetchEventInfoResponse;
1841
+ readonly request: TraceItemFetchEventInfoRequest;
1842
+ }
1843
+
1844
+ interface TraceItemFetchEventInfoRequest {
1845
+ readonly cf?: Object;
1846
+ readonly headers: Record<string, string>;
1847
+ readonly method: string;
1848
+ readonly url: string;
1849
+ getUnredacted(): TraceItemFetchEventInfoRequest;
1850
+ }
1851
+
1852
+ interface TraceItemFetchEventInfoResponse {
1853
+ readonly status: number;
1854
+ }
1855
+
1856
+ interface TraceItemScheduledEventInfo {
1857
+ readonly scheduledTime: number;
1858
+ readonly cron: string;
1859
+ }
1860
+
1861
+ interface TraceLog {
1862
+ readonly timestamp: number;
1863
+ readonly level: string;
1864
+ readonly message: Object;
1865
+ }
1866
+
1867
+ interface TraceMetrics {
1868
+ readonly cpuTime: number;
1869
+ readonly wallTime: number;
1870
+ }
1871
+
1733
1872
  declare class TransformStream {
1734
1873
  constructor(
1735
1874
  maybeTransformer?: Transformer,
@@ -1834,8 +1973,8 @@ declare class URLSearchParams {
1834
1973
  forEach<This = unknown>(
1835
1974
  callback: (
1836
1975
  this: This,
1837
- key: string,
1838
1976
  value: string,
1977
+ key: string,
1839
1978
  parent: URLSearchParams
1840
1979
  ) => void,
1841
1980
  thisArg?: This
@@ -1878,6 +2017,10 @@ interface UnderlyingSource {
1878
2017
  cancel?(reason?: any): any;
1879
2018
  }
1880
2019
 
2020
+ interface UnsafeTraceMetrics {
2021
+ fromTrace(arg4: TraceItem): TraceMetrics;
2022
+ }
2023
+
1881
2024
  declare class WebSocket extends EventTarget<WebSocketEventMap> {
1882
2025
  constructor(url: string, protocols?: string[] | string);
1883
2026
  accept(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/workers-types",
3
- "version": "3.15.0",
3
+ "version": "3.17.0",
4
4
  "description": "TypeScript typings for Cloudflare Workers",
5
5
  "repository": {
6
6
  "type": "git",