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