@cloudflare/workers-types 3.1.0 → 3.1.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.
Files changed (2) hide show
  1. package/index.d.ts +94 -63
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -49,7 +49,7 @@ interface BasicImageTransformations {
49
49
  /**
50
50
  * When cropping with fit: "cover", this defines the side or point that should
51
51
  * be left uncropped. The value is either a string
52
- * "left", "right", "top", "bottom" or "center" (the default),
52
+ * "left", "right", "top", "bottom", "auto", or "center" (the default),
53
53
  * or an object {x, y} containing focal point coordinates in the original
54
54
  * image expressed as fractions ranging from 0.0 (top or left) to 1.0
55
55
  * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
@@ -58,7 +58,7 @@ interface BasicImageTransformations {
58
58
  * preserve as much as possible around a point at 20% of the height of the
59
59
  * source image.
60
60
  */
61
- gravity?: "left" | "right" | "top" | "bottom" | "center" | BasicImageTransformationsGravityCoordinates;
61
+ gravity?: "left" | "right" | "top" | "bottom" | "center" | "auto" | BasicImageTransformationsGravityCoordinates;
62
62
  /**
63
63
  * Background color to add underneath the image. Applies only to images with
64
64
  * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
@@ -180,7 +180,7 @@ interface ContentOptions {
180
180
 
181
181
  declare abstract class Crypto {
182
182
  readonly subtle: SubtleCrypto;
183
- getRandomValues(buffer: ArrayBufferView): ArrayBufferView;
183
+ getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array>(buffer: T): T;
184
184
  randomUUID(): string;
185
185
  }
186
186
 
@@ -280,12 +280,27 @@ interface DurableObject {
280
280
  fetch(request: Request): Promise<Response>;
281
281
  }
282
282
 
283
+ interface DurableObjectGetOptions {
284
+ allowConcurrency?: boolean;
285
+ noCache?: boolean;
286
+ }
287
+
283
288
  interface DurableObjectId {
284
289
  toString(): string;
285
290
  equals(other: DurableObjectId): boolean;
286
291
  readonly name?: string;
287
292
  }
288
293
 
294
+ interface DurableObjectListOptions {
295
+ start?: string;
296
+ end?: string;
297
+ prefix?: string;
298
+ reverse?: boolean;
299
+ limit?: number;
300
+ allowConcurrency?: boolean;
301
+ noCache?: boolean;
302
+ }
303
+
289
304
  interface DurableObjectNamespace {
290
305
  newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
291
306
  idFromName(name: string): DurableObjectId;
@@ -297,6 +312,12 @@ interface DurableObjectNamespaceNewUniqueIdOptions {
297
312
  jurisdiction?: string;
298
313
  }
299
314
 
315
+ interface DurableObjectPutOptions {
316
+ allowConcurrency?: boolean;
317
+ allowUnconfirmed?: boolean;
318
+ noCache?: boolean;
319
+ }
320
+
300
321
  interface DurableObjectState {
301
322
  waitUntil(promise: Promise<any>): void;
302
323
  readonly id: DurableObjectId | string;
@@ -305,37 +326,34 @@ interface DurableObjectState {
305
326
  }
306
327
 
307
328
  interface DurableObjectStorage {
308
- get<T = unknown>(key: string, options?: DurableObjectStorageOperationsGetOptions): Promise<T | undefined>;
309
- get<T = unknown>(keys: string[], options?: DurableObjectStorageOperationsGetOptions): Promise<Map<string, T>>;
310
- list<T = unknown>(options?: DurableObjectStorageOperationsListOptions): Promise<Map<string, T>>;
311
- put<T>(key: string, value: T, options?: DurableObjectStorageOperationsPutOptions): Promise<void>;
312
- put<T>(entries: Record<string, T>, options?: DurableObjectStorageOperationsPutOptions): Promise<void>;
313
- delete(key: string, options?: DurableObjectStorageOperationsPutOptions): Promise<boolean>;
314
- delete(keys: string[], options?: DurableObjectStorageOperationsPutOptions): Promise<number>;
315
- deleteAll(options?: DurableObjectStorageOperationsPutOptions): Promise<void>;
329
+ get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;
330
+ get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
331
+ list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
332
+ put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
333
+ put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
334
+ delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
335
+ delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
336
+ deleteAll(options?: DurableObjectPutOptions): Promise<void>;
316
337
  transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;
317
338
  }
318
339
 
319
- interface DurableObjectStorageOperationsGetOptions {
320
- allowConcurrency?: boolean;
321
- noCache?: boolean;
322
- }
340
+ /**
341
+ *
342
+ * @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
343
+ */
344
+ declare type DurableObjectStorageOperationsGetOptions = DurableObjectGetOptions;
323
345
 
324
- interface DurableObjectStorageOperationsListOptions {
325
- start?: string;
326
- end?: string;
327
- prefix?: string;
328
- reverse?: boolean;
329
- limit?: number;
330
- allowConcurrency?: boolean;
331
- noCache?: boolean;
332
- }
346
+ /**
347
+ *
348
+ * @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
349
+ */
350
+ declare type DurableObjectStorageOperationsListOptions = DurableObjectListOptions;
333
351
 
334
- interface DurableObjectStorageOperationsPutOptions {
335
- allowConcurrency?: boolean;
336
- allowUnconfirmed?: boolean;
337
- noCache?: boolean;
338
- }
352
+ /**
353
+ *
354
+ * @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
355
+ */
356
+ declare type DurableObjectStorageOperationsPutOptions = DurableObjectPutOptions;
339
357
 
340
358
  interface DurableObjectStub extends Fetcher {
341
359
  readonly id: DurableObjectId;
@@ -343,13 +361,13 @@ interface DurableObjectStub extends Fetcher {
343
361
  }
344
362
 
345
363
  interface DurableObjectTransaction {
346
- get<T = unknown>(key: string, options?: DurableObjectStorageOperationsGetOptions): Promise<T>;
347
- get<T = unknown>(keys: string[], options?: DurableObjectStorageOperationsGetOptions): Promise<Map<string, T>>;
348
- list<T = unknown>(options?: DurableObjectStorageOperationsListOptions): Promise<Map<string, T>>;
349
- put<T>(key: string, value: T, options?: DurableObjectStorageOperationsPutOptions): Promise<void>;
350
- put<T>(entries: Record<string, T>, options?: DurableObjectStorageOperationsPutOptions): Promise<void>;
351
- delete(key: string, options?: DurableObjectStorageOperationsPutOptions): Promise<boolean>;
352
- delete(keys: string[], options?: DurableObjectStorageOperationsPutOptions): Promise<number>;
364
+ get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T>;
365
+ get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;
366
+ list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;
367
+ put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;
368
+ put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;
369
+ delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;
370
+ delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;
353
371
  rollback(): void;
354
372
  }
355
373
 
@@ -618,6 +636,27 @@ interface IncomingRequestCfPropertiesTLSClientAuth {
618
636
  certVerified: string;
619
637
  }
620
638
 
639
+ interface JsonWebKey {
640
+ kty: string;
641
+ use?: string;
642
+ key_ops?: string[];
643
+ alg?: string;
644
+ ext?: boolean;
645
+ crv?: string;
646
+ x?: string;
647
+ y?: string;
648
+ d?: string;
649
+ n?: string;
650
+ e?: string;
651
+ p?: string;
652
+ q?: string;
653
+ dp?: string;
654
+ dq?: string;
655
+ qi?: string;
656
+ oth?: RsaOtherPrimesInfo[];
657
+ k?: string;
658
+ }
659
+
621
660
  /**
622
661
  * Workers KV is a global, low-latency, key-value data store. It supports exceptionally high read volumes with low-latency,
623
662
  * making it possible to build highly dynamic APIs and websites which respond as quickly as a cached static file would.
@@ -846,6 +885,7 @@ interface RequestInitCfProperties {
846
885
  image?: RequestInitCfPropertiesImage;
847
886
  minify?: RequestInitCfPropertiesImageMinify;
848
887
  mirage?: boolean;
888
+ polish?: 'lossy' | 'lossless' | 'off';
849
889
  /**
850
890
  * Redirects the request to an alternate origin server. You can use this,
851
891
  * for example, to implement load balancing across several origins.
@@ -984,6 +1024,12 @@ interface ResponseInit {
984
1024
  */
985
1025
  declare type ResponseInitializerDict = ResponseInit;
986
1026
 
1027
+ interface RsaOtherPrimesInfo {
1028
+ r?: string;
1029
+ d?: string;
1030
+ t?: string;
1031
+ }
1032
+
987
1033
  interface ScheduledController {
988
1034
  readonly scheduledTime: number;
989
1035
  readonly cron: string;
@@ -1028,8 +1074,8 @@ declare abstract class SubtleCrypto {
1028
1074
  generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;
1029
1075
  deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
1030
1076
  deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
1031
- importKey(format: string, keyData: ArrayBuffer | SubtleCryptoJsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
1032
- exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | SubtleCryptoJsonWebKey>;
1077
+ importKey(format: string, keyData: ArrayBuffer | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
1078
+ exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
1033
1079
  wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;
1034
1080
  unwrapKey(format: string, wrappedKey: ArrayBuffer, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
1035
1081
  }
@@ -1074,32 +1120,17 @@ interface SubtleCryptoImportKeyAlgorithm {
1074
1120
  compressed?: boolean;
1075
1121
  }
1076
1122
 
1077
- interface SubtleCryptoJsonWebKey {
1078
- kty: string;
1079
- use?: string;
1080
- key_ops?: string[];
1081
- alg?: string;
1082
- ext?: boolean;
1083
- crv?: string;
1084
- x?: string;
1085
- y?: string;
1086
- d?: string;
1087
- n?: string;
1088
- e?: string;
1089
- p?: string;
1090
- q?: string;
1091
- dp?: string;
1092
- dq?: string;
1093
- qi?: string;
1094
- oth?: SubtleCryptoJsonWebKeyRsaOtherPrimesInfo[];
1095
- k?: string;
1096
- }
1123
+ /**
1124
+ *
1125
+ * @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
1126
+ */
1127
+ declare type SubtleCryptoJsonWebKey = JsonWebKey;
1097
1128
 
1098
- interface SubtleCryptoJsonWebKeyRsaOtherPrimesInfo {
1099
- r?: string;
1100
- d?: string;
1101
- t?: string;
1102
- }
1129
+ /**
1130
+ *
1131
+ * @deprecated Don't use. Introduced incidentally in 3.x. Scheduled for removal.
1132
+ */
1133
+ declare type SubtleCryptoJsonWebKeyRsaOtherPrimesInfo = RsaOtherPrimesInfo;
1103
1134
 
1104
1135
  interface SubtleCryptoSignAlgorithm {
1105
1136
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/workers-types",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "TypeScript typings for Cloudflare Workers",
5
5
  "repository": {
6
6
  "type": "git",