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