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