@cloudflare/workers-types 4.20250321.0 → 4.20250401.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/oldest/index.ts CHANGED
@@ -4532,8 +4532,10 @@ export interface BasicImageTransformations {
4532
4532
  * (white by default). Use of this mode is not recommended, as the same
4533
4533
  * effect can be more efficiently achieved with the contain mode and the
4534
4534
  * CSS object-fit: contain property.
4535
+ * - squeeze: Stretches and deforms to the width and height given, even if it
4536
+ * breaks aspect ratio
4535
4537
  */
4536
- fit?: "scale-down" | "contain" | "cover" | "crop" | "pad";
4538
+ fit?: "scale-down" | "contain" | "cover" | "crop" | "pad" | "squeeze";
4537
4539
  /**
4538
4540
  * When cropping with fit: "cover", this defines the side or point that should
4539
4541
  * be left uncropped. The value is either a string
@@ -4553,6 +4555,7 @@ export interface BasicImageTransformations {
4553
4555
  | "bottom"
4554
4556
  | "center"
4555
4557
  | "auto"
4558
+ | "entropy"
4556
4559
  | BasicImageTransformationsGravityCoordinates;
4557
4560
  /**
4558
4561
  * Background color to add underneath the image. Applies only to images with
@@ -4567,8 +4570,9 @@ export interface BasicImageTransformations {
4567
4570
  rotate?: 0 | 90 | 180 | 270 | 360;
4568
4571
  }
4569
4572
  export interface BasicImageTransformationsGravityCoordinates {
4570
- x: number;
4571
- y: number;
4573
+ x?: number;
4574
+ y?: number;
4575
+ mode?: "remainder" | "box-center";
4572
4576
  }
4573
4577
  /**
4574
4578
  * In addition to the properties you can set in the RequestInit dict
@@ -4676,23 +4680,43 @@ export interface RequestInitCfPropertiesImage
4676
4680
  */
4677
4681
  dpr?: number;
4678
4682
  /**
4679
- * An object with four properties {left, top, right, bottom} that specify
4680
- * a number of pixels to cut off on each side. Allows removal of borders
4681
- * or cutting out a specific fragment of an image. Trimming is performed
4682
- * before resizing or rotation. Takes dpr into account.
4683
- */
4684
- trim?: {
4685
- left?: number;
4686
- top?: number;
4687
- right?: number;
4688
- bottom?: number;
4689
- };
4683
+ * Allows you to trim your image. Takes dpr into account and is performed before
4684
+ * resizing or rotation.
4685
+ *
4686
+ * It can be used as:
4687
+ * - left, top, right, bottom - it will specify the number of pixels to cut
4688
+ * off each side
4689
+ * - width, height - the width/height you'd like to end up with - can be used
4690
+ * in combination with the properties above
4691
+ * - border - this will automatically trim the surroundings of an image based on
4692
+ * it's color. It consists of three properties:
4693
+ * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
4694
+ * - tolerance: difference from color to treat as color
4695
+ * - keep: the number of pixels of border to keep
4696
+ */
4697
+ trim?:
4698
+ | "border"
4699
+ | {
4700
+ top?: number;
4701
+ bottom?: number;
4702
+ left?: number;
4703
+ right?: number;
4704
+ width?: number;
4705
+ height?: number;
4706
+ border?:
4707
+ | boolean
4708
+ | {
4709
+ color?: string;
4710
+ tolerance?: number;
4711
+ keep?: number;
4712
+ };
4713
+ };
4690
4714
  /**
4691
4715
  * Quality setting from 1-100 (useful values are in 60-90 range). Lower values
4692
4716
  * make images look worse, but load faster. The default is 85. It applies only
4693
4717
  * to JPEG and WebP images. It doesn’t have any effect on PNG.
4694
4718
  */
4695
- quality?: number;
4719
+ quality?: number | "low" | "medium-low" | "medium-high" | "high";
4696
4720
  /**
4697
4721
  * Output format to generate. It can be:
4698
4722
  * - avif: generate images in AVIF format.
@@ -4704,7 +4728,15 @@ export interface RequestInitCfPropertiesImage
4704
4728
  * - jpeg: generate images in JPEG format.
4705
4729
  * - png: generate images in PNG format.
4706
4730
  */
4707
- format?: "avif" | "webp" | "json" | "jpeg" | "png";
4731
+ format?:
4732
+ | "avif"
4733
+ | "webp"
4734
+ | "json"
4735
+ | "jpeg"
4736
+ | "png"
4737
+ | "baseline-jpeg"
4738
+ | "png-force"
4739
+ | "svg";
4708
4740
  /**
4709
4741
  * Whether to preserve animation frames from input files. Default is true.
4710
4742
  * Setting it to false reduces animations to still images. This setting is
@@ -4784,6 +4816,18 @@ export interface RequestInitCfPropertiesImage
4784
4816
  * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
4785
4817
  */
4786
4818
  gamma?: number;
4819
+ /**
4820
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
4821
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
4822
+ * ignored.
4823
+ */
4824
+ saturation?: number;
4825
+ /**
4826
+ * Flips the images horizontally, vertically, or both. Flipping is applied before
4827
+ * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
4828
+ * horizontally, then rotated by 90 degrees.
4829
+ */
4830
+ flip?: "h" | "v" | "hv";
4787
4831
  /**
4788
4832
  * Slightly reduces latency on a cache miss by selecting a
4789
4833
  * quickest-to-compress file format, at a cost of increased file size and
@@ -5700,7 +5744,26 @@ export type ImageInfoResponse =
5700
5744
  height: number;
5701
5745
  };
5702
5746
  export type ImageTransform = {
5747
+ width?: number;
5748
+ height?: number;
5749
+ background?: string;
5750
+ blur?: number;
5751
+ border?:
5752
+ | {
5753
+ color?: string;
5754
+ width?: number;
5755
+ }
5756
+ | {
5757
+ top?: number;
5758
+ bottom?: number;
5759
+ left?: number;
5760
+ right?: number;
5761
+ };
5762
+ brightness?: number;
5763
+ contrast?: number;
5703
5764
  fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
5765
+ flip?: "h" | "v" | "hv";
5766
+ gamma?: number;
5704
5767
  gravity?:
5705
5768
  | "left"
5706
5769
  | "right"
@@ -5709,45 +5772,31 @@ export type ImageTransform = {
5709
5772
  | "center"
5710
5773
  | "auto"
5711
5774
  | "entropy"
5712
- | "face"
5713
5775
  | {
5714
5776
  x?: number;
5715
5777
  y?: number;
5716
5778
  mode: "remainder" | "box-center";
5717
5779
  };
5718
- trim?: {
5719
- top?: number;
5720
- bottom?: number;
5721
- left?: number;
5722
- right?: number;
5723
- width?: number;
5724
- height?: number;
5725
- border?:
5726
- | boolean
5727
- | {
5728
- color?: string;
5729
- tolerance?: number;
5730
- keep?: number;
5731
- };
5732
- };
5733
- width?: number;
5734
- height?: number;
5735
- background?: string;
5736
- rotate?: number;
5780
+ rotate?: 0 | 90 | 180 | 270;
5781
+ saturation?: number;
5737
5782
  sharpen?: number;
5738
- blur?: number;
5739
- contrast?: number;
5740
- brightness?: number;
5741
- gamma?: number;
5742
- border?: {
5743
- color?: string;
5744
- width?: number;
5745
- top?: number;
5746
- bottom?: number;
5747
- left?: number;
5748
- right?: number;
5749
- };
5750
- zoom?: number;
5783
+ trim?:
5784
+ | "border"
5785
+ | {
5786
+ top?: number;
5787
+ bottom?: number;
5788
+ left?: number;
5789
+ right?: number;
5790
+ width?: number;
5791
+ height?: number;
5792
+ border?:
5793
+ | boolean
5794
+ | {
5795
+ color?: string;
5796
+ tolerance?: number;
5797
+ keep?: number;
5798
+ };
5799
+ };
5751
5800
  };
5752
5801
  export type ImageDrawOptions = {
5753
5802
  opacity?: number;
package/package.json CHANGED
@@ -7,5 +7,5 @@
7
7
  },
8
8
  "author": "Cloudflare Workers DevProd Team <workers-devprod@cloudflare.com> (https://workers.cloudflare.com)",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "4.20250321.0"
10
+ "version": "4.20250401.0"
11
11
  }