@cloudflare/workers-types 4.20260615.1 → 4.20260617.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.
@@ -12182,87 +12182,6 @@ declare abstract class BrowserRun {
12182
12182
  options: BrowserRunMarkdownOptions,
12183
12183
  ): Promise<Response>;
12184
12184
  }
12185
- interface BasicImageTransformations {
12186
- /**
12187
- * Maximum width in image pixels. The value must be an integer.
12188
- */
12189
- width?: number;
12190
- /**
12191
- * Maximum height in image pixels. The value must be an integer.
12192
- */
12193
- height?: number;
12194
- /**
12195
- * Resizing mode as a string. It affects interpretation of width and height
12196
- * options:
12197
- * - scale-down: Similar to contain, but the image is never enlarged. If
12198
- * the image is larger than given width or height, it will be resized.
12199
- * Otherwise its original size will be kept.
12200
- * - contain: Resizes to maximum size that fits within the given width and
12201
- * height. If only a single dimension is given (e.g. only width), the
12202
- * image will be shrunk or enlarged to exactly match that dimension.
12203
- * Aspect ratio is always preserved.
12204
- * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
12205
- * and height. If the image has an aspect ratio different from the ratio
12206
- * of width and height, it will be cropped to fit.
12207
- * - crop: The image will be shrunk and cropped to fit within the area
12208
- * specified by width and height. The image will not be enlarged. For images
12209
- * smaller than the given dimensions it's the same as scale-down. For
12210
- * images larger than the given dimensions, it's the same as cover.
12211
- * See also trim.
12212
- * - pad: Resizes to the maximum size that fits within the given width and
12213
- * height, and then fills the remaining area with a background color
12214
- * (white by default). Use of this mode is not recommended, as the same
12215
- * effect can be more efficiently achieved with the contain mode and the
12216
- * CSS object-fit: contain property.
12217
- * - squeeze: Stretches and deforms to the width and height given, even if it
12218
- * breaks aspect ratio
12219
- */
12220
- fit?: "scale-down" | "contain" | "cover" | "crop" | "pad" | "squeeze";
12221
- /**
12222
- * Image segmentation using artificial intelligence models. Sets pixels not
12223
- * within selected segment area to transparent e.g "foreground" sets every
12224
- * background pixel as transparent.
12225
- */
12226
- segment?: "foreground";
12227
- /**
12228
- * When cropping with fit: "cover", this defines the side or point that should
12229
- * be left uncropped. The value is either a string
12230
- * "left", "right", "top", "bottom", "auto", or "center" (the default),
12231
- * or an object {x, y} containing focal point coordinates in the original
12232
- * image expressed as fractions ranging from 0.0 (top or left) to 1.0
12233
- * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
12234
- * crop bottom or left and right sides as necessary, but won’t crop anything
12235
- * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
12236
- * preserve as much as possible around a point at 20% of the height of the
12237
- * source image.
12238
- */
12239
- gravity?:
12240
- | "face"
12241
- | "left"
12242
- | "right"
12243
- | "top"
12244
- | "bottom"
12245
- | "center"
12246
- | "auto"
12247
- | "entropy"
12248
- | BasicImageTransformationsGravityCoordinates;
12249
- /**
12250
- * Background color to add underneath the image. Applies only to images with
12251
- * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
12252
- * hsl(…), etc.)
12253
- */
12254
- background?: string;
12255
- /**
12256
- * Number of degrees (90, 180, 270) to rotate the image by. width and height
12257
- * options refer to axes after rotation.
12258
- */
12259
- rotate?: 0 | 90 | 180 | 270 | 360;
12260
- }
12261
- interface BasicImageTransformationsGravityCoordinates {
12262
- x?: number;
12263
- y?: number;
12264
- mode?: "remainder" | "box-center";
12265
- }
12266
12185
  /**
12267
12186
  * In addition to the properties you can set in the RequestInit dict
12268
12187
  * that you pass as an argument to the Request constructor, you can
@@ -12358,6 +12277,209 @@ interface RequestInitCfProperties extends Record<string, unknown> {
12358
12277
  */
12359
12278
  resolveOverride?: string;
12360
12279
  }
12280
+ interface BasicImageTransformations {
12281
+ /**
12282
+ * Maximum width in image pixels. The value must be an integer.
12283
+ */
12284
+ width?: number;
12285
+ /**
12286
+ * Maximum height in image pixels. The value must be an integer.
12287
+ */
12288
+ height?: number;
12289
+ /**
12290
+ * When cropping with fit: "cover", this defines the side or point that should
12291
+ * be left uncropped. The value is either a string
12292
+ * "left", "right", "top", "bottom", "auto", or "center" (the default),
12293
+ * or an object {x, y} containing focal point coordinates in the original
12294
+ * image expressed as fractions ranging from 0.0 (top or left) to 1.0
12295
+ * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
12296
+ * crop bottom or left and right sides as necessary, but won’t crop anything
12297
+ * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
12298
+ * preserve as much as possible around a point at 20% of the height of the
12299
+ * source image.
12300
+ */
12301
+ gravity?:
12302
+ | "face"
12303
+ | "left"
12304
+ | "right"
12305
+ | "top"
12306
+ | "bottom"
12307
+ | "center"
12308
+ | "auto"
12309
+ | "entropy"
12310
+ | BasicImageTransformationsGravityCoordinates;
12311
+ /**
12312
+ * Specifies how closely the image is cropped toward detected faces when combined
12313
+ * with the gravity=face option. Accepts a valid range between 0.0 (includes as much
12314
+ * of the background as possible) and 1.0 (crops the image as closely to the face as
12315
+ * possible). The default is 0.
12316
+ */
12317
+ zoom?: number;
12318
+ /**
12319
+ * Resizing mode as a string. It affects interpretation of width and height
12320
+ * options:
12321
+ * - scale-down: Similar to contain, but the image is never enlarged. If
12322
+ * the image is larger than given width or height, it will be resized.
12323
+ * Otherwise its original size will be kept.
12324
+ * - scale-up: Similar to contain, but the image is never shrunk. If the
12325
+ * image is smaller than the given width or height, it will be resized.
12326
+ * Otherwise its original size will be kept.
12327
+ * - contain: Resizes to maximum size that fits within the given width and
12328
+ * height. If only a single dimension is given (e.g. only width), the
12329
+ * image will be shrunk or enlarged to exactly match that dimension.
12330
+ * Aspect ratio is always preserved.
12331
+ * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
12332
+ * and height. If the image has an aspect ratio different from the ratio
12333
+ * of width and height, it will be cropped to fit.
12334
+ * - crop: The image will be shrunk and cropped to fit within the area
12335
+ * specified by width and height. The image will not be enlarged. For images
12336
+ * smaller than the given dimensions it's the same as scale-down. For
12337
+ * images larger than the given dimensions, it's the same as cover.
12338
+ * See also trim.
12339
+ * - pad: Resizes to the maximum size that fits within the given width and
12340
+ * height, and then fills the remaining area with a background color
12341
+ * (white by default). Use of this mode is not recommended, as the same
12342
+ * effect can be more efficiently achieved with the contain mode and the
12343
+ * CSS object-fit: contain property.
12344
+ * - squeeze: Stretches and deforms to the width and height given, even if it
12345
+ * breaks aspect ratio
12346
+ */
12347
+ fit?:
12348
+ | "scale-down"
12349
+ | "scale-up"
12350
+ | "contain"
12351
+ | "cover"
12352
+ | "crop"
12353
+ | "pad"
12354
+ | "squeeze";
12355
+ /**
12356
+ * Allows you to trim your image. Takes dpr into account and is performed before
12357
+ * resizing or rotation.
12358
+ *
12359
+ * It can be used as:
12360
+ * - left, top, right, bottom - it will specify the number of pixels to cut
12361
+ * off each side
12362
+ * - width, height - the width/height you'd like to end up with - can be used
12363
+ * in combination with the properties above
12364
+ * - border - this will automatically trim the surroundings of an image based on
12365
+ * it's color. It consists of three properties:
12366
+ * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
12367
+ * - tolerance: difference from color to treat as color
12368
+ * - keep: the number of pixels of border to keep
12369
+ */
12370
+ trim?:
12371
+ | "border"
12372
+ | {
12373
+ top?: number;
12374
+ bottom?: number;
12375
+ left?: number;
12376
+ right?: number;
12377
+ width?: number;
12378
+ height?: number;
12379
+ border?:
12380
+ | boolean
12381
+ | {
12382
+ color?: string;
12383
+ tolerance?: number;
12384
+ keep?: number;
12385
+ };
12386
+ };
12387
+ /**
12388
+ * Background color to add underneath the image. Applies only to images with
12389
+ * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
12390
+ * hsl(…), etc.)
12391
+ */
12392
+ background?: string;
12393
+ /**
12394
+ * Flips the images horizontally, vertically, or both. Flipping is applied before
12395
+ * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
12396
+ * horizontally, then rotated by 90 degrees.
12397
+ */
12398
+ flip?: "h" | "v" | "hv";
12399
+ /**
12400
+ * Number of degrees (90, 180, 270) to rotate the image by. width and height
12401
+ * options refer to axes after rotation.
12402
+ */
12403
+ rotate?: 0 | 90 | 180 | 270 | 360;
12404
+ /**
12405
+ * Strength of sharpening filter to apply to the image. Floating-point
12406
+ * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
12407
+ * recommended value for downscaled images.
12408
+ */
12409
+ sharpen?: number;
12410
+ /**
12411
+ * Radius of a blur filter (approximate gaussian). Maximum supported radius
12412
+ * is 250.
12413
+ */
12414
+ blur?: number;
12415
+ /**
12416
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12417
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12418
+ * ignored.
12419
+ */
12420
+ contrast?: number;
12421
+ /**
12422
+ * Increase brightness by a factor. A value of 1.0 equals no change, a value
12423
+ * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
12424
+ * 0 is ignored.
12425
+ */
12426
+ brightness?: number;
12427
+ /**
12428
+ * Increase exposure by a factor. A value of 1.0 equals no change, a value of
12429
+ * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
12430
+ */
12431
+ gamma?: number;
12432
+ /**
12433
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12434
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12435
+ * ignored.
12436
+ */
12437
+ saturation?: number;
12438
+ /**
12439
+ * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
12440
+ * easier to specify higher-DPI sizes in <img srcset>.
12441
+ */
12442
+ dpr?: number;
12443
+ /**
12444
+ * Adds a border around the image. The border is added after resizing. Border
12445
+ * width takes dpr into account, and can be specified either using a single
12446
+ * width property, or individually for each side.
12447
+ */
12448
+ border?:
12449
+ | {
12450
+ color: string;
12451
+ width: number;
12452
+ }
12453
+ | {
12454
+ color: string;
12455
+ top: number;
12456
+ right: number;
12457
+ bottom: number;
12458
+ left: number;
12459
+ };
12460
+ /**
12461
+ * Image segmentation using artificial intelligence models. Sets pixels not
12462
+ * within selected segment area to transparent e.g "foreground" sets every
12463
+ * background pixel as transparent.
12464
+ */
12465
+ segment?: "foreground";
12466
+ /**
12467
+ * Controls the algorithm used when an image needs to be enlarged. This
12468
+ * parameter works with any fit mode that upscales, such as `contain`,
12469
+ * `cover`, and `scale-up`. It has no effect when `fit=scale-down` or when
12470
+ * the target dimensions are smaller than the source.
12471
+ * - interpolate: Uses bicubic interpolation, which may reduce image quality.
12472
+ * This is the default behavior when `upscale` is not specified.
12473
+ * - generate: Uses AI upscaling to produce sharper, more detailed results
12474
+ * when enlarging images.
12475
+ */
12476
+ upscale?: "interpolate" | "generate";
12477
+ }
12478
+ interface BasicImageTransformationsGravityCoordinates {
12479
+ x?: number;
12480
+ y?: number;
12481
+ mode?: "remainder" | "box-center";
12482
+ }
12361
12483
  interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
12362
12484
  /**
12363
12485
  * Absolute URL of the image file to use for the drawing. It can be any of
@@ -12411,43 +12533,6 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
12411
12533
  right?: number;
12412
12534
  }
12413
12535
  interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12414
- /**
12415
- * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
12416
- * easier to specify higher-DPI sizes in <img srcset>.
12417
- */
12418
- dpr?: number;
12419
- /**
12420
- * Allows you to trim your image. Takes dpr into account and is performed before
12421
- * resizing or rotation.
12422
- *
12423
- * It can be used as:
12424
- * - left, top, right, bottom - it will specify the number of pixels to cut
12425
- * off each side
12426
- * - width, height - the width/height you'd like to end up with - can be used
12427
- * in combination with the properties above
12428
- * - border - this will automatically trim the surroundings of an image based on
12429
- * it's color. It consists of three properties:
12430
- * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
12431
- * - tolerance: difference from color to treat as color
12432
- * - keep: the number of pixels of border to keep
12433
- */
12434
- trim?:
12435
- | "border"
12436
- | {
12437
- top?: number;
12438
- bottom?: number;
12439
- left?: number;
12440
- right?: number;
12441
- width?: number;
12442
- height?: number;
12443
- border?:
12444
- | boolean
12445
- | {
12446
- color?: string;
12447
- tolerance?: number;
12448
- keep?: number;
12449
- };
12450
- };
12451
12536
  /**
12452
12537
  * Quality setting from 1-100 (useful values are in 60-90 range). Lower values
12453
12538
  * make images look worse, but load faster. The default is 85. It applies only
@@ -12497,17 +12582,6 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12497
12582
  * output formats always discard metadata.
12498
12583
  */
12499
12584
  metadata?: "keep" | "copyright" | "none";
12500
- /**
12501
- * Strength of sharpening filter to apply to the image. Floating-point
12502
- * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
12503
- * recommended value for downscaled images.
12504
- */
12505
- sharpen?: number;
12506
- /**
12507
- * Radius of a blur filter (approximate gaussian). Maximum supported radius
12508
- * is 250.
12509
- */
12510
- blur?: number;
12511
12585
  /**
12512
12586
  * Overlays are drawn in the order they appear in the array (last array
12513
12587
  * entry is the topmost layer).
@@ -12519,52 +12593,6 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12519
12593
  * the origin.
12520
12594
  */
12521
12595
  "origin-auth"?: "share-publicly";
12522
- /**
12523
- * Adds a border around the image. The border is added after resizing. Border
12524
- * width takes dpr into account, and can be specified either using a single
12525
- * width property, or individually for each side.
12526
- */
12527
- border?:
12528
- | {
12529
- color: string;
12530
- width: number;
12531
- }
12532
- | {
12533
- color: string;
12534
- top: number;
12535
- right: number;
12536
- bottom: number;
12537
- left: number;
12538
- };
12539
- /**
12540
- * Increase brightness by a factor. A value of 1.0 equals no change, a value
12541
- * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
12542
- * 0 is ignored.
12543
- */
12544
- brightness?: number;
12545
- /**
12546
- * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12547
- * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12548
- * ignored.
12549
- */
12550
- contrast?: number;
12551
- /**
12552
- * Increase exposure by a factor. A value of 1.0 equals no change, a value of
12553
- * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
12554
- */
12555
- gamma?: number;
12556
- /**
12557
- * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12558
- * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12559
- * ignored.
12560
- */
12561
- saturation?: number;
12562
- /**
12563
- * Flips the images horizontally, vertically, or both. Flipping is applied before
12564
- * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
12565
- * horizontally, then rotated by 90 degrees.
12566
- */
12567
- flip?: "h" | "v" | "hv";
12568
12596
  /**
12569
12597
  * Slightly reduces latency on a cache miss by selecting a
12570
12598
  * quickest-to-compress file format, at a cost of increased file size and
@@ -14504,6 +14532,10 @@ declare namespace CloudflareWorkersModule {
14504
14532
  timeout?: WorkflowTimeoutDuration | number;
14505
14533
  sensitive?: WorkflowStepSensitivity;
14506
14534
  };
14535
+ export type WorkflowStepRollbackConfig = Pick<
14536
+ WorkflowStepConfig,
14537
+ "retries" | "timeout"
14538
+ >;
14507
14539
  export type WorkflowCronSchedule = {
14508
14540
  /** Cron expression that triggered this event. */
14509
14541
  cron: string;
@@ -14532,16 +14564,18 @@ declare namespace CloudflareWorkersModule {
14532
14564
  config: WorkflowStepConfig;
14533
14565
  };
14534
14566
  export type WorkflowRollbackContext<T = unknown> = {
14567
+ ctx: WorkflowStepContext;
14535
14568
  error: Error;
14536
14569
  output: T | undefined;
14570
+ /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
14537
14571
  stepName: string;
14538
14572
  };
14539
14573
  export type WorkflowRollbackHandler<T = unknown> = (
14540
14574
  ctx: WorkflowRollbackContext<T>,
14541
14575
  ) => Promise<void>;
14542
14576
  export type WorkflowStepRollbackOptions<T = unknown> = {
14543
- rollback?: WorkflowRollbackHandler<T>;
14544
- rollbackConfig?: WorkflowStepConfig;
14577
+ rollback: WorkflowRollbackHandler<T>;
14578
+ rollbackConfig?: WorkflowStepRollbackConfig;
14545
14579
  };
14546
14580
  export abstract class WorkflowStep {
14547
14581
  do<T extends Rpc.Serializable<T>>(