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